diff options
author | thestig <thestig@chromium.org> | 2016-06-21 14:38:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-21 14:38:28 -0700 |
commit | 907a5223ea5abd09878de20cc74c59ebd0d6c3c8 (patch) | |
tree | 7dba8b090eda4f65da57d1979bdb02cedd273055 /core/fpdfdoc/doc_utils.cpp | |
parent | 56a8b1944d555ed65dda97164b702a9a657485ca (diff) | |
download | pdfium-907a5223ea5abd09878de20cc74c59ebd0d6c3c8.tar.xz |
Use FXFONT defines in place of integers.
Fix nits along the way.
Review-Url: https://codereview.chromium.org/2083943003
Diffstat (limited to 'core/fpdfdoc/doc_utils.cpp')
-rw-r--r-- | core/fpdfdoc/doc_utils.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index ccef7feb57..7f79a34245 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -267,10 +267,11 @@ CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() { } return tm; } + void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { - if (!pDocument) { + if (!pDocument) return; - } + if (!pFormDict) { pFormDict = new CPDF_Dictionary; uint32_t dwObjNum = pDocument->AddIndirectObject(pFormDict); @@ -287,7 +288,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { AddInterFormFont(pFormDict, pDocument, pFont, csBaseName); csDefault = csBaseName; } - if (charSet != 0) { + if (charSet != FXFONT_ANSI_CHARSET) { CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr); if (!pFont || csFontName != "Helvetica") { @@ -478,15 +479,15 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, } return nullptr; } + CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag) { - csNameTag = ""; + csNameTag.clear(); uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); - CFX_SubstFont* pSubst; CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); if (pFont) { - pSubst = pFont->GetSubstFont(); + CFX_SubstFont* pSubst = pFont->GetSubstFont(); if (pSubst && pSubst->m_Charset == (int)charSet) { FindInterFormFont(pFormDict, pFont, csNameTag); return pFont; @@ -494,6 +495,7 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, } return GetNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); } + FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag) { @@ -623,10 +625,9 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, return pFont; } CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet); - if (!csFontName.IsEmpty()) { - if (FindInterFormFont(pFormDict, pDocument, csFontName, pFont, csNameTag)) { - return pFont; - } + if (!csFontName.IsEmpty() && + FindInterFormFont(pFormDict, pDocument, csFontName, pFont, csNameTag)) { + return pFont; } pFont = CPDF_InterForm::AddNativeFont(charSet, pDocument); if (pFont) { @@ -652,6 +653,7 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) { CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); pFonts->RemoveAt(csTag); } + void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { if (!pFormDict || csNameTag.IsEmpty()) { return; |