diff options
-rw-r--r-- | fpdfsdk/formfiller/cba_fontmap.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 08a3021a73..ae0cc80bf2 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/formfiller/cba_fontmap.h" +#include <memory> #include <utility> #include "core/fpdfapi/font/cpdf_font.h" @@ -187,8 +188,11 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, "Font", pStreamResFontList->MakeReference(m_pDocument.Get())); } if (!pStreamResFontList->KeyExist(sAlias)) { - pStreamResFontList->SetFor( - sAlias, pFont->GetFontDict()->MakeReference(m_pDocument.Get())); + CPDF_Dictionary* pFontDict = pFont->GetFontDict(); + std::unique_ptr<CPDF_Object> pObject = + pFontDict->IsInline() ? pFontDict->Clone() + : pFontDict->MakeReference(m_pDocument.Get()); + pStreamResFontList->SetFor(sAlias, std::move(pObject)); } } |