From 412fa65331cc04776bf1e3da5f51f29ea0fc7937 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Fri, 24 Feb 2017 16:16:02 -0500 Subject: Remove repeated flags from CPDF_Font MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved all the flags to CFX_Font. Explicitly stated which ones are valued according to the PDF spec to avoid their values being changed. Change-Id: Ib57593234a4b9b83ef1ad593d0396c64159f303f Reviewed-on: https://pdfium-review.googlesource.com/2837 Commit-Queue: Nicolás Peña Reviewed-by: Tom Sepez --- core/fpdfapi/font/cpdf_font.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'core/fpdfapi/font/cpdf_font.cpp') diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 5563202455..36d7d6aeeb 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -161,7 +161,7 @@ uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const { } void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { - m_Flags = pFontDesc->GetIntegerFor("Flags", PDFFONT_NONSYMBOLIC); + m_Flags = pFontDesc->GetIntegerFor("Flags", FXFONT_NONSYMBOLIC); int ItalicAngle = 0; bool bExistItalicAngle = false; if (pFontDesc->KeyExist("ItalicAngle")) { @@ -169,7 +169,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { bExistItalicAngle = true; } if (ItalicAngle < 0) { - m_Flags |= PDFFONT_ITALIC; + m_Flags |= FXFONT_ITALIC; m_ItalicAngle = ItalicAngle; } bool bExistStemV = false; @@ -188,16 +188,14 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { bExistDescent = true; } bool bExistCapHeight = false; - if (pFontDesc->KeyExist("CapHeight")) { + if (pFontDesc->KeyExist("CapHeight")) bExistCapHeight = true; - } if (bExistItalicAngle && bExistAscent && bExistCapHeight && bExistDescent && bExistStemV) { - m_Flags |= PDFFONT_USEEXTERNATTR; + m_Flags |= FXFONT_USEEXTERNATTR; } - if (m_Descent > 10) { + if (m_Descent > 10) m_Descent = -m_Descent; - } CPDF_Array* pBBox = pFontDesc->GetArrayFor("FontBBox"); if (pBBox) { m_FontBBox.left = pBBox->GetIntegerAt(0); @@ -372,10 +370,9 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) { return; } - if ((m_Flags & PDFFONT_SYMBOLIC) && m_BaseFont == "Symbol") { - if (!bTrueType) { + if ((m_Flags & FXFONT_SYMBOLIC) && m_BaseFont == "Symbol") { + if (!bTrueType) iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL; - } return; } CFX_ByteString bsEncoding = pEncoding->GetString(); -- cgit v1.2.3