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 "font_int.h" | 7 #include "font_int.h" |
8 | 8 |
9 #include "core/src/fpdfapi/fpdf_page/pageint.h" | 9 #include "core/src/fpdfapi/fpdf_page/pageint.h" |
10 #include "core/include/fpdfapi/fpdf_module.h" | 10 #include "core/include/fpdfapi/fpdf_module.h" |
11 #include "core/include/fpdfapi/fpdf_page.h" | 11 #include "core/include/fpdfapi/fpdf_page.h" |
12 #include "core/include/fpdfapi/fpdf_pageobj.h" | 12 #include "core/include/fpdfapi/fpdf_pageobj.h" |
13 #include "core/include/fpdfapi/fpdf_resource.h" | 13 #include "core/include/fpdfapi/fpdf_resource.h" |
14 #include "core/include/fxcrt/fx_ext.h" | 14 #include "core/include/fxcrt/fx_ext.h" |
15 #include "core/include/fxge/fx_freetype.h" | 15 #include "core/include/fxge/fx_freetype.h" |
| 16 #include "third_party/base/stl_util.h" |
16 | 17 |
17 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 18 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
18 #include "core/src/fxge/apple/apple_int.h" | 19 #include "core/src/fxge/apple/apple_int.h" |
19 #endif | 20 #endif |
20 | 21 |
21 FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) { | 22 FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) { |
22 for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) { | 23 for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) { |
23 if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == | 24 if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == |
24 platform_id && | 25 platform_id && |
25 FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) == | 26 FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) == |
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.top / 1000.0f); | 1721 (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.top / 1000.0f); |
1721 if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) | 1722 if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) |
1722 char_rect = pNewChar->m_pForm->CalcBoundingBox(); | 1723 char_rect = pNewChar->m_pForm->CalcBoundingBox(); |
1723 | 1724 |
1724 char_rect.Transform(&m_FontMatrix); | 1725 char_rect.Transform(&m_FontMatrix); |
1725 rcBBox.left = FXSYS_round(char_rect.left * 1000); | 1726 rcBBox.left = FXSYS_round(char_rect.left * 1000); |
1726 rcBBox.right = FXSYS_round(char_rect.right * 1000); | 1727 rcBBox.right = FXSYS_round(char_rect.right * 1000); |
1727 rcBBox.top = FXSYS_round(char_rect.top * 1000); | 1728 rcBBox.top = FXSYS_round(char_rect.top * 1000); |
1728 rcBBox.bottom = FXSYS_round(char_rect.bottom * 1000); | 1729 rcBBox.bottom = FXSYS_round(char_rect.bottom * 1000); |
1729 | 1730 |
1730 FXSYS_assert(m_CacheMap.find(charcode) == m_CacheMap.end()); | 1731 ASSERT(!pdfium::ContainsKey(m_CacheMap, charcode)); |
1731 CPDF_Type3Char* pCachedChar = pNewChar.release(); | 1732 CPDF_Type3Char* pCachedChar = pNewChar.release(); |
1732 m_CacheMap[charcode] = pCachedChar; | 1733 m_CacheMap[charcode] = pCachedChar; |
1733 if (pCachedChar->m_pForm->CountObjects() == 0) { | 1734 if (pCachedChar->m_pForm->CountObjects() == 0) { |
1734 delete pCachedChar->m_pForm; | 1735 delete pCachedChar->m_pForm; |
1735 pCachedChar->m_pForm = nullptr; | 1736 pCachedChar->m_pForm = nullptr; |
1736 } | 1737 } |
1737 return pCachedChar; | 1738 return pCachedChar; |
1738 } | 1739 } |
1739 | 1740 |
1740 int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) { | 1741 int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) { |
(...skipping 19 matching lines...) Expand all Loading... |
1760 rect = pChar->m_BBox; | 1761 rect = pChar->m_BBox; |
1761 } | 1762 } |
1762 | 1763 |
1763 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) | 1764 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) |
1764 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {} | 1765 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {} |
1765 | 1766 |
1766 CPDF_Type3Char::~CPDF_Type3Char() { | 1767 CPDF_Type3Char::~CPDF_Type3Char() { |
1767 delete m_pForm; | 1768 delete m_pForm; |
1768 delete m_pBitmap; | 1769 delete m_pBitmap; |
1769 } | 1770 } |
OLD | NEW |