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/src/fpdfapi/fpdf_font/font_int.h" | 7 #include "core/src/fpdfapi/fpdf_font/font_int.h" |
8 | 8 |
9 #include "core/include/fpdfapi/fpdf_module.h" | 9 #include "core/include/fpdfapi/fpdf_module.h" |
10 #include "core/include/fpdfapi/fpdf_page.h" | 10 #include "core/include/fpdfapi/fpdf_page.h" |
11 #include "core/include/fpdfapi/fpdf_pageobj.h" | 11 #include "core/include/fpdfapi/fpdf_pageobj.h" |
12 #include "core/include/fpdfapi/fpdf_resource.h" | 12 #include "core/include/fpdfapi/fpdf_resource.h" |
13 #include "core/include/fxcrt/fx_ext.h" | 13 #include "core/include/fxcrt/fx_ext.h" |
14 #include "core/include/fxge/fx_freetype.h" | 14 #include "core/include/fxge/fx_freetype.h" |
15 #include "core/src/fpdfapi/fpdf_page/pageint.h" | 15 #include "core/src/fpdfapi/fpdf_page/pageint.h" |
16 #include "third_party/base/stl_util.h" | 16 #include "third_party/base/stl_util.h" |
17 | 17 |
18 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 18 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
19 #include "core/src/fxge/apple/apple_int.h" | 19 #include "core/src/fxge/apple/apple_int.h" |
20 #endif | 20 #endif |
21 | 21 |
| 22 namespace { |
| 23 |
| 24 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 25 struct GlyphNameMap { |
| 26 const FX_CHAR* m_pStrAdobe; |
| 27 const FX_CHAR* m_pStrUnicode; |
| 28 }; |
| 29 |
| 30 const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"}, |
| 31 {"fi", "uniFB01"}, |
| 32 {"fl", "uniFB02"}, |
| 33 {"ffi", "uniFB03"}, |
| 34 {"ffl", "uniFB04"}}; |
| 35 |
| 36 int compareString(const void* key, const void* element) { |
| 37 return FXSYS_stricmp((const FX_CHAR*)key, |
| 38 ((GlyphNameMap*)element)->m_pStrAdobe); |
| 39 } |
| 40 |
| 41 const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) { |
| 42 GlyphNameMap* found = (GlyphNameMap*)FXSYS_bsearch( |
| 43 pStrAdobe, g_GlyphNameSubsts, |
| 44 sizeof(g_GlyphNameSubsts) / sizeof(GlyphNameMap), sizeof(GlyphNameMap), |
| 45 compareString); |
| 46 if (found) |
| 47 return found->m_pStrUnicode; |
| 48 return NULL; |
| 49 } |
| 50 #endif |
| 51 |
| 52 const uint8_t ChineseFontNames[][5] = {{0xCB, 0xCE, 0xCC, 0xE5, 0x00}, |
| 53 {0xBF, 0xAC, 0xCC, 0xE5, 0x00}, |
| 54 {0xBA, 0xDA, 0xCC, 0xE5, 0x00}, |
| 55 {0xB7, 0xC2, 0xCB, 0xCE, 0x00}, |
| 56 {0xD0, 0xC2, 0xCB, 0xCE, 0x00}}; |
| 57 |
| 58 FX_BOOL GetPredefinedEncoding(int& basemap, const CFX_ByteString& value) { |
| 59 if (value == "WinAnsiEncoding") { |
| 60 basemap = PDFFONT_ENCODING_WINANSI; |
| 61 } else if (value == "MacRomanEncoding") { |
| 62 basemap = PDFFONT_ENCODING_MACROMAN; |
| 63 } else if (value == "MacExpertEncoding") { |
| 64 basemap = PDFFONT_ENCODING_MACEXPERT; |
| 65 } else if (value == "PDFDocEncoding") { |
| 66 basemap = PDFFONT_ENCODING_PDFDOC; |
| 67 } else { |
| 68 return FALSE; |
| 69 } |
| 70 return TRUE; |
| 71 } |
| 72 |
| 73 FX_BOOL FT_UseType1Charmap(FXFT_Face face) { |
| 74 if (FXFT_Get_Face_CharmapCount(face) == 0) { |
| 75 return FALSE; |
| 76 } |
| 77 if (FXFT_Get_Face_CharmapCount(face) == 1 && |
| 78 FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == |
| 79 FXFT_ENCODING_UNICODE) { |
| 80 return FALSE; |
| 81 } |
| 82 if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == |
| 83 FXFT_ENCODING_UNICODE) { |
| 84 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[1]); |
| 85 } else { |
| 86 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]); |
| 87 } |
| 88 return TRUE; |
| 89 } |
| 90 |
| 91 } // namespace |
| 92 |
22 FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) { | 93 FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) { |
23 for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) { | 94 for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) { |
24 if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == | 95 if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == |
25 platform_id && | 96 platform_id && |
26 FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) == | 97 FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) == |
27 encoding_id) { | 98 encoding_id) { |
28 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]); | 99 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]); |
29 return TRUE; | 100 return TRUE; |
30 } | 101 } |
31 } | 102 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void CPDF_FontGlobals::Set(CPDF_Document* pDoc, int index, CPDF_Font* pFont) { | 145 void CPDF_FontGlobals::Set(CPDF_Document* pDoc, int index, CPDF_Font* pFont) { |
75 if (!pdfium::ContainsKey(m_StockMap, pDoc)) | 146 if (!pdfium::ContainsKey(m_StockMap, pDoc)) |
76 m_StockMap[pDoc].reset(new CFX_StockFontArray); | 147 m_StockMap[pDoc].reset(new CFX_StockFontArray); |
77 m_StockMap[pDoc]->SetFont(index, pFont); | 148 m_StockMap[pDoc]->SetFont(index, pFont); |
78 } | 149 } |
79 | 150 |
80 void CPDF_FontGlobals::Clear(CPDF_Document* pDoc) { | 151 void CPDF_FontGlobals::Clear(CPDF_Document* pDoc) { |
81 m_StockMap.erase(pDoc); | 152 m_StockMap.erase(pDoc); |
82 } | 153 } |
83 | 154 |
84 CPDF_Font::CPDF_Font(int fonttype) : m_FontType(fonttype) { | 155 CPDF_Font::CPDF_Font() |
85 m_FontBBox.left = m_FontBBox.right = m_FontBBox.top = m_FontBBox.bottom = 0; | 156 : m_pFontFile(nullptr), |
86 m_StemV = m_Ascent = m_Descent = m_ItalicAngle = 0; | 157 m_pFontDict(nullptr), |
87 m_pFontFile = NULL; | 158 m_pToUnicodeMap(nullptr), |
88 m_Flags = 0; | 159 m_bToUnicodeLoaded(FALSE), |
89 m_pToUnicodeMap = NULL; | 160 m_Flags(0), |
90 m_bToUnicodeLoaded = FALSE; | 161 m_StemV(0), |
91 } | 162 m_Ascent(0), |
| 163 m_Descent(0), |
| 164 m_ItalicAngle(0) {} |
| 165 |
92 CPDF_Font::~CPDF_Font() { | 166 CPDF_Font::~CPDF_Font() { |
93 delete m_pToUnicodeMap; | 167 delete m_pToUnicodeMap; |
94 m_pToUnicodeMap = NULL; | 168 m_pToUnicodeMap = NULL; |
95 | 169 |
96 if (m_pFontFile) { | 170 if (m_pFontFile) { |
97 m_pDocument->GetPageData()->ReleaseFontFileStreamAcc( | 171 m_pDocument->GetPageData()->ReleaseFontFileStreamAcc( |
98 const_cast<CPDF_Stream*>(m_pFontFile->GetStream()->AsStream())); | 172 const_cast<CPDF_Stream*>(m_pFontFile->GetStream()->AsStream())); |
99 } | 173 } |
100 } | 174 } |
| 175 |
101 FX_BOOL CPDF_Font::IsVertWriting() const { | 176 FX_BOOL CPDF_Font::IsVertWriting() const { |
102 FX_BOOL bVertWriting = FALSE; | 177 FX_BOOL bVertWriting = FALSE; |
103 CPDF_CIDFont* pCIDFont = GetCIDFont(); | 178 const CPDF_CIDFont* pCIDFont = AsCIDFont(); |
104 if (pCIDFont) { | 179 if (pCIDFont) { |
105 bVertWriting = pCIDFont->IsVertWriting(); | 180 bVertWriting = pCIDFont->IsVertWriting(); |
106 } else { | 181 } else { |
107 bVertWriting = m_Font.IsVertical(); | 182 bVertWriting = m_Font.IsVertical(); |
108 } | 183 } |
109 return bVertWriting; | 184 return bVertWriting; |
110 } | 185 } |
111 CFX_ByteString CPDF_Font::GetFontTypeName() const { | 186 |
112 switch (m_FontType) { | 187 int CPDF_Font::AppendChar(FX_CHAR* buf, FX_DWORD charcode) const { |
113 case PDFFONT_TYPE1: | 188 *buf = (FX_CHAR)charcode; |
114 return "Type1"; | 189 return 1; |
115 case PDFFONT_TRUETYPE: | |
116 return "TrueType"; | |
117 case PDFFONT_TYPE3: | |
118 return "Type3"; | |
119 case PDFFONT_CIDFONT: | |
120 return "Type0"; | |
121 } | |
122 return CFX_ByteString(); | |
123 } | 190 } |
| 191 |
124 void CPDF_Font::AppendChar(CFX_ByteString& str, FX_DWORD charcode) const { | 192 void CPDF_Font::AppendChar(CFX_ByteString& str, FX_DWORD charcode) const { |
125 char buf[4]; | 193 char buf[4]; |
126 int len = AppendChar(buf, charcode); | 194 int len = AppendChar(buf, charcode); |
127 if (len == 1) { | 195 if (len == 1) { |
128 str += buf[0]; | 196 str += buf[0]; |
129 } else { | 197 } else { |
130 str += CFX_ByteString(buf, len); | 198 str += CFX_ByteString(buf, len); |
131 } | 199 } |
132 } | 200 } |
| 201 |
133 CFX_WideString CPDF_Font::UnicodeFromCharCode(FX_DWORD charcode) const { | 202 CFX_WideString CPDF_Font::UnicodeFromCharCode(FX_DWORD charcode) const { |
134 if (!m_bToUnicodeLoaded) { | 203 if (!m_bToUnicodeLoaded) |
135 ((CPDF_Font*)this)->LoadUnicodeMap(); | 204 ((CPDF_Font*)this)->LoadUnicodeMap(); |
136 } | 205 |
137 if (m_pToUnicodeMap) { | 206 if (m_pToUnicodeMap) |
138 CFX_WideString wsRet = m_pToUnicodeMap->Lookup(charcode); | 207 return m_pToUnicodeMap->Lookup(charcode); |
139 if (!wsRet.IsEmpty()) { | 208 return CFX_WideString(); |
140 return wsRet; | |
141 } | |
142 } | |
143 FX_WCHAR unicode = _UnicodeFromCharCode(charcode); | |
144 if (unicode == 0) { | |
145 return CFX_WideString(); | |
146 } | |
147 return unicode; | |
148 } | 209 } |
| 210 |
149 FX_DWORD CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const { | 211 FX_DWORD CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const { |
150 if (!m_bToUnicodeLoaded) { | 212 if (!m_bToUnicodeLoaded) |
151 ((CPDF_Font*)this)->LoadUnicodeMap(); | 213 ((CPDF_Font*)this)->LoadUnicodeMap(); |
152 } | 214 |
153 if (m_pToUnicodeMap) { | 215 if (m_pToUnicodeMap) |
154 FX_DWORD charcode = m_pToUnicodeMap->ReverseLookup(unicode); | 216 return m_pToUnicodeMap->ReverseLookup(unicode); |
155 if (charcode) { | 217 return 0; |
156 return charcode; | |
157 } | |
158 } | |
159 return _CharCodeFromUnicode(unicode); | |
160 } | 218 } |
161 | 219 |
162 void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { | 220 void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { |
163 m_Flags = pFontDesc->GetIntegerBy("Flags", PDFFONT_NONSYMBOLIC); | 221 m_Flags = pFontDesc->GetIntegerBy("Flags", PDFFONT_NONSYMBOLIC); |
164 int ItalicAngle = 0; | 222 int ItalicAngle = 0; |
165 FX_BOOL bExistItalicAngle = FALSE; | 223 FX_BOOL bExistItalicAngle = FALSE; |
166 if (pFontDesc->KeyExist("ItalicAngle")) { | 224 if (pFontDesc->KeyExist("ItalicAngle")) { |
167 ItalicAngle = pFontDesc->GetIntegerBy("ItalicAngle"); | 225 ItalicAngle = pFontDesc->GetIntegerBy("ItalicAngle"); |
168 bExistItalicAngle = TRUE; | 226 bExistItalicAngle = TRUE; |
169 } | 227 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 284 } |
227 } | 285 } |
228 | 286 |
229 short TT2PDF(int m, FXFT_Face face) { | 287 short TT2PDF(int m, FXFT_Face face) { |
230 int upm = FXFT_Get_Face_UnitsPerEM(face); | 288 int upm = FXFT_Get_Face_UnitsPerEM(face); |
231 if (upm == 0) { | 289 if (upm == 0) { |
232 return (short)m; | 290 return (short)m; |
233 } | 291 } |
234 return (m * 1000 + upm / 2) / upm; | 292 return (m * 1000 + upm / 2) / upm; |
235 } | 293 } |
| 294 |
236 void CPDF_Font::CheckFontMetrics() { | 295 void CPDF_Font::CheckFontMetrics() { |
237 if (m_FontBBox.top == 0 && m_FontBBox.bottom == 0 && m_FontBBox.left == 0 && | 296 if (m_FontBBox.top == 0 && m_FontBBox.bottom == 0 && m_FontBBox.left == 0 && |
238 m_FontBBox.right == 0) { | 297 m_FontBBox.right == 0) { |
239 FXFT_Face face = m_Font.GetFace(); | 298 FXFT_Face face = m_Font.GetFace(); |
240 if (face) { | 299 if (face) { |
241 m_FontBBox.left = TT2PDF(FXFT_Get_Face_xMin(face), face); | 300 m_FontBBox.left = TT2PDF(FXFT_Get_Face_xMin(face), face); |
242 m_FontBBox.bottom = TT2PDF(FXFT_Get_Face_yMin(face), face); | 301 m_FontBBox.bottom = TT2PDF(FXFT_Get_Face_yMin(face), face); |
243 m_FontBBox.right = TT2PDF(FXFT_Get_Face_xMax(face), face); | 302 m_FontBBox.right = TT2PDF(FXFT_Get_Face_xMax(face), face); |
244 m_FontBBox.top = TT2PDF(FXFT_Get_Face_yMax(face), face); | 303 m_FontBBox.top = TT2PDF(FXFT_Get_Face_yMax(face), face); |
245 m_Ascent = TT2PDF(FXFT_Get_Face_Ascender(face), face); | 304 m_Ascent = TT2PDF(FXFT_Get_Face_Ascender(face), face); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 m_Ascent = rect.top; | 340 m_Ascent = rect.top; |
282 } | 341 } |
283 GetCharBBox('g', rect); | 342 GetCharBBox('g', rect); |
284 if (rect.bottom == rect.top) { | 343 if (rect.bottom == rect.top) { |
285 m_Descent = m_FontBBox.bottom; | 344 m_Descent = m_FontBBox.bottom; |
286 } else { | 345 } else { |
287 m_Descent = rect.bottom; | 346 m_Descent = rect.bottom; |
288 } | 347 } |
289 } | 348 } |
290 } | 349 } |
| 350 |
291 void CPDF_Font::LoadUnicodeMap() { | 351 void CPDF_Font::LoadUnicodeMap() { |
292 m_bToUnicodeLoaded = TRUE; | 352 m_bToUnicodeLoaded = TRUE; |
293 CPDF_Stream* pStream = m_pFontDict->GetStreamBy("ToUnicode"); | 353 CPDF_Stream* pStream = m_pFontDict->GetStreamBy("ToUnicode"); |
294 if (!pStream) { | 354 if (!pStream) { |
295 return; | 355 return; |
296 } | 356 } |
297 m_pToUnicodeMap = new CPDF_ToUnicodeMap; | 357 m_pToUnicodeMap = new CPDF_ToUnicodeMap; |
298 m_pToUnicodeMap->Load(pStream); | 358 m_pToUnicodeMap->Load(pStream); |
299 } | 359 } |
| 360 |
300 int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) { | 361 int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) { |
301 int offset = 0; | 362 int offset = 0; |
302 int width = 0; | 363 int width = 0; |
303 while (offset < size) { | 364 while (offset < size) { |
304 FX_DWORD charcode = GetNextChar(pString, size, offset); | 365 FX_DWORD charcode = GetNextChar(pString, size, offset); |
305 width += GetCharWidthF(charcode); | 366 width += GetCharWidthF(charcode); |
306 } | 367 } |
307 return width; | 368 return width; |
308 } | 369 } |
309 int CPDF_Font::GetCharTypeWidth(FX_DWORD charcode) { | |
310 if (!m_Font.GetFace()) | |
311 return 0; | |
312 | |
313 int glyph_index = GlyphFromCharCode(charcode); | |
314 if (glyph_index == 0xffff) { | |
315 return 0; | |
316 } | |
317 return m_Font.GetGlyphWidth(glyph_index); | |
318 } | |
319 | 370 |
320 CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, | 371 CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, |
321 const CFX_ByteStringC& name) { | 372 const CFX_ByteStringC& name) { |
322 CFX_ByteString fontname(name); | 373 CFX_ByteString fontname(name); |
323 int font_id = PDF_GetStandardFontName(&fontname); | 374 int font_id = PDF_GetStandardFontName(&fontname); |
324 if (font_id < 0) { | 375 if (font_id < 0) { |
325 return nullptr; | 376 return nullptr; |
326 } | 377 } |
327 CPDF_FontGlobals* pFontGlobals = | 378 CPDF_FontGlobals* pFontGlobals = |
328 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); | 379 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); |
329 CPDF_Font* pFont = pFontGlobals->Find(pDoc, font_id); | 380 CPDF_Font* pFont = pFontGlobals->Find(pDoc, font_id); |
330 if (pFont) { | 381 if (pFont) { |
331 return pFont; | 382 return pFont; |
332 } | 383 } |
333 CPDF_Dictionary* pDict = new CPDF_Dictionary; | 384 CPDF_Dictionary* pDict = new CPDF_Dictionary; |
334 pDict->SetAtName("Type", "Font"); | 385 pDict->SetAtName("Type", "Font"); |
335 pDict->SetAtName("Subtype", "Type1"); | 386 pDict->SetAtName("Subtype", "Type1"); |
336 pDict->SetAtName("BaseFont", fontname); | 387 pDict->SetAtName("BaseFont", fontname); |
337 pDict->SetAtName("Encoding", "WinAnsiEncoding"); | 388 pDict->SetAtName("Encoding", "WinAnsiEncoding"); |
338 pFont = CPDF_Font::CreateFontF(NULL, pDict); | 389 pFont = CPDF_Font::CreateFontF(NULL, pDict); |
339 pFontGlobals->Set(pDoc, font_id, pFont); | 390 pFontGlobals->Set(pDoc, font_id, pFont); |
340 return pFont; | 391 return pFont; |
341 } | 392 } |
342 const uint8_t ChineseFontNames[][5] = {{0xCB, 0xCE, 0xCC, 0xE5, 0x00}, | 393 |
343 {0xBF, 0xAC, 0xCC, 0xE5, 0x00}, | |
344 {0xBA, 0xDA, 0xCC, 0xE5, 0x00}, | |
345 {0xB7, 0xC2, 0xCB, 0xCE, 0x00}, | |
346 {0xD0, 0xC2, 0xCB, 0xCE, 0x00}}; | |
347 CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, | 394 CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, |
348 CPDF_Dictionary* pFontDict) { | 395 CPDF_Dictionary* pFontDict) { |
349 CFX_ByteString type = pFontDict->GetStringBy("Subtype"); | 396 CFX_ByteString type = pFontDict->GetStringBy("Subtype"); |
350 CPDF_Font* pFont; | 397 CPDF_Font* pFont; |
351 if (type == "TrueType") { | 398 if (type == "TrueType") { |
352 { | 399 { |
353 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || \ | 400 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || \ |
354 _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \ | 401 _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \ |
355 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || \ | 402 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || \ |
356 _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 403 _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
357 CFX_ByteString basefont = pFontDict->GetStringBy("BaseFont"); | 404 CFX_ByteString basefont = pFontDict->GetStringBy("BaseFont"); |
358 CFX_ByteString tag = basefont.Left(4); | 405 CFX_ByteString tag = basefont.Left(4); |
359 int i; | 406 int i; |
360 int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]); | 407 int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]); |
361 for (i = 0; i < count; ++i) { | 408 for (i = 0; i < count; ++i) { |
362 if (tag == CFX_ByteString((const FX_CHAR*)ChineseFontNames[i])) { | 409 if (tag == CFX_ByteString((const FX_CHAR*)ChineseFontNames[i])) { |
363 break; | 410 break; |
364 } | 411 } |
365 } | 412 } |
366 if (i < count) { | 413 if (i < count) { |
367 CPDF_Dictionary* pFontDesc = pFontDict->GetDictBy("FontDescriptor"); | 414 CPDF_Dictionary* pFontDesc = pFontDict->GetDictBy("FontDescriptor"); |
368 if (!pFontDesc || !pFontDesc->KeyExist("FontFile2")) { | 415 if (!pFontDesc || !pFontDesc->KeyExist("FontFile2")) { |
369 pFont = new CPDF_CIDFont; | 416 pFont = new CPDF_CIDFont; |
370 pFont->m_pFontDict = pFontDict; | 417 pFont->m_pFontDict = pFontDict; |
371 pFont->m_pDocument = pDoc; | 418 pFont->m_pDocument = pDoc; |
| 419 pFont->m_BaseFont = pFontDict->GetStringBy("BaseFont"); |
372 if (!pFont->Load()) { | 420 if (!pFont->Load()) { |
373 delete pFont; | 421 delete pFont; |
374 return NULL; | 422 return NULL; |
375 } | 423 } |
376 return pFont; | 424 return pFont; |
377 } | 425 } |
378 } | 426 } |
379 #endif | 427 #endif |
380 } | 428 } |
381 pFont = new CPDF_TrueTypeFont; | 429 pFont = new CPDF_TrueTypeFont; |
382 } else if (type == "Type3") { | 430 } else if (type == "Type3") { |
383 pFont = new CPDF_Type3Font; | 431 pFont = new CPDF_Type3Font; |
384 } else if (type == "Type0") { | 432 } else if (type == "Type0") { |
385 pFont = new CPDF_CIDFont; | 433 pFont = new CPDF_CIDFont; |
386 } else { | 434 } else { |
387 pFont = new CPDF_Type1Font; | 435 pFont = new CPDF_Type1Font; |
388 } | 436 } |
389 pFont->m_pFontDict = pFontDict; | 437 pFont->m_pFontDict = pFontDict; |
390 pFont->m_pDocument = pDoc; | 438 pFont->m_pDocument = pDoc; |
| 439 pFont->m_BaseFont = pFontDict->GetStringBy("BaseFont"); |
391 if (!pFont->Load()) { | 440 if (!pFont->Load()) { |
392 delete pFont; | 441 delete pFont; |
393 return NULL; | 442 return NULL; |
394 } | 443 } |
395 return pFont; | 444 return pFont; |
396 } | 445 } |
397 FX_BOOL CPDF_Font::Load() { | |
398 if (!m_pFontDict) { | |
399 return FALSE; | |
400 } | |
401 CFX_ByteString type = m_pFontDict->GetStringBy("Subtype"); | |
402 m_BaseFont = m_pFontDict->GetStringBy("BaseFont"); | |
403 if (type == "MMType1") { | |
404 type = "Type1"; | |
405 } | |
406 return _Load(); | |
407 } | |
408 | 446 |
409 CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) { | 447 CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) { |
410 auto it = m_Map.find(charcode); | 448 auto it = m_Map.find(charcode); |
411 if (it != m_Map.end()) { | 449 if (it != m_Map.end()) { |
412 FX_DWORD value = it->second; | 450 FX_DWORD value = it->second; |
413 FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff); | 451 FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff); |
414 if (unicode != 0xffff) { | 452 if (unicode != 0xffff) { |
415 return unicode; | 453 return unicode; |
416 } | 454 } |
417 const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer(); | 455 const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer(); |
418 FX_DWORD buf_len = m_MultiCharBuf.GetLength(); | 456 FX_DWORD buf_len = m_MultiCharBuf.GetLength(); |
419 if (!buf || buf_len == 0) { | 457 if (!buf || buf_len == 0) { |
420 return CFX_WideString(); | 458 return CFX_WideString(); |
421 } | 459 } |
422 FX_DWORD index = value >> 16; | 460 FX_DWORD index = value >> 16; |
423 if (index >= buf_len) { | 461 if (index >= buf_len) { |
424 return CFX_WideString(); | 462 return CFX_WideString(); |
425 } | 463 } |
426 FX_DWORD len = buf[index]; | 464 FX_DWORD len = buf[index]; |
427 if (index + len < index || index + len >= buf_len) { | 465 if (index + len < index || index + len >= buf_len) { |
428 return CFX_WideString(); | 466 return CFX_WideString(); |
429 } | 467 } |
430 return CFX_WideString(buf + index + 1, len); | 468 return CFX_WideString(buf + index + 1, len); |
431 } | 469 } |
432 if (m_pBaseMap) { | 470 if (m_pBaseMap) { |
433 return m_pBaseMap->UnicodeFromCID((FX_WORD)charcode); | 471 return m_pBaseMap->UnicodeFromCID((FX_WORD)charcode); |
434 } | 472 } |
435 return CFX_WideString(); | 473 return CFX_WideString(); |
436 } | 474 } |
| 475 |
437 FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { | 476 FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { |
438 for (const auto& pair : m_Map) { | 477 for (const auto& pair : m_Map) { |
439 if (pair.second == unicode) | 478 if (pair.second == unicode) |
440 return pair.first; | 479 return pair.first; |
441 } | 480 } |
442 return 0; | 481 return 0; |
443 } | 482 } |
444 | 483 |
445 // Static. | 484 // Static. |
446 FX_DWORD CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { | 485 FX_DWORD CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { |
447 const FX_CHAR* buf = str.GetCStr(); | 486 const FX_CHAR* buf = str.GetCStr(); |
448 int len = str.GetLength(); | 487 int len = str.GetLength(); |
449 if (len == 0) | 488 if (len == 0) |
450 return 0; | 489 return 0; |
451 | 490 |
452 int result = 0; | 491 int result = 0; |
453 if (buf[0] == '<') { | 492 if (buf[0] == '<') { |
454 for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) | 493 for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) |
455 result = result * 16 + FXSYS_toHexDigit(buf[i]); | 494 result = result * 16 + FXSYS_toHexDigit(buf[i]); |
456 return result; | 495 return result; |
457 } | 496 } |
458 | 497 |
459 for (int i = 0; i < len && std::isdigit(buf[i]); ++i) | 498 for (int i = 0; i < len && std::isdigit(buf[i]); ++i) |
460 result = result * 10 + FXSYS_toDecimalDigit(buf[i]); | 499 result = result * 10 + FXSYS_toDecimalDigit(buf[i]); |
461 | 500 |
462 return result; | 501 return result; |
463 } | 502 } |
| 503 |
464 static CFX_WideString StringDataAdd(CFX_WideString str) { | 504 static CFX_WideString StringDataAdd(CFX_WideString str) { |
465 CFX_WideString ret; | 505 CFX_WideString ret; |
466 int len = str.GetLength(); | 506 int len = str.GetLength(); |
467 FX_WCHAR value = 1; | 507 FX_WCHAR value = 1; |
468 for (int i = len - 1; i >= 0; --i) { | 508 for (int i = len - 1; i >= 0; --i) { |
469 FX_WCHAR ch = str[i] + value; | 509 FX_WCHAR ch = str[i] + value; |
470 if (ch < str[i]) { | 510 if (ch < str[i]) { |
471 ret.Insert(0, 0); | 511 ret.Insert(0, 0); |
472 } else { | 512 } else { |
473 ret.Insert(0, ch); | 513 ret.Insert(0, ch); |
(...skipping 24 matching lines...) Expand all Loading... |
498 if (byte_pos == 4) { | 538 if (byte_pos == 4) { |
499 result += ch; | 539 result += ch; |
500 byte_pos = 0; | 540 byte_pos = 0; |
501 ch = 0; | 541 ch = 0; |
502 } | 542 } |
503 } | 543 } |
504 return result; | 544 return result; |
505 } | 545 } |
506 return result; | 546 return result; |
507 } | 547 } |
| 548 |
508 void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { | 549 void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { |
509 CIDSet cid_set = CIDSET_UNKNOWN; | 550 CIDSet cid_set = CIDSET_UNKNOWN; |
510 CPDF_StreamAcc stream; | 551 CPDF_StreamAcc stream; |
511 stream.LoadAllData(pStream, FALSE); | 552 stream.LoadAllData(pStream, FALSE); |
512 CPDF_SimpleParser parser(stream.GetData(), stream.GetSize()); | 553 CPDF_SimpleParser parser(stream.GetData(), stream.GetSize()); |
513 while (1) { | 554 while (1) { |
514 CFX_ByteStringC word = parser.GetWord(); | 555 CFX_ByteStringC word = parser.GetWord(); |
515 if (word.IsEmpty()) { | 556 if (word.IsEmpty()) { |
516 break; | 557 break; |
517 } | 558 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 646 } |
606 if (cid_set) { | 647 if (cid_set) { |
607 m_pBaseMap = CPDF_ModuleMgr::Get() | 648 m_pBaseMap = CPDF_ModuleMgr::Get() |
608 ->GetPageModule() | 649 ->GetPageModule() |
609 ->GetFontGlobals() | 650 ->GetFontGlobals() |
610 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); | 651 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); |
611 } else { | 652 } else { |
612 m_pBaseMap = NULL; | 653 m_pBaseMap = NULL; |
613 } | 654 } |
614 } | 655 } |
615 static FX_BOOL GetPredefinedEncoding(int& basemap, | 656 |
616 const CFX_ByteString& value) { | 657 FX_DWORD CPDF_Font::GetNextChar(const FX_CHAR* pString, |
617 if (value == "WinAnsiEncoding") { | 658 int nStrLen, |
618 basemap = PDFFONT_ENCODING_WINANSI; | 659 int& offset) const { |
619 } else if (value == "MacRomanEncoding") { | 660 if (offset < 0 || nStrLen < 1) { |
620 basemap = PDFFONT_ENCODING_MACROMAN; | 661 return 0; |
621 } else if (value == "MacExpertEncoding") { | |
622 basemap = PDFFONT_ENCODING_MACEXPERT; | |
623 } else if (value == "PDFDocEncoding") { | |
624 basemap = PDFFONT_ENCODING_PDFDOC; | |
625 } else { | |
626 return FALSE; | |
627 } | 662 } |
628 return TRUE; | 663 uint8_t ch = offset < nStrLen ? pString[offset++] : pString[nStrLen - 1]; |
| 664 return static_cast<FX_DWORD>(ch); |
629 } | 665 } |
| 666 |
630 void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, | 667 void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, |
631 int& iBaseEncoding, | 668 int& iBaseEncoding, |
632 CFX_ByteString*& pCharNames, | 669 CFX_ByteString*& pCharNames, |
633 FX_BOOL bEmbedded, | 670 FX_BOOL bEmbedded, |
634 FX_BOOL bTrueType) { | 671 FX_BOOL bTrueType) { |
635 if (!pEncoding) { | 672 if (!pEncoding) { |
636 if (m_BaseFont == "Symbol") { | 673 if (m_BaseFont == "Symbol") { |
637 iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL | 674 iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL |
638 : PDFFONT_ENCODING_ADOBE_SYMBOL; | 675 : PDFFONT_ENCODING_ADOBE_SYMBOL; |
639 } else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { | 676 } else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 if (cur_code < 256) | 727 if (cur_code < 256) |
691 pCharNames[cur_code] = pName->GetString(); | 728 pCharNames[cur_code] = pName->GetString(); |
692 cur_code++; | 729 cur_code++; |
693 } else { | 730 } else { |
694 cur_code = pElement->GetInteger(); | 731 cur_code = pElement->GetInteger(); |
695 } | 732 } |
696 } | 733 } |
697 } | 734 } |
698 | 735 |
699 FX_BOOL CPDF_Font::IsStandardFont() const { | 736 FX_BOOL CPDF_Font::IsStandardFont() const { |
700 if (m_FontType != PDFFONT_TYPE1) | 737 if (!IsType1Font()) |
701 return FALSE; | 738 return FALSE; |
702 if (m_pFontFile) | 739 if (m_pFontFile) |
703 return FALSE; | 740 return FALSE; |
704 if (((CPDF_Type1Font*)this)->GetBase14Font() < 0) | 741 if (AsType1Font()->GetBase14Font() < 0) |
705 return FALSE; | 742 return FALSE; |
706 return TRUE; | 743 return TRUE; |
707 } | 744 } |
708 CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) { | 745 |
| 746 CPDF_SimpleFont::CPDF_SimpleFont() { |
709 FXSYS_memset(m_CharBBox, 0xff, sizeof m_CharBBox); | 747 FXSYS_memset(m_CharBBox, 0xff, sizeof m_CharBBox); |
710 FXSYS_memset(m_CharWidth, 0xff, sizeof m_CharWidth); | 748 FXSYS_memset(m_CharWidth, 0xff, sizeof m_CharWidth); |
711 FXSYS_memset(m_GlyphIndex, 0xff, sizeof m_GlyphIndex); | 749 FXSYS_memset(m_GlyphIndex, 0xff, sizeof m_GlyphIndex); |
712 FXSYS_memset(m_ExtGID, 0xff, sizeof m_ExtGID); | 750 FXSYS_memset(m_ExtGID, 0xff, sizeof m_ExtGID); |
713 m_pCharNames = NULL; | 751 m_pCharNames = NULL; |
714 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN; | 752 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN; |
715 } | 753 } |
| 754 |
716 CPDF_SimpleFont::~CPDF_SimpleFont() { | 755 CPDF_SimpleFont::~CPDF_SimpleFont() { |
717 delete[] m_pCharNames; | 756 delete[] m_pCharNames; |
718 } | 757 } |
| 758 |
719 int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { | 759 int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { |
720 if (pVertGlyph) { | 760 if (pVertGlyph) { |
721 *pVertGlyph = FALSE; | 761 *pVertGlyph = FALSE; |
722 } | 762 } |
723 if (charcode > 0xff) { | 763 if (charcode > 0xff) { |
724 return -1; | 764 return -1; |
725 } | 765 } |
726 int index = m_GlyphIndex[(uint8_t)charcode]; | 766 int index = m_GlyphIndex[(uint8_t)charcode]; |
727 if (index == 0xffff) { | 767 if (index == 0xffff) { |
728 return -1; | 768 return -1; |
729 } | 769 } |
730 return index; | 770 return index; |
731 } | 771 } |
| 772 |
732 void CPDF_SimpleFont::LoadCharMetrics(int charcode) { | 773 void CPDF_SimpleFont::LoadCharMetrics(int charcode) { |
733 if (!m_Font.GetFace()) | 774 if (!m_Font.GetFace()) |
734 return; | 775 return; |
735 | 776 |
736 if (charcode < 0 || charcode > 0xff) { | 777 if (charcode < 0 || charcode > 0xff) { |
737 return; | 778 return; |
738 } | 779 } |
739 int glyph_index = m_GlyphIndex[charcode]; | 780 int glyph_index = m_GlyphIndex[charcode]; |
740 if (glyph_index == 0xffff) { | 781 if (glyph_index == 0xffff) { |
741 if (!m_pFontFile && charcode != 32) { | 782 if (!m_pFontFile && charcode != 32) { |
(...skipping 23 matching lines...) Expand all Loading... |
765 if (m_CharWidth[charcode] == 0xffff) { | 806 if (m_CharWidth[charcode] == 0xffff) { |
766 m_CharWidth[charcode] = TT_Width; | 807 m_CharWidth[charcode] = TT_Width; |
767 } else if (TT_Width && !IsEmbedded()) { | 808 } else if (TT_Width && !IsEmbedded()) { |
768 m_CharBBox[charcode].Right = | 809 m_CharBBox[charcode].Right = |
769 m_CharBBox[charcode].Right * m_CharWidth[charcode] / TT_Width; | 810 m_CharBBox[charcode].Right * m_CharWidth[charcode] / TT_Width; |
770 m_CharBBox[charcode].Left = | 811 m_CharBBox[charcode].Left = |
771 m_CharBBox[charcode].Left * m_CharWidth[charcode] / TT_Width; | 812 m_CharBBox[charcode].Left * m_CharWidth[charcode] / TT_Width; |
772 } | 813 } |
773 } | 814 } |
774 } | 815 } |
| 816 |
775 int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) { | 817 int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) { |
776 if (charcode > 0xff) { | 818 if (charcode > 0xff) { |
777 charcode = 0; | 819 charcode = 0; |
778 } | 820 } |
779 if (m_CharWidth[charcode] == 0xffff) { | 821 if (m_CharWidth[charcode] == 0xffff) { |
780 LoadCharMetrics(charcode); | 822 LoadCharMetrics(charcode); |
781 if (m_CharWidth[charcode] == 0xffff) { | 823 if (m_CharWidth[charcode] == 0xffff) { |
782 m_CharWidth[charcode] = 0; | 824 m_CharWidth[charcode] = 0; |
783 } | 825 } |
784 } | 826 } |
785 return (int16_t)m_CharWidth[charcode]; | 827 return (int16_t)m_CharWidth[charcode]; |
786 } | 828 } |
| 829 |
787 void CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) { | 830 void CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) { |
788 if (charcode > 0xff) { | 831 if (charcode > 0xff) { |
789 charcode = 0; | 832 charcode = 0; |
790 } | 833 } |
791 if (m_CharBBox[charcode].Left == (int16_t)0xffff) { | 834 if (m_CharBBox[charcode].Left == (int16_t)0xffff) { |
792 LoadCharMetrics(charcode); | 835 LoadCharMetrics(charcode); |
793 } | 836 } |
794 rect.left = m_CharBBox[charcode].Left; | 837 rect.left = m_CharBBox[charcode].Left; |
795 rect.right = m_CharBBox[charcode].Right; | 838 rect.right = m_CharBBox[charcode].Right; |
796 rect.bottom = m_CharBBox[charcode].Bottom; | 839 rect.bottom = m_CharBBox[charcode].Bottom; |
797 rect.top = m_CharBBox[charcode].Top; | 840 rect.top = m_CharBBox[charcode].Top; |
798 } | 841 } |
| 842 |
799 const FX_CHAR* GetAdobeCharName(int iBaseEncoding, | 843 const FX_CHAR* GetAdobeCharName(int iBaseEncoding, |
800 const CFX_ByteString* pCharNames, | 844 const CFX_ByteString* pCharNames, |
801 int charcode) { | 845 int charcode) { |
802 ASSERT(charcode >= 0 && charcode < 256); | 846 ASSERT(charcode >= 0 && charcode < 256); |
803 if (charcode < 0 || charcode >= 256) { | 847 if (charcode < 0 || charcode >= 256) { |
804 return NULL; | 848 return NULL; |
805 } | 849 } |
806 const FX_CHAR* name = NULL; | 850 const FX_CHAR* name = NULL; |
807 if (pCharNames) { | 851 if (pCharNames) { |
808 name = pCharNames[charcode]; | 852 name = pCharNames[charcode]; |
809 } | 853 } |
810 if ((!name || name[0] == 0) && iBaseEncoding) { | 854 if ((!name || name[0] == 0) && iBaseEncoding) { |
811 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); | 855 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); |
812 } | 856 } |
813 return name && name[0] ? name : nullptr; | 857 return name && name[0] ? name : nullptr; |
814 } | 858 } |
| 859 |
815 FX_BOOL CPDF_SimpleFont::LoadCommon() { | 860 FX_BOOL CPDF_SimpleFont::LoadCommon() { |
816 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); | 861 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); |
817 if (pFontDesc) { | 862 if (pFontDesc) { |
818 LoadFontDescriptor(pFontDesc); | 863 LoadFontDescriptor(pFontDesc); |
819 } | 864 } |
820 CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); | 865 CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); |
821 int width_start = 0, width_end = -1; | 866 int width_start = 0, width_end = -1; |
822 m_bUseFontWidth = TRUE; | 867 m_bUseFontWidth = TRUE; |
823 if (pWidthArray) { | 868 if (pWidthArray) { |
824 m_bUseFontWidth = FALSE; | 869 m_bUseFontWidth = FALSE; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 if (m_CharWidth[i - 32]) { | 918 if (m_CharWidth[i - 32]) { |
874 m_CharWidth[i] = m_CharWidth[i - 32]; | 919 m_CharWidth[i] = m_CharWidth[i - 32]; |
875 m_CharBBox[i] = m_CharBBox[i - 32]; | 920 m_CharBBox[i] = m_CharBBox[i - 32]; |
876 } | 921 } |
877 } | 922 } |
878 } | 923 } |
879 } | 924 } |
880 CheckFontMetrics(); | 925 CheckFontMetrics(); |
881 return TRUE; | 926 return TRUE; |
882 } | 927 } |
| 928 |
883 void CPDF_SimpleFont::LoadSubstFont() { | 929 void CPDF_SimpleFont::LoadSubstFont() { |
884 if (!m_bUseFontWidth && !(m_Flags & PDFFONT_FIXEDPITCH)) { | 930 if (!m_bUseFontWidth && !(m_Flags & PDFFONT_FIXEDPITCH)) { |
885 int width = 0, i; | 931 int width = 0, i; |
886 for (i = 0; i < 256; i++) { | 932 for (i = 0; i < 256; i++) { |
887 if (m_CharWidth[i] == 0 || m_CharWidth[i] == 0xffff) { | 933 if (m_CharWidth[i] == 0 || m_CharWidth[i] == 0xffff) { |
888 continue; | 934 continue; |
889 } | 935 } |
890 if (width == 0) { | 936 if (width == 0) { |
891 width = m_CharWidth[i]; | 937 width = m_CharWidth[i]; |
892 } else if (width != m_CharWidth[i]) { | 938 } else if (width != m_CharWidth[i]) { |
893 break; | 939 break; |
894 } | 940 } |
895 } | 941 } |
896 if (i == 256 && width) { | 942 if (i == 256 && width) { |
897 m_Flags |= PDFFONT_FIXEDPITCH; | 943 m_Flags |= PDFFONT_FIXEDPITCH; |
898 } | 944 } |
899 } | 945 } |
900 int weight = m_StemV < 140 ? m_StemV * 5 : (m_StemV * 4 + 140); | 946 int weight = m_StemV < 140 ? m_StemV * 5 : (m_StemV * 4 + 140); |
901 m_Font.LoadSubst(m_BaseFont, IsFontType(PDFFONT_TRUETYPE), m_Flags, weight, | 947 m_Font.LoadSubst(m_BaseFont, IsTrueTypeFont(), m_Flags, weight, m_ItalicAngle, |
902 m_ItalicAngle, 0); | 948 0); |
903 if (m_Font.GetSubstFont()->m_SubstFlags & FXFONT_SUBST_NONSYMBOL) { | 949 if (m_Font.GetSubstFont()->m_SubstFlags & FXFONT_SUBST_NONSYMBOL) { |
904 } | 950 } |
905 } | 951 } |
| 952 |
906 FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const { | 953 FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const { |
907 return m_BaseEncoding != PDFFONT_ENCODING_BUILTIN && | 954 return m_BaseEncoding != PDFFONT_ENCODING_BUILTIN && |
908 m_BaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL && | 955 m_BaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL && |
909 m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS; | 956 m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS; |
910 } | 957 } |
911 CPDF_Type1Font::CPDF_Type1Font() : CPDF_SimpleFont(PDFFONT_TYPE1) { | 958 |
912 m_Base14Font = -1; | 959 CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(FX_DWORD charcode) const { |
| 960 CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode); |
| 961 if (!unicode.IsEmpty()) |
| 962 return unicode; |
| 963 FX_WCHAR ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode); |
| 964 if (ret == 0) |
| 965 return CFX_WideString(); |
| 966 return ret; |
913 } | 967 } |
914 FX_BOOL CPDF_Type1Font::_Load() { | 968 |
| 969 FX_DWORD CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { |
| 970 FX_DWORD ret = CPDF_Font::CharCodeFromUnicode(unicode); |
| 971 if (ret) |
| 972 return ret; |
| 973 return m_Encoding.CharCodeFromUnicode(unicode); |
| 974 } |
| 975 |
| 976 CPDF_Type1Font::CPDF_Type1Font() : m_Base14Font(-1) {} |
| 977 |
| 978 FX_BOOL CPDF_Type1Font::Load() { |
915 m_Base14Font = PDF_GetStandardFontName(&m_BaseFont); | 979 m_Base14Font = PDF_GetStandardFontName(&m_BaseFont); |
916 if (m_Base14Font >= 0) { | 980 if (m_Base14Font >= 0) { |
917 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); | 981 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); |
918 if (pFontDesc && pFontDesc->KeyExist("Flags")) { | 982 if (pFontDesc && pFontDesc->KeyExist("Flags")) { |
919 m_Flags = pFontDesc->GetIntegerBy("Flags"); | 983 m_Flags = pFontDesc->GetIntegerBy("Flags"); |
920 } else { | 984 } else { |
921 m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC; | 985 m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC; |
922 } | 986 } |
923 if (m_Base14Font < 4) | 987 if (m_Base14Font < 4) |
924 for (int i = 0; i < 256; i++) { | 988 for (int i = 0; i < 256; i++) { |
925 m_CharWidth[i] = 600; | 989 m_CharWidth[i] = 600; |
926 } | 990 } |
927 if (m_Base14Font == 12) { | 991 if (m_Base14Font == 12) { |
928 m_BaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL; | 992 m_BaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL; |
929 } else if (m_Base14Font == 13) { | 993 } else if (m_Base14Font == 13) { |
930 m_BaseEncoding = PDFFONT_ENCODING_ZAPFDINGBATS; | 994 m_BaseEncoding = PDFFONT_ENCODING_ZAPFDINGBATS; |
931 } else if (m_Flags & PDFFONT_NONSYMBOLIC) { | 995 } else if (m_Flags & PDFFONT_NONSYMBOLIC) { |
932 m_BaseEncoding = PDFFONT_ENCODING_STANDARD; | 996 m_BaseEncoding = PDFFONT_ENCODING_STANDARD; |
933 } | 997 } |
934 } | 998 } |
935 return LoadCommon(); | 999 return LoadCommon(); |
936 } | 1000 } |
937 static FX_BOOL FT_UseType1Charmap(FXFT_Face face) { | 1001 |
938 if (FXFT_Get_Face_CharmapCount(face) == 0) { | |
939 return FALSE; | |
940 } | |
941 if (FXFT_Get_Face_CharmapCount(face) == 1 && | |
942 FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == | |
943 FXFT_ENCODING_UNICODE) { | |
944 return FALSE; | |
945 } | |
946 if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == | |
947 FXFT_ENCODING_UNICODE) { | |
948 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[1]); | |
949 } else { | |
950 FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]); | |
951 } | |
952 return TRUE; | |
953 } | |
954 int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) { | 1002 int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) { |
955 if (charcode > 0xff) { | 1003 if (charcode > 0xff) { |
956 return -1; | 1004 return -1; |
957 } | 1005 } |
958 int index = m_ExtGID[(uint8_t)charcode]; | 1006 int index = m_ExtGID[(uint8_t)charcode]; |
959 if (index == 0xffff) { | 1007 if (index == 0xffff) { |
960 return -1; | 1008 return -1; |
961 } | 1009 } |
962 return index; | 1010 return index; |
963 } | 1011 } |
964 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1012 |
965 struct _GlyphNameMap { | |
966 const FX_CHAR* m_pStrAdobe; | |
967 const FX_CHAR* m_pStrUnicode; | |
968 }; | |
969 static const _GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"}, | |
970 {"fi", "uniFB01"}, | |
971 {"fl", "uniFB02"}, | |
972 {"ffi", "uniFB03"}, | |
973 {"ffl", "uniFB04"}}; | |
974 extern "C" { | |
975 static int compareString(const void* key, const void* element) { | |
976 return FXSYS_stricmp((const FX_CHAR*)key, | |
977 ((_GlyphNameMap*)element)->m_pStrAdobe); | |
978 } | |
979 } | |
980 static const FX_CHAR* _GlyphNameRemap(const FX_CHAR* pStrAdobe) { | |
981 _GlyphNameMap* found = (_GlyphNameMap*)FXSYS_bsearch( | |
982 pStrAdobe, g_GlyphNameSubsts, | |
983 sizeof g_GlyphNameSubsts / sizeof(_GlyphNameMap), sizeof(_GlyphNameMap), | |
984 compareString); | |
985 if (found) { | |
986 return found->m_pStrUnicode; | |
987 } | |
988 return NULL; | |
989 } | |
990 #endif | |
991 void CPDF_Type1Font::LoadGlyphMap() { | 1013 void CPDF_Type1Font::LoadGlyphMap() { |
992 if (!m_Font.GetFace()) | 1014 if (!m_Font.GetFace()) |
993 return; | 1015 return; |
994 | 1016 |
995 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1017 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
996 FX_BOOL bCoreText = TRUE; | 1018 FX_BOOL bCoreText = TRUE; |
997 CQuartz2D& quartz2d = | 1019 CQuartz2D& quartz2d = |
998 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; | 1020 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; |
999 if (!m_Font.GetPlatformFont()) { | 1021 if (!m_Font.GetPlatformFont()) { |
1000 if (m_Font.GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { | 1022 if (m_Font.GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) { | 1172 if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) { |
1151 bUnicode = TRUE; | 1173 bUnicode = TRUE; |
1152 } | 1174 } |
1153 for (int charcode = 0; charcode < 256; charcode++) { | 1175 for (int charcode = 0; charcode < 256; charcode++) { |
1154 const FX_CHAR* name = | 1176 const FX_CHAR* name = |
1155 GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); | 1177 GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); |
1156 if (!name) { | 1178 if (!name) { |
1157 continue; | 1179 continue; |
1158 } | 1180 } |
1159 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); | 1181 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); |
1160 const FX_CHAR* pStrUnicode = _GlyphNameRemap(name); | 1182 const FX_CHAR* pStrUnicode = GlyphNameRemap(name); |
1161 if (pStrUnicode && | 1183 if (pStrUnicode && |
1162 0 == FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name)) { | 1184 0 == FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name)) { |
1163 name = pStrUnicode; | 1185 name = pStrUnicode; |
1164 } | 1186 } |
1165 m_GlyphIndex[charcode] = | 1187 m_GlyphIndex[charcode] = |
1166 FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name); | 1188 FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name); |
1167 CFStringRef name_ct = CFStringCreateWithCStringNoCopy( | 1189 CFStringRef name_ct = CFStringCreateWithCStringNoCopy( |
1168 kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull); | 1190 kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull); |
1169 m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName( | 1191 m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName( |
1170 (CGFontRef)m_Font.GetPlatformFont(), name_ct); | 1192 (CGFontRef)m_Font.GetPlatformFont(), name_ct); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1295 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
1274 if (!bCoreText) { | 1296 if (!bCoreText) { |
1275 FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256); | 1297 FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256); |
1276 } | 1298 } |
1277 #endif | 1299 #endif |
1278 } | 1300 } |
1279 | 1301 |
1280 CPDF_FontEncoding::CPDF_FontEncoding() { | 1302 CPDF_FontEncoding::CPDF_FontEncoding() { |
1281 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); | 1303 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); |
1282 } | 1304 } |
| 1305 |
1283 int CPDF_FontEncoding::CharCodeFromUnicode(FX_WCHAR unicode) const { | 1306 int CPDF_FontEncoding::CharCodeFromUnicode(FX_WCHAR unicode) const { |
1284 for (int i = 0; i < 256; i++) | 1307 for (int i = 0; i < 256; i++) |
1285 if (m_Unicodes[i] == unicode) { | 1308 if (m_Unicodes[i] == unicode) { |
1286 return i; | 1309 return i; |
1287 } | 1310 } |
1288 return -1; | 1311 return -1; |
1289 } | 1312 } |
| 1313 |
1290 CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { | 1314 CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { |
1291 const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding); | 1315 const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding); |
1292 if (!pSrc) { | 1316 if (!pSrc) { |
1293 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); | 1317 FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); |
1294 } else | 1318 } else |
1295 for (int i = 0; i < 256; i++) { | 1319 for (int i = 0; i < 256; i++) { |
1296 m_Unicodes[i] = pSrc[i]; | 1320 m_Unicodes[i] = pSrc[i]; |
1297 } | 1321 } |
1298 } | 1322 } |
| 1323 |
1299 FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { | 1324 FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { |
1300 return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == | 1325 return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == |
1301 0; | 1326 0; |
1302 } | 1327 } |
| 1328 |
1303 CPDF_Object* CPDF_FontEncoding::Realize() { | 1329 CPDF_Object* CPDF_FontEncoding::Realize() { |
1304 int predefined = 0; | 1330 int predefined = 0; |
1305 for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; | 1331 for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; |
1306 cs++) { | 1332 cs++) { |
1307 const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(cs); | 1333 const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(cs); |
1308 FX_BOOL match = TRUE; | 1334 FX_BOOL match = TRUE; |
1309 for (int i = 0; i < 256; ++i) { | 1335 for (int i = 0; i < 256; ++i) { |
1310 if (m_Unicodes[i] != pSrc[i]) { | 1336 if (m_Unicodes[i] != pSrc[i]) { |
1311 match = FALSE; | 1337 match = FALSE; |
1312 break; | 1338 break; |
(...skipping 25 matching lines...) Expand all Loading... |
1338 } | 1364 } |
1339 pDiff->Add(new CPDF_Number(i)); | 1365 pDiff->Add(new CPDF_Number(i)); |
1340 pDiff->Add(new CPDF_Name(PDF_AdobeNameFromUnicode(m_Unicodes[i]))); | 1366 pDiff->Add(new CPDF_Name(PDF_AdobeNameFromUnicode(m_Unicodes[i]))); |
1341 } | 1367 } |
1342 | 1368 |
1343 CPDF_Dictionary* pDict = new CPDF_Dictionary; | 1369 CPDF_Dictionary* pDict = new CPDF_Dictionary; |
1344 pDict->SetAtName("BaseEncoding", "WinAnsiEncoding"); | 1370 pDict->SetAtName("BaseEncoding", "WinAnsiEncoding"); |
1345 pDict->SetAt("Differences", pDiff); | 1371 pDict->SetAt("Differences", pDiff); |
1346 return pDict; | 1372 return pDict; |
1347 } | 1373 } |
1348 CPDF_TrueTypeFont::CPDF_TrueTypeFont() : CPDF_SimpleFont(PDFFONT_TRUETYPE) {} | 1374 |
1349 FX_BOOL CPDF_TrueTypeFont::_Load() { | 1375 CPDF_TrueTypeFont::CPDF_TrueTypeFont() {} |
| 1376 |
| 1377 FX_BOOL CPDF_TrueTypeFont::Load() { |
1350 return LoadCommon(); | 1378 return LoadCommon(); |
1351 } | 1379 } |
| 1380 |
1352 void CPDF_TrueTypeFont::LoadGlyphMap() { | 1381 void CPDF_TrueTypeFont::LoadGlyphMap() { |
1353 if (!m_Font.GetFace()) | 1382 if (!m_Font.GetFace()) |
1354 return; | 1383 return; |
1355 | 1384 |
1356 int baseEncoding = m_BaseEncoding; | 1385 int baseEncoding = m_BaseEncoding; |
1357 if (m_pFontFile && m_Font.GetFace()->num_charmaps > 0 && | 1386 if (m_pFontFile && m_Font.GetFace()->num_charmaps > 0 && |
1358 (baseEncoding == PDFFONT_ENCODING_MACROMAN || | 1387 (baseEncoding == PDFFONT_ENCODING_MACROMAN || |
1359 baseEncoding == PDFFONT_ENCODING_WINANSI) && | 1388 baseEncoding == PDFFONT_ENCODING_WINANSI) && |
1360 (m_Flags & PDFFONT_SYMBOLIC)) { | 1389 (m_Flags & PDFFONT_SYMBOLIC)) { |
1361 FX_BOOL bSupportWin = FALSE; | 1390 FX_BOOL bSupportWin = FALSE; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 if (bGotOne) { | 1568 if (bGotOne) { |
1540 return; | 1569 return; |
1541 } | 1570 } |
1542 } | 1571 } |
1543 for (int charcode = 0; charcode < 256; charcode++) { | 1572 for (int charcode = 0; charcode < 256; charcode++) { |
1544 m_GlyphIndex[charcode] = charcode; | 1573 m_GlyphIndex[charcode] = charcode; |
1545 } | 1574 } |
1546 } | 1575 } |
1547 | 1576 |
1548 CPDF_Type3Font::CPDF_Type3Font() | 1577 CPDF_Type3Font::CPDF_Type3Font() |
1549 : CPDF_SimpleFont(PDFFONT_TYPE3), | 1578 : m_pCharProcs(nullptr), |
1550 m_pCharProcs(nullptr), | |
1551 m_pPageResources(nullptr), | 1579 m_pPageResources(nullptr), |
1552 m_pFontResources(nullptr) { | 1580 m_pFontResources(nullptr) { |
1553 FXSYS_memset(m_CharWidthL, 0, sizeof(m_CharWidthL)); | 1581 FXSYS_memset(m_CharWidthL, 0, sizeof(m_CharWidthL)); |
1554 } | 1582 } |
1555 | 1583 |
1556 CPDF_Type3Font::~CPDF_Type3Font() { | 1584 CPDF_Type3Font::~CPDF_Type3Font() { |
1557 for (auto it : m_CacheMap) | 1585 for (auto it : m_CacheMap) |
1558 delete it.second; | 1586 delete it.second; |
1559 } | 1587 } |
1560 | 1588 |
1561 FX_BOOL CPDF_Type3Font::_Load() { | 1589 FX_BOOL CPDF_Type3Font::Load() { |
1562 m_pFontResources = m_pFontDict->GetDictBy("Resources"); | 1590 m_pFontResources = m_pFontDict->GetDictBy("Resources"); |
1563 CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix"); | 1591 CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix"); |
1564 FX_FLOAT xscale = 1.0f, yscale = 1.0f; | 1592 FX_FLOAT xscale = 1.0f, yscale = 1.0f; |
1565 if (pMatrix) { | 1593 if (pMatrix) { |
1566 m_FontMatrix = pMatrix->GetMatrix(); | 1594 m_FontMatrix = pMatrix->GetMatrix(); |
1567 xscale = m_FontMatrix.a; | 1595 xscale = m_FontMatrix.a; |
1568 yscale = m_FontMatrix.d; | 1596 yscale = m_FontMatrix.d; |
1569 } | 1597 } |
1570 CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox"); | 1598 CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox"); |
1571 if (pBBox) { | 1599 if (pBBox) { |
(...skipping 25 matching lines...) Expand all Loading... |
1597 for (int i = 0; i < 256; i++) { | 1625 for (int i = 0; i < 256; i++) { |
1598 m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]); | 1626 m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]); |
1599 if (m_Encoding.m_Unicodes[i] == 0) { | 1627 if (m_Encoding.m_Unicodes[i] == 0) { |
1600 m_Encoding.m_Unicodes[i] = i; | 1628 m_Encoding.m_Unicodes[i] = i; |
1601 } | 1629 } |
1602 } | 1630 } |
1603 } | 1631 } |
1604 } | 1632 } |
1605 return TRUE; | 1633 return TRUE; |
1606 } | 1634 } |
| 1635 |
1607 void CPDF_Type3Font::CheckType3FontMetrics() { | 1636 void CPDF_Type3Font::CheckType3FontMetrics() { |
1608 CheckFontMetrics(); | 1637 CheckFontMetrics(); |
1609 } | 1638 } |
1610 | 1639 |
1611 CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) { | 1640 CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) { |
1612 if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_) | 1641 if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_) |
1613 return nullptr; | 1642 return nullptr; |
1614 | 1643 |
1615 auto it = m_CacheMap.find(charcode); | 1644 auto it = m_CacheMap.find(charcode); |
1616 if (it != m_CacheMap.end()) | 1645 if (it != m_CacheMap.end()) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 rect = pChar->m_BBox; | 1716 rect = pChar->m_BBox; |
1688 } | 1717 } |
1689 | 1718 |
1690 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) | 1719 CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) |
1691 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {} | 1720 : m_pForm(pForm), m_pBitmap(nullptr), m_bColored(FALSE) {} |
1692 | 1721 |
1693 CPDF_Type3Char::~CPDF_Type3Char() { | 1722 CPDF_Type3Char::~CPDF_Type3Char() { |
1694 delete m_pForm; | 1723 delete m_pForm; |
1695 delete m_pBitmap; | 1724 delete m_pBitmap; |
1696 } | 1725 } |
OLD | NEW |