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/include/cpdf_font.h" |
7 #include "core/fxge/ge/fx_text_int.h" | 8 #include "core/fxge/ge/fx_text_int.h" |
8 #include "core/include/fxge/fx_freetype.h" | 9 #include "core/include/fxge/fx_freetype.h" |
9 #include "core/include/fxge/fx_ge.h" | 10 #include "core/include/fxge/fx_ge.h" |
10 | 11 |
11 #define EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em) | 12 #define EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em) |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 #ifdef PDF_ENABLE_XFA | 16 #ifdef PDF_ENABLE_XFA |
16 const uint32_t g_EncodingID[] = { | 17 const uint32_t g_EncodingID[] = { |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 FXFT_Face face = m_pFont->GetFace(); | 510 FXFT_Face face = m_pFont->GetFace(); |
510 int nmaps = FXFT_Get_Face_CharmapCount(face); | 511 int nmaps = FXFT_Get_Face_CharmapCount(face); |
511 for (int i = 0; i < nmaps; i++) { | 512 for (int i = 0; i < nmaps; i++) { |
512 int nEncodingID = | 513 int nEncodingID = |
513 FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]); | 514 FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]); |
514 if (nEncodingID == FXFM_ENCODING_UNICODE || | 515 if (nEncodingID == FXFM_ENCODING_UNICODE || |
515 nEncodingID == FXFM_ENCODING_MS_SYMBOL) { | 516 nEncodingID == FXFM_ENCODING_MS_SYMBOL) { |
516 return Unicode; | 517 return Unicode; |
517 } | 518 } |
518 } | 519 } |
519 return static_cast<uint32_t>(-1); | 520 return CPDF_Font::kInvalidCharCode; |
520 } | 521 } |
521 | 522 |
522 CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont, | 523 CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont, |
523 uint32_t nEncodingID) { | 524 uint32_t nEncodingID) { |
524 if (!pFont || !pFont->GetFace()) | 525 if (!pFont || !pFont->GetFace()) |
525 return nullptr; | 526 return nullptr; |
526 | 527 |
527 if (nEncodingID != FXFM_ENCODING_NONE) | 528 if (nEncodingID != FXFM_ENCODING_NONE) |
528 return _FXFM_CreateFontEncoding(pFont, nEncodingID); | 529 return _FXFM_CreateFontEncoding(pFont, nEncodingID); |
529 | 530 |
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 NULL; | 538 return NULL; |
538 } | 539 } |
539 #endif // PDF_ENABLE_XFA | 540 #endif // PDF_ENABLE_XFA |
OLD | NEW |