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/fxge/include/fx_font.h" | 7 #include "core/fxge/include/fx_font.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
10 #include "core/fxge/ge/fx_text_int.h" | 10 #include "core/fxge/ge/fx_text_int.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {} | 449 CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {} |
450 | 450 |
451 uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) { | 451 uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) { |
452 FXFT_Face face = m_pFont->GetFace(); | 452 FXFT_Face face = m_pFont->GetFace(); |
453 if (!face) | 453 if (!face) |
454 return charcode; | 454 return charcode; |
455 | 455 |
456 if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0) | 456 if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0) |
457 return FXFT_Get_Char_Index(face, charcode); | 457 return FXFT_Get_Char_Index(face, charcode); |
458 | 458 |
459 if (m_pFont->GetSubstFont() && m_pFont->GetSubstFont()->m_Charset == 2) { | 459 if (m_pFont->GetSubstFont() && |
| 460 m_pFont->GetSubstFont()->m_Charset == FXFONT_SYMBOL_CHARSET) { |
460 uint32_t index = 0; | 461 uint32_t index = 0; |
461 if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0) | 462 if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0) |
462 index = FXFT_Get_Char_Index(face, charcode); | 463 index = FXFT_Get_Char_Index(face, charcode); |
463 if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN)) | 464 if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN)) |
464 return FXFT_Get_Char_Index(face, charcode); | 465 return FXFT_Get_Char_Index(face, charcode); |
465 } | 466 } |
466 return charcode; | 467 return charcode; |
467 } | 468 } |
468 | 469 |
469 #ifdef PDF_ENABLE_XFA | 470 #ifdef PDF_ENABLE_XFA |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) { | 531 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) { |
531 CFX_UnicodeEncodingEx* pFontEncoding = | 532 CFX_UnicodeEncodingEx* pFontEncoding = |
532 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]); | 533 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]); |
533 if (pFontEncoding) { | 534 if (pFontEncoding) { |
534 return pFontEncoding; | 535 return pFontEncoding; |
535 } | 536 } |
536 } | 537 } |
537 return nullptr; | 538 return nullptr; |
538 } | 539 } |
539 #endif // PDF_ENABLE_XFA | 540 #endif // PDF_ENABLE_XFA |
OLD | NEW |