| 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 "../../../include/fpdfapi/fpdf_module.h" |
| 7 #include "../../../include/fpdfapi/fpdf_page.h" | 8 #include "../../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../../include/fpdfapi/fpdf_module.h" | |
| 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
| 10 #include "../../../include/fpdfapi/fpdf_resource.h" |
| 11 #include "../../../include/fxge/fx_freetype.h" |
| 12 #include "../fpdf_page/pageint.h" |
| 10 #include "font_int.h" | 13 #include "font_int.h" |
| 11 #include "../fpdf_page/pageint.h" | |
| 12 #include "../../../include/fxge/fx_freetype.h" | |
| 13 | 14 |
| 14 FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) | 15 FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) |
| 15 { | 16 { |
| 16 for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i ++) { | 17 for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i ++) { |
| 17 if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == plat
form_id && | 18 if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == plat
form_id && |
| 18 FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) ==
encoding_id) { | 19 FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) ==
encoding_id) { |
| 19 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]); | 20 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]); |
| 20 return TRUE; | 21 return TRUE; |
| 21 } | 22 } |
| 22 } | 23 } |
| 23 return FALSE; | 24 return FALSE; |
| 24 } | 25 } |
| 25 extern const FX_WORD* PDF_UnicodesForPredefinedCharSet(int); | |
| 26 CPDF_FontGlobals::CPDF_FontGlobals() | 26 CPDF_FontGlobals::CPDF_FontGlobals() |
| 27 : m_pContrastRamps(NULL) | 27 : m_pContrastRamps(NULL) |
| 28 { | 28 { |
| 29 FXSYS_memset(m_EmbeddedCharsets, 0, sizeof(m_EmbeddedCharsets)); | 29 FXSYS_memset(m_EmbeddedCharsets, 0, sizeof(m_EmbeddedCharsets)); |
| 30 FXSYS_memset(m_EmbeddedToUnicodes, 0, sizeof(m_EmbeddedToUnicodes)); | 30 FXSYS_memset(m_EmbeddedToUnicodes, 0, sizeof(m_EmbeddedToUnicodes)); |
| 31 } | 31 } |
| 32 CPDF_FontGlobals::~CPDF_FontGlobals() | 32 CPDF_FontGlobals::~CPDF_FontGlobals() |
| 33 { | 33 { |
| 34 ClearAll(); | 34 ClearAll(); |
| 35 if (m_pContrastRamps) { | 35 if (m_pContrastRamps) { |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 return FALSE; | 809 return FALSE; |
| 810 } | 810 } |
| 811 if (m_pFontFile != NULL) { | 811 if (m_pFontFile != NULL) { |
| 812 return FALSE; | 812 return FALSE; |
| 813 } | 813 } |
| 814 if (((CPDF_Type1Font*)this)->GetBase14Font() < 0) { | 814 if (((CPDF_Type1Font*)this)->GetBase14Font() < 0) { |
| 815 return FALSE; | 815 return FALSE; |
| 816 } | 816 } |
| 817 return TRUE; | 817 return TRUE; |
| 818 } | 818 } |
| 819 extern const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t ch
arcode); | |
| 820 CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) | 819 CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) |
| 821 { | 820 { |
| 822 FXSYS_memset(m_CharBBox, 0xff, sizeof m_CharBBox); | 821 FXSYS_memset(m_CharBBox, 0xff, sizeof m_CharBBox); |
| 823 FXSYS_memset(m_CharWidth, 0xff, sizeof m_CharWidth); | 822 FXSYS_memset(m_CharWidth, 0xff, sizeof m_CharWidth); |
| 824 FXSYS_memset(m_GlyphIndex, 0xff, sizeof m_GlyphIndex); | 823 FXSYS_memset(m_GlyphIndex, 0xff, sizeof m_GlyphIndex); |
| 825 FXSYS_memset(m_ExtGID, 0xff, sizeof m_ExtGID); | 824 FXSYS_memset(m_ExtGID, 0xff, sizeof m_ExtGID); |
| 826 m_pCharNames = NULL; | 825 m_pCharNames = NULL; |
| 827 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN; | 826 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN; |
| 828 } | 827 } |
| 829 CPDF_SimpleFont::~CPDF_SimpleFont() | 828 CPDF_SimpleFont::~CPDF_SimpleFont() |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 pDict->SetAt(FX_BSTRC("Differences"), pDiff); | 1411 pDict->SetAt(FX_BSTRC("Differences"), pDiff); |
| 1413 return pDict; | 1412 return pDict; |
| 1414 } | 1413 } |
| 1415 CPDF_TrueTypeFont::CPDF_TrueTypeFont() : CPDF_SimpleFont(PDFFONT_TRUETYPE) | 1414 CPDF_TrueTypeFont::CPDF_TrueTypeFont() : CPDF_SimpleFont(PDFFONT_TRUETYPE) |
| 1416 { | 1415 { |
| 1417 } | 1416 } |
| 1418 FX_BOOL CPDF_TrueTypeFont::_Load() | 1417 FX_BOOL CPDF_TrueTypeFont::_Load() |
| 1419 { | 1418 { |
| 1420 return LoadCommon(); | 1419 return LoadCommon(); |
| 1421 } | 1420 } |
| 1422 extern FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); | |
| 1423 void CPDF_TrueTypeFont::LoadGlyphMap() | 1421 void CPDF_TrueTypeFont::LoadGlyphMap() |
| 1424 { | 1422 { |
| 1425 if (m_Font.m_Face == NULL) { | 1423 if (m_Font.m_Face == NULL) { |
| 1426 return; | 1424 return; |
| 1427 } | 1425 } |
| 1428 int baseEncoding = m_BaseEncoding; | 1426 int baseEncoding = m_BaseEncoding; |
| 1429 if (m_pFontFile && m_Font.m_Face->num_charmaps > 0 | 1427 if (m_pFontFile && m_Font.m_Face->num_charmaps > 0 |
| 1430 && (baseEncoding == PDFFONT_ENCODING_MACROMAN || baseEncoding == PDF
FONT_ENCODING_WINANSI) | 1428 && (baseEncoding == PDFFONT_ENCODING_MACROMAN || baseEncoding == PDF
FONT_ENCODING_WINANSI) |
| 1431 && (m_Flags & PDFFONT_SYMBOLIC)) { | 1429 && (m_Flags & PDFFONT_SYMBOLIC)) { |
| 1432 FX_BOOL bSupportWin = FALSE; | 1430 FX_BOOL bSupportWin = FALSE; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 m_pForm = NULL; | 1738 m_pForm = NULL; |
| 1741 m_pBitmap = NULL; | 1739 m_pBitmap = NULL; |
| 1742 m_bPageRequired = FALSE; | 1740 m_bPageRequired = FALSE; |
| 1743 m_bColored = FALSE; | 1741 m_bColored = FALSE; |
| 1744 } | 1742 } |
| 1745 CPDF_Type3Char::~CPDF_Type3Char() | 1743 CPDF_Type3Char::~CPDF_Type3Char() |
| 1746 { | 1744 { |
| 1747 delete m_pForm; | 1745 delete m_pForm; |
| 1748 delete m_pBitmap; | 1746 delete m_pBitmap; |
| 1749 } | 1747 } |
| OLD | NEW |