diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 16:58:33 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 16:58:33 -0800 |
commit | d983b09c3ae29a97cba8e9ec9c6351545f6087ee (patch) | |
tree | 5641a4bc6eddaa8069904c29c3e3897043411646 /core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | |
parent | f86d3f946e2f1977c7eaea01dcb9d7ecb3064cd1 (diff) | |
download | pdfium-d983b09c3ae29a97cba8e9ec9c6351545f6087ee.tar.xz |
Merge to XFA: Remove FX_BSTRC.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1521563002 .
(cherry picked from commit 1956a174020686f91cd3b34294e91f4560fe45aa)
Review URL: https://codereview.chromium.org/1526823002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 1434c9d336..89004fee55 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -605,27 +605,26 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { if (word.IsEmpty()) { return; } - if (word == FX_BSTRC("begincidchar")) { + if (word == "begincidchar") { m_Status = 1; m_CodeSeq = 0; - } else if (word == FX_BSTRC("begincidrange")) { + } else if (word == "begincidrange") { m_Status = 2; m_CodeSeq = 0; - } else if (word == FX_BSTRC("endcidrange") || - word == FX_BSTRC("endcidchar")) { + } else if (word == "endcidrange" || word == "endcidchar") { m_Status = 0; - } else if (word == FX_BSTRC("/WMode")) { + } else if (word == "/WMode") { m_Status = 6; - } else if (word == FX_BSTRC("/Registry")) { + } else if (word == "/Registry") { m_Status = 3; - } else if (word == FX_BSTRC("/Ordering")) { + } else if (word == "/Ordering") { m_Status = 4; - } else if (word == FX_BSTRC("/Supplement")) { + } else if (word == "/Supplement") { m_Status = 5; - } else if (word == FX_BSTRC("begincodespacerange")) { + } else if (word == "begincodespacerange") { m_Status = 7; m_CodeSeq = 0; - } else if (word == FX_BSTRC("usecmap")) { + } else if (word == "usecmap") { } else if (m_Status == 1 || m_Status == 2) { m_CodePoints[m_CodeSeq] = CMap_GetCode(word); m_CodeSeq++; @@ -669,7 +668,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { m_pCMap->m_bVertical = CMap_GetCode(word); m_Status = 0; } else if (m_Status == 7) { - if (word == FX_BSTRC("endcodespacerange")) { + if (word == "endcodespacerange") { int nSegs = m_CodeRanges.GetSize(); if (nSegs > 1) { m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes; @@ -779,15 +778,14 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName, FX_BOOL bPromptCJK) { m_PredefinedCMap = pName; - if (m_PredefinedCMap == FX_BSTRC("Identity-H") || - m_PredefinedCMap == FX_BSTRC("Identity-V")) { + if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") { m_Coding = CIDCODING_CID; m_bVertical = pName[9] == 'V'; m_bLoaded = TRUE; return TRUE; } CFX_ByteString cmapid = m_PredefinedCMap; - m_bVertical = cmapid.Right(1) == FX_BSTRC("V"); + m_bVertical = cmapid.Right(1) == "V"; if (cmapid.GetLength() > 2) { cmapid = cmapid.Left(cmapid.GetLength() - 2); } @@ -1155,10 +1153,10 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const { } FX_BOOL CPDF_CIDFont::_Load() { - if (m_pFontDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("TrueType")) { + if (m_pFontDict->GetString("Subtype") == "TrueType") { return LoadGB2312(); } - CPDF_Array* pFonts = m_pFontDict->GetArray(FX_BSTRC("DescendantFonts")); + CPDF_Array* pFonts = m_pFontDict->GetArray("DescendantFonts"); if (pFonts == NULL) { return FALSE; } @@ -1169,7 +1167,7 @@ FX_BOOL CPDF_CIDFont::_Load() { if (pCIDFontDict == NULL) { return FALSE; } - m_BaseFont = pCIDFontDict->GetString(FX_BSTRC("BaseFont")); + m_BaseFont = pCIDFontDict->GetString("BaseFont"); if ((m_BaseFont.Compare("CourierStd") == 0 || m_BaseFont.Compare("CourierStd-Bold") == 0 || m_BaseFont.Compare("CourierStd-BoldOblique") == 0 || @@ -1177,17 +1175,16 @@ FX_BOOL CPDF_CIDFont::_Load() { !IsEmbedded()) { m_bAdobeCourierStd = TRUE; } - CPDF_Dictionary* pFontDesc = - pCIDFontDict->GetDict(FX_BSTRC("FontDescriptor")); + CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDict("FontDescriptor"); if (pFontDesc) { LoadFontDescriptor(pFontDesc); } - CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding")); + CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); if (pEncoding == NULL) { return FALSE; } - CFX_ByteString subtype = pCIDFontDict->GetString(FX_BSTRC("Subtype")); - m_bType1 = (subtype == FX_BSTRC("CIDFontType0")); + CFX_ByteString subtype = pCIDFontDict->GetString("Subtype"); + m_bType1 = (subtype == "CIDFontType0"); if (pEncoding->IsName()) { CFX_ByteString cmap = pEncoding->GetString(); @@ -1209,11 +1206,9 @@ FX_BOOL CPDF_CIDFont::_Load() { } m_Charset = m_pCMap->m_Charset; if (m_Charset == CIDSET_UNKNOWN) { - CPDF_Dictionary* pCIDInfo = - pCIDFontDict->GetDict(FX_BSTRC("CIDSystemInfo")); + CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDict("CIDSystemInfo"); if (pCIDInfo) { - m_Charset = - CharsetFromOrdering(pCIDInfo->GetString(FX_BSTRC("Ordering"))); + m_Charset = CharsetFromOrdering(pCIDInfo->GetString("Ordering")); } } if (m_Charset != CIDSET_UNKNOWN) @@ -1224,7 +1219,7 @@ FX_BOOL CPDF_CIDFont::_Load() { ->m_CMapManager.GetCID2UnicodeMap( m_Charset, m_pFontFile == NULL && (m_pCMap->m_Coding == CIDCODING_CID || - pCIDFontDict->KeyExist(FX_BSTRC("W")))); + pCIDFontDict->KeyExist("W"))); if (m_Font.GetFace()) { if (m_bType1) { FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE); @@ -1232,8 +1227,8 @@ FX_BOOL CPDF_CIDFont::_Load() { FT_UseCIDCharmap(m_Font.GetFace(), m_pCMap->m_Coding); } } - m_DefaultWidth = pCIDFontDict->GetInteger(FX_BSTRC("DW"), 1000); - CPDF_Array* pWidthArray = pCIDFontDict->GetArray(FX_BSTRC("W")); + m_DefaultWidth = pCIDFontDict->GetInteger("DW", 1000); + CPDF_Array* pWidthArray = pCIDFontDict->GetArray("W"); if (pWidthArray) { LoadMetricsArray(pWidthArray, m_WidthList, 1); } @@ -1242,13 +1237,12 @@ FX_BOOL CPDF_CIDFont::_Load() { } if (1) { if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) { - CPDF_Object* pmap = - pCIDFontDict->GetElementValue(FX_BSTRC("CIDToGIDMap")); + CPDF_Object* pmap = pCIDFontDict->GetElementValue("CIDToGIDMap"); if (pmap) { if (CPDF_Stream* pStream = pmap->AsStream()) { m_pCIDToGIDMap = new CPDF_StreamAcc; m_pCIDToGIDMap->LoadAllData(pStream, FALSE); - } else if (pmap->GetString() == FX_BSTRC("Identity")) { + } else if (pmap->GetString() == "Identity") { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (m_pFontFile) { m_bCIDIsGID = TRUE; @@ -1262,11 +1256,11 @@ FX_BOOL CPDF_CIDFont::_Load() { } CheckFontMetrics(); if (IsVertWriting()) { - pWidthArray = pCIDFontDict->GetArray(FX_BSTRC("W2")); + pWidthArray = pCIDFontDict->GetArray("W2"); if (pWidthArray) { LoadMetricsArray(pWidthArray, m_VertMetrics, 3); } - CPDF_Array* pDefaultArray = pCIDFontDict->GetArray(FX_BSTRC("DW2")); + CPDF_Array* pDefaultArray = pCIDFontDict->GetArray("DW2"); if (pDefaultArray) { m_DefaultVY = pDefaultArray->GetInteger(0); m_DefaultW1 = pDefaultArray->GetInteger(1); @@ -1693,8 +1687,8 @@ FX_FLOAT CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) { } FX_BOOL CPDF_CIDFont::LoadGB2312() { - m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont")); - CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict(FX_BSTRC("FontDescriptor")); + m_BaseFont = m_pFontDict->GetString("BaseFont"); + CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor"); if (pFontDesc) { LoadFontDescriptor(pFontDesc); } @@ -1703,7 +1697,7 @@ FX_BOOL CPDF_CIDFont::LoadGB2312() { m_pCMap = CPDF_ModuleMgr::Get() ->GetPageModule() ->GetFontGlobals() - ->m_CMapManager.GetPredefinedCMap(FX_BSTRC("GBK-EUC-H"), FALSE); + ->m_CMapManager.GetPredefinedCMap("GBK-EUC-H", FALSE); m_pCID2UnicodeMap = CPDF_ModuleMgr::Get() ->GetPageModule() ->GetFontGlobals() |