OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/font_int.h" | 7 #include "core/fpdfapi/fpdf_font/font_int.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/ttgsubtable.h" | 10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 if (iChar == pRanges[iSeg].m_CharSize) | 277 if (iChar == pRanges[iSeg].m_CharSize) |
278 return size; | 278 return size; |
279 --iSeg; | 279 --iSeg; |
280 } | 280 } |
281 --size; | 281 --size; |
282 ++offset; | 282 ++offset; |
283 } | 283 } |
284 return 1; | 284 return 1; |
285 } | 285 } |
286 | 286 |
| 287 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 288 |
287 bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) { | 289 bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) { |
288 switch (charset) { | 290 switch (charset) { |
289 case CIDSET_GB1: | 291 case CIDSET_GB1: |
290 case CIDSET_CNS1: | 292 case CIDSET_CNS1: |
291 case CIDSET_JAPAN1: | 293 case CIDSET_JAPAN1: |
292 case CIDSET_KOREA1: | 294 case CIDSET_KOREA1: |
293 return true; | 295 return true; |
294 | 296 |
295 default: | 297 default: |
296 return false; | 298 return false; |
297 } | 299 } |
298 } | 300 } |
299 | 301 |
300 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | |
301 | |
302 FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, | 302 FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, |
303 CIDSet charset, | 303 CIDSet charset, |
304 FX_WCHAR unicode) { | 304 FX_WCHAR unicode) { |
305 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) | 305 if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) |
306 return 0; | 306 return 0; |
307 | 307 |
308 CPDF_FontGlobals* pFontGlobals = | 308 CPDF_FontGlobals* pFontGlobals = |
309 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); | 309 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); |
310 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; | 310 const uint16_t* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; |
311 if (!pCodes) | 311 if (!pCodes) |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 | 1671 |
1672 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { | 1672 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { |
1673 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 1673 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
1674 return nullptr; | 1674 return nullptr; |
1675 | 1675 |
1676 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( | 1676 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( |
1677 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), | 1677 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), |
1678 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); | 1678 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); |
1679 return found ? &found->a : nullptr; | 1679 return found ? &found->a : nullptr; |
1680 } | 1680 } |
OLD | NEW |