OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/font/cpdf_type3font.h" | 7 #include "core/fpdfapi/font/cpdf_type3font.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 count = 256; | 65 count = 256; |
66 if (StartChar + count > 256) | 66 if (StartChar + count > 256) |
67 count = 256 - StartChar; | 67 count = 256 - StartChar; |
68 for (size_t i = 0; i < count; i++) { | 68 for (size_t i = 0; i < count; i++) { |
69 m_CharWidthL[StartChar + i] = | 69 m_CharWidthL[StartChar + i] = |
70 FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000); | 70 FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000); |
71 } | 71 } |
72 } | 72 } |
73 m_pCharProcs = m_pFontDict->GetDictFor("CharProcs"); | 73 m_pCharProcs = m_pFontDict->GetDictFor("CharProcs"); |
74 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding"); | 74 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding"); |
75 if (pEncoding) { | 75 if (pEncoding) |
76 LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, false, false); | 76 LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, false, false); |
77 if (!m_CharNames.empty()) { | |
78 for (int i = 0; i < 256; i++) { | |
79 m_Encoding.m_Unicodes[i] = | |
80 PDF_UnicodeFromAdobeName(m_CharNames[i].c_str()); | |
81 if (m_Encoding.m_Unicodes[i] == 0) { | |
82 m_Encoding.m_Unicodes[i] = i; | |
83 } | |
84 } | |
85 } | |
86 } | |
87 return true; | 77 return true; |
88 } | 78 } |
89 | 79 |
90 void CPDF_Type3Font::CheckType3FontMetrics() { | 80 void CPDF_Type3Font::CheckType3FontMetrics() { |
91 CheckFontMetrics(); | 81 CheckFontMetrics(); |
92 } | 82 } |
93 | 83 |
94 CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { | 84 CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { |
95 if (m_CharLoadingDepth >= FPDF_MAX_TYPE3_FORM_LEVEL) | 85 if (m_CharLoadingDepth >= FPDF_MAX_TYPE3_FORM_LEVEL) |
96 return nullptr; | 86 return nullptr; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return m_CharWidthL[charcode]; | 143 return m_CharWidthL[charcode]; |
154 | 144 |
155 const CPDF_Type3Char* pChar = LoadChar(charcode); | 145 const CPDF_Type3Char* pChar = LoadChar(charcode); |
156 return pChar ? pChar->m_Width : 0; | 146 return pChar ? pChar->m_Width : 0; |
157 } | 147 } |
158 | 148 |
159 FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode) { | 149 FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode) { |
160 const CPDF_Type3Char* pChar = LoadChar(charcode); | 150 const CPDF_Type3Char* pChar = LoadChar(charcode); |
161 return pChar ? pChar->m_BBox : FX_RECT(); | 151 return pChar ? pChar->m_BBox : FX_RECT(); |
162 } | 152 } |
OLD | NEW |