OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" | 7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" | 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" |
10 #include "core/fpdfapi/fpdf_font/font_int.h" | 10 #include "core/fpdfapi/fpdf_font/font_int.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 FX_WCHAR unicode) { | 148 FX_WCHAR unicode) { |
149 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) | 149 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) |
150 return 0; | 150 return 0; |
151 | 151 |
152 CPDF_FontGlobals* pFontGlobals = | 152 CPDF_FontGlobals* pFontGlobals = |
153 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); | 153 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); |
154 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; | 154 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; |
155 if (!pCodes) | 155 if (!pCodes) |
156 return 0; | 156 return 0; |
157 | 157 |
158 int nCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count; | 158 for (uint32_t i = 0; i < pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count; |
159 for (int i = 0; i < nCodes; ++i) { | 159 ++i) { |
160 if (pCodes[i] == unicode) { | 160 if (pCodes[i] == unicode) { |
161 uint32_t CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); | 161 uint32_t CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); |
162 if (CharCode != 0) { | 162 if (CharCode != 0) |
163 return CharCode; | 163 return CharCode; |
164 } | |
165 } | 164 } |
166 } | 165 } |
167 return 0; | 166 return 0; |
168 } | 167 } |
169 | 168 |
170 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 169 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
171 | 170 |
172 void FT_UseCIDCharmap(FXFT_Face face, int coding) { | 171 void FT_UseCIDCharmap(FXFT_Face face, int coding) { |
173 int encoding; | 172 int encoding; |
174 switch (coding) { | 173 switch (coding) { |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 | 898 |
900 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { | 899 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { |
901 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 900 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
902 return nullptr; | 901 return nullptr; |
903 | 902 |
904 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( | 903 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( |
905 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), | 904 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), |
906 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); | 905 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); |
907 return found ? &found->a : nullptr; | 906 return found ? &found->a : nullptr; |
908 } | 907 } |
OLD | NEW |