Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: core/src/fpdfapi/fpdf_font/fpdf_font.cpp

Issue 1171733003: Remove typdefs for pointer types in fx_system.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual fixes. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_font/font_int.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" 9 #include "../../../include/fpdfapi/fpdf_pageobj.h"
10 #include "font_int.h" 10 #include "font_int.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return charcode; 198 return charcode;
199 } 199 }
200 } 200 }
201 return _CharCodeFromUnicode(unicode); 201 return _CharCodeFromUnicode(unicode);
202 } 202 }
203 CFX_WideString CPDF_Font::DecodeString(const CFX_ByteString& str) const 203 CFX_WideString CPDF_Font::DecodeString(const CFX_ByteString& str) const
204 { 204 {
205 CFX_WideString result; 205 CFX_WideString result;
206 int src_len = str.GetLength(); 206 int src_len = str.GetLength();
207 result.Reserve(src_len); 207 result.Reserve(src_len);
208 FX_LPCSTR src_buf = str; 208 const FX_CHAR* src_buf = str;
209 int src_pos = 0; 209 int src_pos = 0;
210 while (src_pos < src_len) { 210 while (src_pos < src_len) {
211 FX_DWORD charcode = GetNextChar(src_buf, src_len, src_pos); 211 FX_DWORD charcode = GetNextChar(src_buf, src_len, src_pos);
212 CFX_WideString unicode = UnicodeFromCharCode(charcode); 212 CFX_WideString unicode = UnicodeFromCharCode(charcode);
213 if (!unicode.IsEmpty()) { 213 if (!unicode.IsEmpty()) {
214 result += unicode; 214 result += unicode;
215 } else { 215 } else {
216 result += (FX_WCHAR)charcode; 216 result += (FX_WCHAR)charcode;
217 } 217 }
218 } 218 }
219 return result; 219 return result;
220 } 220 }
221 CFX_ByteString CPDF_Font::EncodeString(const CFX_WideString& str) const 221 CFX_ByteString CPDF_Font::EncodeString(const CFX_WideString& str) const
222 { 222 {
223 CFX_ByteString result; 223 CFX_ByteString result;
224 int src_len = str.GetLength(); 224 int src_len = str.GetLength();
225 FX_LPSTR dest_buf = result.GetBuffer(src_len * 2); 225 FX_CHAR* dest_buf = result.GetBuffer(src_len * 2);
226 FX_LPCWSTR src_buf = str.c_str(); 226 const FX_WCHAR* src_buf = str.c_str();
227 int dest_pos = 0; 227 int dest_pos = 0;
228 for (int src_pos = 0; src_pos < src_len; src_pos ++) { 228 for (int src_pos = 0; src_pos < src_len; src_pos ++) {
229 FX_DWORD charcode = CharCodeFromUnicode(src_buf[src_pos]); 229 FX_DWORD charcode = CharCodeFromUnicode(src_buf[src_pos]);
230 dest_pos += AppendChar(dest_buf + dest_pos, charcode); 230 dest_pos += AppendChar(dest_buf + dest_pos, charcode);
231 } 231 }
232 result.ReleaseBuffer(dest_pos); 232 result.ReleaseBuffer(dest_pos);
233 return result; 233 return result;
234 } 234 }
235 void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) 235 void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc)
236 { 236 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile2")); 282 pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile2"));
283 } 283 }
284 if (pFontFile == NULL) { 284 if (pFontFile == NULL) {
285 pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile3")); 285 pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile3"));
286 } 286 }
287 if (pFontFile) { 287 if (pFontFile) {
288 m_pFontFile = m_pDocument->LoadFontFile(pFontFile); 288 m_pFontFile = m_pDocument->LoadFontFile(pFontFile);
289 if (m_pFontFile == NULL) { 289 if (m_pFontFile == NULL) {
290 return; 290 return;
291 } 291 }
292 FX_LPCBYTE pFontData = m_pFontFile->GetData(); 292 const uint8_t* pFontData = m_pFontFile->GetData();
293 FX_DWORD dwFontSize = m_pFontFile->GetSize(); 293 FX_DWORD dwFontSize = m_pFontFile->GetSize();
294 m_Font.LoadEmbedded(pFontData, dwFontSize); 294 m_Font.LoadEmbedded(pFontData, dwFontSize);
295 if (m_Font.m_Face == NULL) { 295 if (m_Font.m_Face == NULL) {
296 m_pFontFile = NULL; 296 m_pFontFile = NULL;
297 } 297 }
298 } 298 }
299 } 299 }
300 short TT2PDF(int m, FXFT_Face face) 300 short TT2PDF(int m, FXFT_Face face)
301 { 301 {
302 int upm = FXFT_Get_Face_UnitsPerEM(face); 302 int upm = FXFT_Get_Face_UnitsPerEM(face);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void CPDF_Font::LoadUnicodeMap() 362 void CPDF_Font::LoadUnicodeMap()
363 { 363 {
364 m_bToUnicodeLoaded = TRUE; 364 m_bToUnicodeLoaded = TRUE;
365 CPDF_Stream* pStream = m_pFontDict->GetStream(FX_BSTRC("ToUnicode")); 365 CPDF_Stream* pStream = m_pFontDict->GetStream(FX_BSTRC("ToUnicode"));
366 if (pStream == NULL) { 366 if (pStream == NULL) {
367 return; 367 return;
368 } 368 }
369 m_pToUnicodeMap = new CPDF_ToUnicodeMap; 369 m_pToUnicodeMap = new CPDF_ToUnicodeMap;
370 m_pToUnicodeMap->Load(pStream); 370 m_pToUnicodeMap->Load(pStream);
371 } 371 }
372 int CPDF_Font::GetStringWidth(FX_LPCSTR pString, int size) 372 int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size)
373 { 373 {
374 int offset = 0; 374 int offset = 0;
375 int width = 0; 375 int width = 0;
376 while (offset < size) { 376 while (offset < size) {
377 FX_DWORD charcode = GetNextChar(pString, size, offset); 377 FX_DWORD charcode = GetNextChar(pString, size, offset);
378 width += GetCharWidthF(charcode); 378 width += GetCharWidthF(charcode);
379 } 379 }
380 return width; 380 return width;
381 } 381 }
382 int CPDF_Font::GetCharTypeWidth(FX_DWORD charcode) 382 int CPDF_Font::GetCharTypeWidth(FX_DWORD charcode)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 CFX_ByteString type = pFontDict->GetString(FX_BSTRC("Subtype")); 424 CFX_ByteString type = pFontDict->GetString(FX_BSTRC("Subtype"));
425 CPDF_Font* pFont; 425 CPDF_Font* pFont;
426 if (type == FX_BSTRC("TrueType")) { 426 if (type == FX_BSTRC("TrueType")) {
427 { 427 {
428 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || _FXM_PLATFORM_ == _FXM_PLATFORM _LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || _FXM_PLATFORM_ == _FXM_PL ATFORM_APPLE_ 428 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || _FXM_PLATFORM_ == _FXM_PLATFORM _LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || _FXM_PLATFORM_ == _FXM_PL ATFORM_APPLE_
429 CFX_ByteString basefont = pFontDict->GetString(FX_BSTRC("BaseFont")) ; 429 CFX_ByteString basefont = pFontDict->GetString(FX_BSTRC("BaseFont")) ;
430 CFX_ByteString tag = basefont.Left(4); 430 CFX_ByteString tag = basefont.Left(4);
431 int i; 431 int i;
432 int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]); 432 int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]);
433 for (i = 0; i < count; ++i) { 433 for (i = 0; i < count; ++i) {
434 if (tag == CFX_ByteString((FX_LPCSTR)ChineseFontNames[i])) { 434 if (tag == CFX_ByteString((const FX_CHAR*)ChineseFontNames[i])) {
435 break; 435 break;
436 } 436 }
437 } 437 }
438 if (i < count) { 438 if (i < count) {
439 CPDF_Dictionary* pFontDesc = pFontDict->GetDict(FX_BSTRC("FontDe scriptor")); 439 CPDF_Dictionary* pFontDesc = pFontDict->GetDict(FX_BSTRC("FontDe scriptor"));
440 if (pFontDesc == NULL || !pFontDesc->KeyExist(FX_BSTRC("FontFile 2"))) { 440 if (pFontDesc == NULL || !pFontDesc->KeyExist(FX_BSTRC("FontFile 2"))) {
441 pFont = new CPDF_CIDFont; 441 pFont = new CPDF_CIDFont;
442 pFont->m_pFontDict = pFontDict; 442 pFont->m_pFontDict = pFontDict;
443 pFont->m_pDocument = pDoc; 443 pFont->m_pDocument = pDoc;
444 if (!pFont->Load()) { 444 if (!pFont->Load()) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 m_pFont = pFont; 493 m_pFont = pFont;
494 } 494 }
495 CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) 495 CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode)
496 { 496 {
497 FX_DWORD value; 497 FX_DWORD value;
498 if (m_Map.Lookup(charcode, value)) { 498 if (m_Map.Lookup(charcode, value)) {
499 FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff); 499 FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff);
500 if (unicode != 0xffff) { 500 if (unicode != 0xffff) {
501 return unicode; 501 return unicode;
502 } 502 }
503 FX_LPCWSTR buf = m_MultiCharBuf.GetBuffer(); 503 const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer();
504 FX_DWORD buf_len = m_MultiCharBuf.GetLength(); 504 FX_DWORD buf_len = m_MultiCharBuf.GetLength();
505 if (buf == NULL || buf_len == 0) { 505 if (buf == NULL || buf_len == 0) {
506 return CFX_WideString(); 506 return CFX_WideString();
507 } 507 }
508 FX_DWORD index = value >> 16; 508 FX_DWORD index = value >> 16;
509 if (index >= buf_len) { 509 if (index >= buf_len) {
510 return CFX_WideString(); 510 return CFX_WideString();
511 } 511 }
512 FX_DWORD len = buf[index]; 512 FX_DWORD len = buf[index];
513 if (index + len < index || index + len >= buf_len) { 513 if (index + len < index || index + len >= buf_len) {
(...skipping 13 matching lines...) Expand all
527 FX_DWORD key, value; 527 FX_DWORD key, value;
528 m_Map.GetNextAssoc(pos, key, value); 528 m_Map.GetNextAssoc(pos, key, value);
529 if ((FX_WCHAR)value == unicode) { 529 if ((FX_WCHAR)value == unicode) {
530 return key; 530 return key;
531 } 531 }
532 } 532 }
533 return 0; 533 return 0;
534 } 534 }
535 static FX_DWORD _StringToCode(FX_BSTR str) 535 static FX_DWORD _StringToCode(FX_BSTR str)
536 { 536 {
537 FX_LPCSTR buf = str.GetCStr(); 537 const FX_CHAR* buf = str.GetCStr();
538 int len = str.GetLength(); 538 int len = str.GetLength();
539 if (len == 0) { 539 if (len == 0) {
540 return 0; 540 return 0;
541 } 541 }
542 int result = 0; 542 int result = 0;
543 if (buf[0] == '<') { 543 if (buf[0] == '<') {
544 for (int i = 1; i < len; i ++) { 544 for (int i = 1; i < len; i ++) {
545 int digit; 545 int digit;
546 if (buf[i] >= '0' && buf[i] <= '9') { 546 if (buf[i] >= '0' && buf[i] <= '9') {
547 digit = buf[i] - '0'; 547 digit = buf[i] - '0';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 value = 0; 579 value = 0;
580 } 580 }
581 } 581 }
582 if (value) { 582 if (value) {
583 ret.Insert(0, value); 583 ret.Insert(0, value);
584 } 584 }
585 return ret; 585 return ret;
586 } 586 }
587 static CFX_WideString _StringToWideString(FX_BSTR str) 587 static CFX_WideString _StringToWideString(FX_BSTR str)
588 { 588 {
589 FX_LPCSTR buf = str.GetCStr(); 589 const FX_CHAR* buf = str.GetCStr();
590 int len = str.GetLength(); 590 int len = str.GetLength();
591 if (len == 0) { 591 if (len == 0) {
592 return CFX_WideString(); 592 return CFX_WideString();
593 } 593 }
594 CFX_WideString result; 594 CFX_WideString result;
595 if (buf[0] == '<') { 595 if (buf[0] == '<') {
596 int byte_pos = 0; 596 int byte_pos = 0;
597 FX_WCHAR ch = 0; 597 FX_WCHAR ch = 0;
598 for (int i = 1; i < len; i ++) { 598 for (int i = 1; i < len; i ++) {
599 int digit; 599 int digit;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 FX_LPCSTR PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcod e); 819 extern const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t ch arcode);
820 CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) 820 CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype)
821 { 821 {
822 FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox); 822 FXSYS_memset8(m_CharBBox, 0xff, sizeof m_CharBBox);
823 FXSYS_memset8(m_CharWidth, 0xff, sizeof m_CharWidth); 823 FXSYS_memset8(m_CharWidth, 0xff, sizeof m_CharWidth);
824 FXSYS_memset8(m_GlyphIndex, 0xff, sizeof m_GlyphIndex); 824 FXSYS_memset8(m_GlyphIndex, 0xff, sizeof m_GlyphIndex);
825 FXSYS_memset8(m_ExtGID, 0xff, sizeof m_ExtGID); 825 FXSYS_memset8(m_ExtGID, 0xff, sizeof m_ExtGID);
826 m_pCharNames = NULL; 826 m_pCharNames = NULL;
827 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN; 827 m_BaseEncoding = PDFFONT_ENCODING_BUILTIN;
828 } 828 }
829 CPDF_SimpleFont::~CPDF_SimpleFont() 829 CPDF_SimpleFont::~CPDF_SimpleFont()
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 charcode = 0; 900 charcode = 0;
901 } 901 }
902 if (m_CharBBox[charcode].Left == (int16_t)0xffff) { 902 if (m_CharBBox[charcode].Left == (int16_t)0xffff) {
903 LoadCharMetrics(charcode); 903 LoadCharMetrics(charcode);
904 } 904 }
905 rect.left = m_CharBBox[charcode].Left; 905 rect.left = m_CharBBox[charcode].Left;
906 rect.right = m_CharBBox[charcode].Right; 906 rect.right = m_CharBBox[charcode].Right;
907 rect.bottom = m_CharBBox[charcode].Bottom; 907 rect.bottom = m_CharBBox[charcode].Bottom;
908 rect.top = m_CharBBox[charcode].Top; 908 rect.top = m_CharBBox[charcode].Top;
909 } 909 }
910 FX_LPCSTR GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode) 910 const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNa mes, int charcode)
911 { 911 {
912 ASSERT(charcode >= 0 && charcode < 256); 912 ASSERT(charcode >= 0 && charcode < 256);
913 if (charcode < 0 || charcode >= 256) { 913 if (charcode < 0 || charcode >= 256) {
914 return NULL; 914 return NULL;
915 } 915 }
916 FX_LPCSTR name = NULL; 916 const FX_CHAR* name = NULL;
917 if (pCharNames) { 917 if (pCharNames) {
918 name = pCharNames[charcode]; 918 name = pCharNames[charcode];
919 } 919 }
920 if ((name == NULL || name[0] == 0) && iBaseEncoding) { 920 if ((name == NULL || name[0] == 0) && iBaseEncoding) {
921 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); 921 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode);
922 } 922 }
923 if (name == NULL || name[0] == 0) { 923 if (name == NULL || name[0] == 0) {
924 return NULL; 924 return NULL;
925 } 925 }
926 return name; 926 return name;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 return -1; 1074 return -1;
1075 } 1075 }
1076 int index = m_ExtGID[(uint8_t)charcode]; 1076 int index = m_ExtGID[(uint8_t)charcode];
1077 if (index == 0xffff) { 1077 if (index == 0xffff) {
1078 return -1; 1078 return -1;
1079 } 1079 }
1080 return index; 1080 return index;
1081 } 1081 }
1082 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1082 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
1083 struct _GlyphNameMap { 1083 struct _GlyphNameMap {
1084 FX_LPCSTR m_pStrAdobe; 1084 const FX_CHAR* m_pStrAdobe;
1085 FX_LPCSTR m_pStrUnicode; 1085 const FX_CHAR* m_pStrUnicode;
1086 }; 1086 };
1087 static const _GlyphNameMap g_GlyphNameSubsts[] = { 1087 static const _GlyphNameMap g_GlyphNameSubsts[] = {
1088 {"ff", "uniFB00"}, 1088 {"ff", "uniFB00"},
1089 {"fi", "uniFB01"}, 1089 {"fi", "uniFB01"},
1090 {"fl", "uniFB02"}, 1090 {"fl", "uniFB02"},
1091 {"ffi", "uniFB03"}, 1091 {"ffi", "uniFB03"},
1092 {"ffl", "uniFB04"} 1092 {"ffl", "uniFB04"}
1093 }; 1093 };
1094 extern "C" { 1094 extern "C" {
1095 static int compareString(const void* key, const void* element) 1095 static int compareString(const void* key, const void* element)
1096 { 1096 {
1097 return FXSYS_stricmp((FX_LPCSTR)key, ((_GlyphNameMap*)element)->m_pStrAd obe); 1097 return FXSYS_stricmp((const FX_CHAR*)key, ((_GlyphNameMap*)element)->m_p StrAdobe);
1098 } 1098 }
1099 } 1099 }
1100 static FX_LPCSTR _GlyphNameRemap(FX_LPCSTR pStrAdobe) 1100 static const FX_CHAR* _GlyphNameRemap(const FX_CHAR* pStrAdobe)
1101 { 1101 {
1102 _GlyphNameMap* found = (_GlyphNameMap*)FXSYS_bsearch(pStrAdobe, g_GlyphNameS ubsts, 1102 _GlyphNameMap* found = (_GlyphNameMap*)FXSYS_bsearch(pStrAdobe, g_GlyphNameS ubsts,
1103 sizeof g_GlyphNameSubsts / sizeof(_GlyphNameMap), siz eof(_GlyphNameMap), 1103 sizeof g_GlyphNameSubsts / sizeof(_GlyphNameMap), siz eof(_GlyphNameMap),
1104 compareString); 1104 compareString);
1105 if (found) { 1105 if (found) {
1106 return found->m_pStrUnicode; 1106 return found->m_pStrUnicode;
1107 } 1107 }
1108 return NULL; 1108 return NULL;
1109 } 1109 }
1110 #endif 1110 #endif
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 } 1157 }
1158 #endif 1158 #endif
1159 return; 1159 return;
1160 } 1160 }
1161 } 1161 }
1162 FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE); 1162 FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE);
1163 if (m_BaseEncoding == 0) { 1163 if (m_BaseEncoding == 0) {
1164 m_BaseEncoding = PDFFONT_ENCODING_STANDARD; 1164 m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
1165 } 1165 }
1166 for (int charcode = 0; charcode < 256; charcode ++) { 1166 for (int charcode = 0; charcode < 256; charcode ++) {
1167 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, char code); 1167 const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
1168 if (name == NULL) { 1168 if (name == NULL) {
1169 continue; 1169 continue;
1170 } 1170 }
1171 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); 1171 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
1172 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, m_Encodi ng.m_Unicodes[charcode]); 1172 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, m_Encodi ng.m_Unicodes[charcode]);
1173 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1173 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
1174 FX_CHAR name_glyph[256]; 1174 FX_CHAR name_glyph[256];
1175 FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyp h, 256); 1175 FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyp h, 256);
1176 name_glyph[255] = 0; 1176 name_glyph[255] = 0;
1177 CFStringRef name_ct = CFStringCreateWithCStringNoCopy(kCFAllocatorDe fault, name_glyph, kCFStringEncodingASCII, kCFAllocatorNull); 1177 CFStringRef name_ct = CFStringCreateWithCStringNoCopy(kCFAllocatorDe fault, name_glyph, kCFStringEncodingASCII, kCFAllocatorNull);
(...skipping 22 matching lines...) Expand all
1200 FXSYS_memcpy32(m_ExtGID, m_GlyphIndex, 256); 1200 FXSYS_memcpy32(m_ExtGID, m_GlyphIndex, 256);
1201 } 1201 }
1202 #endif 1202 #endif
1203 return; 1203 return;
1204 } 1204 }
1205 FT_UseType1Charmap(m_Font.m_Face); 1205 FT_UseType1Charmap(m_Font.m_Face);
1206 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1206 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
1207 if (bCoreText) { 1207 if (bCoreText) {
1208 if (m_Flags & PDFFONT_SYMBOLIC) { 1208 if (m_Flags & PDFFONT_SYMBOLIC) {
1209 for (int charcode = 0; charcode < 256; charcode ++) { 1209 for (int charcode = 0; charcode < 256; charcode ++) {
1210 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); 1210 const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNa mes, charcode);
1211 if (name) { 1211 if (name) {
1212 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(n ame); 1212 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(n ame);
1213 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name); 1213 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name);
1214 CFStringRef name_ct = CFStringCreateWithCStringNoCopy(kCFAll ocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull); 1214 CFStringRef name_ct = CFStringCreateWithCStringNoCopy(kCFAll ocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull);
1215 m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName((CGFontRef) m_Font.m_pPlatformFont, name_ct); 1215 m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName((CGFontRef) m_Font.m_pPlatformFont, name_ct);
1216 if (name_ct) { 1216 if (name_ct) {
1217 CFRelease(name_ct); 1217 CFRelease(name_ct);
1218 } 1218 }
1219 } else { 1219 } else {
1220 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, charcode); 1220 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, charcode);
(...skipping 16 matching lines...) Expand all
1237 } 1237 }
1238 } 1238 }
1239 } 1239 }
1240 return; 1240 return;
1241 } 1241 }
1242 FX_BOOL bUnicode = FALSE; 1242 FX_BOOL bUnicode = FALSE;
1243 if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) { 1243 if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
1244 bUnicode = TRUE; 1244 bUnicode = TRUE;
1245 } 1245 }
1246 for (int charcode = 0; charcode < 256; charcode ++) { 1246 for (int charcode = 0; charcode < 256; charcode ++) {
1247 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, char code); 1247 const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
1248 if (name == NULL) { 1248 if (name == NULL) {
1249 continue; 1249 continue;
1250 } 1250 }
1251 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); 1251 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
1252 FX_LPCSTR pStrUnicode = _GlyphNameRemap(name); 1252 const FX_CHAR* pStrUnicode = _GlyphNameRemap(name);
1253 if (pStrUnicode && 0 == FXFT_Get_Name_Index(m_Font.m_Face, (char*)na me)) { 1253 if (pStrUnicode && 0 == FXFT_Get_Name_Index(m_Font.m_Face, (char*)na me)) {
1254 name = pStrUnicode; 1254 name = pStrUnicode;
1255 } 1255 }
1256 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)n ame); 1256 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)n ame);
1257 CFStringRef name_ct = CFStringCreateWithCStringNoCopy(kCFAllocatorDe fault, name, kCFStringEncodingASCII, kCFAllocatorNull); 1257 CFStringRef name_ct = CFStringCreateWithCStringNoCopy(kCFAllocatorDe fault, name, kCFStringEncodingASCII, kCFAllocatorNull);
1258 m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName((CGFontRef)m_Font.m _pPlatformFont, name_ct); 1258 m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName((CGFontRef)m_Font.m _pPlatformFont, name_ct);
1259 if (name_ct) { 1259 if (name_ct) {
1260 CFRelease(name_ct); 1260 CFRelease(name_ct);
1261 } 1261 }
1262 if (m_GlyphIndex[charcode] == 0) { 1262 if (m_GlyphIndex[charcode] == 0) {
(...skipping 19 matching lines...) Expand all
1282 CFRelease(name_ct); 1282 CFRelease(name_ct);
1283 } 1283 }
1284 } 1284 }
1285 } 1285 }
1286 } 1286 }
1287 return; 1287 return;
1288 } 1288 }
1289 #endif 1289 #endif
1290 if (m_Flags & PDFFONT_SYMBOLIC) { 1290 if (m_Flags & PDFFONT_SYMBOLIC) {
1291 for (int charcode = 0; charcode < 256; charcode ++) { 1291 for (int charcode = 0; charcode < 256; charcode ++) {
1292 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, char code); 1292 const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
1293 if (name) { 1293 if (name) {
1294 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name) ; 1294 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name) ;
1295 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (cha r*)name); 1295 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (cha r*)name);
1296 } else { 1296 } else {
1297 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, char code); 1297 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, char code);
1298 if (m_GlyphIndex[charcode]) { 1298 if (m_GlyphIndex[charcode]) {
1299 FX_WCHAR unicode = FT_UnicodeFromCharCode(PDFFONT_ENCODING_S TANDARD, charcode); 1299 FX_WCHAR unicode = FT_UnicodeFromCharCode(PDFFONT_ENCODING_S TANDARD, charcode);
1300 if (unicode == 0) { 1300 if (unicode == 0) {
1301 FX_CHAR name_glyph[256]; 1301 FX_CHAR name_glyph[256];
1302 FXSYS_memset32(name_glyph, 0, sizeof(name_glyph)); 1302 FXSYS_memset32(name_glyph, 0, sizeof(name_glyph));
(...skipping 12 matching lines...) Expand all
1315 FXSYS_memcpy32(m_ExtGID, m_GlyphIndex, 256); 1315 FXSYS_memcpy32(m_ExtGID, m_GlyphIndex, 256);
1316 } 1316 }
1317 #endif 1317 #endif
1318 return; 1318 return;
1319 } 1319 }
1320 FX_BOOL bUnicode = FALSE; 1320 FX_BOOL bUnicode = FALSE;
1321 if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) { 1321 if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
1322 bUnicode = TRUE; 1322 bUnicode = TRUE;
1323 } 1323 }
1324 for (int charcode = 0; charcode < 256; charcode ++) { 1324 for (int charcode = 0; charcode < 256; charcode ++) {
1325 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode ); 1325 const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, cha rcode);
1326 if (name == NULL) { 1326 if (name == NULL) {
1327 continue; 1327 continue;
1328 } 1328 }
1329 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); 1329 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
1330 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name) ; 1330 m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name) ;
1331 if (m_GlyphIndex[charcode] == 0) { 1331 if (m_GlyphIndex[charcode] == 0) {
1332 if (FXSYS_strcmp(name, ".notdef") != 0 && FXSYS_strcmp(name, "space" ) != 0) { 1332 if (FXSYS_strcmp(name, ".notdef") != 0 && FXSYS_strcmp(name, "space" ) != 0) {
1333 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, bUni code ? m_Encoding.m_Unicodes[charcode] : charcode); 1333 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, bUni code ? m_Encoding.m_Unicodes[charcode] : charcode);
1334 } else { 1334 } else {
1335 m_Encoding.m_Unicodes[charcode] = 0x20; 1335 m_Encoding.m_Unicodes[charcode] = 0x20;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 if (m_Flags & PDFFONT_NONSYMBOLIC) { 1468 if (m_Flags & PDFFONT_NONSYMBOLIC) {
1469 bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0); 1469 bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0);
1470 bMSSymbol = !bMacRoman && FT_UseTTCharmap(m_Font.m_Face, 3, 0); 1470 bMSSymbol = !bMacRoman && FT_UseTTCharmap(m_Font.m_Face, 3, 0);
1471 } else { 1471 } else {
1472 bMSSymbol = FT_UseTTCharmap(m_Font.m_Face, 3, 0); 1472 bMSSymbol = FT_UseTTCharmap(m_Font.m_Face, 3, 0);
1473 bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.m_Face, 1, 0); 1473 bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.m_Face, 1, 0);
1474 } 1474 }
1475 } 1475 }
1476 FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode")); 1476 FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode"));
1477 for (int charcode = 0; charcode < 256; charcode ++) { 1477 for (int charcode = 0; charcode < 256; charcode ++) {
1478 FX_LPCSTR name = GetAdobeCharName(baseEncoding, m_pCharNames, charco de); 1478 const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pCharNames, c harcode);
1479 if (name == NULL) { 1479 if (name == NULL) {
1480 m_GlyphIndex[charcode] = m_pFontFile ? FXFT_Get_Char_Index(m_Fon t.m_Face, charcode) : -1; 1480 m_GlyphIndex[charcode] = m_pFontFile ? FXFT_Get_Char_Index(m_Fon t.m_Face, charcode) : -1;
1481 continue; 1481 continue;
1482 } 1482 }
1483 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name); 1483 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
1484 if (bMSSymbol) { 1484 if (bMSSymbol) {
1485 const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; 1485 const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
1486 for (int j = 0; j < 4; j ++) { 1486 for (int j = 0; j < 4; j ++) {
1487 FX_WORD unicode = prefix[j] * 256 + charcode; 1487 FX_WORD unicode = prefix[j] * 256 + charcode;
1488 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode); 1488 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unic ode); 1533 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unic ode);
1534 if (m_GlyphIndex[charcode]) { 1534 if (m_GlyphIndex[charcode]) {
1535 bGotOne = TRUE; 1535 bGotOne = TRUE;
1536 break; 1536 break;
1537 } 1537 }
1538 } 1538 }
1539 } 1539 }
1540 if (bGotOne) { 1540 if (bGotOne) {
1541 if (baseEncoding != PDFFONT_ENCODING_BUILTIN) { 1541 if (baseEncoding != PDFFONT_ENCODING_BUILTIN) {
1542 for (int charcode = 0; charcode < 256; charcode ++) { 1542 for (int charcode = 0; charcode < 256; charcode ++) {
1543 FX_LPCSTR name = GetAdobeCharName(baseEncoding, m_pCharNames , charcode); 1543 const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pChar Names, charcode);
1544 if (name == NULL) { 1544 if (name == NULL) {
1545 continue; 1545 continue;
1546 } 1546 }
1547 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(n ame); 1547 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(n ame);
1548 } 1548 }
1549 } else if (FT_UseTTCharmap(m_Font.m_Face, 1, 0)) { 1549 } else if (FT_UseTTCharmap(m_Font.m_Face, 1, 0)) {
1550 for (int charcode = 0; charcode < 256; charcode ++) { 1550 for (int charcode = 0; charcode < 256; charcode ++) {
1551 m_Encoding.m_Unicodes[charcode] = FT_UnicodeFromCharCode(FXF T_ENCODING_APPLE_ROMAN, charcode); 1551 m_Encoding.m_Unicodes[charcode] = FT_UnicodeFromCharCode(FXF T_ENCODING_APPLE_ROMAN, charcode);
1552 } 1552 }
1553 } 1553 }
(...skipping 11 matching lines...) Expand all
1565 } 1565 }
1566 if (m_pFontFile || bGotOne) { 1566 if (m_pFontFile || bGotOne) {
1567 return; 1567 return;
1568 } 1568 }
1569 } 1569 }
1570 if (FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE) == 0) { 1570 if (FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE) == 0) {
1571 FX_BOOL bGotOne = FALSE; 1571 FX_BOOL bGotOne = FALSE;
1572 const FX_WORD* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding ); 1572 const FX_WORD* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding );
1573 for (int charcode = 0; charcode < 256; charcode ++) { 1573 for (int charcode = 0; charcode < 256; charcode ++) {
1574 if (m_pFontFile == NULL) { 1574 if (m_pFontFile == NULL) {
1575 FX_LPCSTR name = GetAdobeCharName(0, m_pCharNames, charcode); 1575 const FX_CHAR* name = GetAdobeCharName(0, m_pCharNames, charcode );
1576 if (name != NULL) { 1576 if (name != NULL) {
1577 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(n ame); 1577 m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(n ame);
1578 } else if (pUnicodes) { 1578 } else if (pUnicodes) {
1579 m_Encoding.m_Unicodes[charcode] = pUnicodes[charcode]; 1579 m_Encoding.m_Unicodes[charcode] = pUnicodes[charcode];
1580 } 1580 }
1581 } else { 1581 } else {
1582 m_Encoding.m_Unicodes[charcode] = charcode; 1582 m_Encoding.m_Unicodes[charcode] = charcode;
1583 } 1583 }
1584 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, m_Encodi ng.m_Unicodes[charcode]); 1584 m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, m_Encodi ng.m_Unicodes[charcode]);
1585 if (m_GlyphIndex[charcode]) { 1585 if (m_GlyphIndex[charcode]) {
(...skipping 10 matching lines...) Expand all
1596 } 1596 }
1597 CPDF_Type3Font::CPDF_Type3Font() : CPDF_SimpleFont(PDFFONT_TYPE3) 1597 CPDF_Type3Font::CPDF_Type3Font() : CPDF_SimpleFont(PDFFONT_TYPE3)
1598 { 1598 {
1599 m_pPageResources = NULL; 1599 m_pPageResources = NULL;
1600 FXSYS_memset32(m_CharWidthL, 0, sizeof m_CharWidthL); 1600 FXSYS_memset32(m_CharWidthL, 0, sizeof m_CharWidthL);
1601 } 1601 }
1602 CPDF_Type3Font::~CPDF_Type3Font() 1602 CPDF_Type3Font::~CPDF_Type3Font()
1603 { 1603 {
1604 FX_POSITION pos = m_CacheMap.GetStartPosition(); 1604 FX_POSITION pos = m_CacheMap.GetStartPosition();
1605 while (pos) { 1605 while (pos) {
1606 FX_LPVOID key, value; 1606 void* key;
1607 void* value;
1607 m_CacheMap.GetNextAssoc(pos, key, value); 1608 m_CacheMap.GetNextAssoc(pos, key, value);
1608 delete (CPDF_Type3Char*)value; 1609 delete (CPDF_Type3Char*)value;
1609 } 1610 }
1610 m_CacheMap.RemoveAll(); 1611 m_CacheMap.RemoveAll();
1611 pos = m_DeletedMap.GetStartPosition(); 1612 pos = m_DeletedMap.GetStartPosition();
1612 while (pos) { 1613 while (pos) {
1613 FX_LPVOID key, value; 1614 void* key;
1615 void* value;
1614 m_DeletedMap.GetNextAssoc(pos, key, value); 1616 m_DeletedMap.GetNextAssoc(pos, key, value);
1615 delete (CPDF_Type3Char*)key; 1617 delete (CPDF_Type3Char*)key;
1616 } 1618 }
1617 } 1619 }
1618 FX_BOOL CPDF_Type3Font::_Load() 1620 FX_BOOL CPDF_Type3Font::_Load()
1619 { 1621 {
1620 m_pFontResources = m_pFontDict->GetDict(FX_BSTRC("Resources")); 1622 m_pFontResources = m_pFontDict->GetDict(FX_BSTRC("Resources"));
1621 CPDF_Array* pMatrix = m_pFontDict->GetArray(FX_BSTRC("FontMatrix")); 1623 CPDF_Array* pMatrix = m_pFontDict->GetArray(FX_BSTRC("FontMatrix"));
1622 FX_FLOAT xscale = 1.0f, yscale = 1.0f; 1624 FX_FLOAT xscale = 1.0f, yscale = 1.0f;
1623 if (pMatrix) { 1625 if (pMatrix) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 void CPDF_Type3Font::CheckType3FontMetrics() 1666 void CPDF_Type3Font::CheckType3FontMetrics()
1665 { 1667 {
1666 CheckFontMetrics(); 1668 CheckFontMetrics();
1667 } 1669 }
1668 CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) 1670 CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level)
1669 { 1671 {
1670 if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_) { 1672 if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_) {
1671 return NULL; 1673 return NULL;
1672 } 1674 }
1673 CPDF_Type3Char* pChar = NULL; 1675 CPDF_Type3Char* pChar = NULL;
1674 if (m_CacheMap.Lookup((FX_LPVOID)(uintptr_t)charcode, (FX_LPVOID&)pChar)) { 1676 if (m_CacheMap.Lookup((void*)(uintptr_t)charcode, (void*&)pChar)) {
1675 if (pChar->m_bPageRequired && m_pPageResources) { 1677 if (pChar->m_bPageRequired && m_pPageResources) {
1676 delete pChar; 1678 delete pChar;
1677 m_CacheMap.RemoveKey((FX_LPVOID)(uintptr_t)charcode); 1679 m_CacheMap.RemoveKey((void*)(uintptr_t)charcode);
1678 return LoadChar(charcode, level + 1); 1680 return LoadChar(charcode, level + 1);
1679 } 1681 }
1680 return pChar; 1682 return pChar;
1681 } 1683 }
1682 FX_LPCSTR name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); 1684 const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcod e);
1683 if (name == NULL) { 1685 if (name == NULL) {
1684 return NULL; 1686 return NULL;
1685 } 1687 }
1686 CPDF_Stream* pStream = (CPDF_Stream*)(m_pCharProcs ? m_pCharProcs->GetElemen tValue(name) : NULL); 1688 CPDF_Stream* pStream = (CPDF_Stream*)(m_pCharProcs ? m_pCharProcs->GetElemen tValue(name) : NULL);
1687 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) { 1689 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) {
1688 return NULL; 1690 return NULL;
1689 } 1691 }
1690 pChar = new CPDF_Type3Char; 1692 pChar = new CPDF_Type3Char;
1691 pChar->m_pForm = new CPDF_Form(m_pDocument, m_pFontResources ? m_pFontResour ces : m_pPageResources, pStream, NULL); 1693 pChar->m_pForm = new CPDF_Form(m_pDocument, m_pFontResources ? m_pFontResour ces : m_pPageResources, pStream, NULL);
1692 pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1); 1694 pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1);
1693 FX_FLOAT scale = m_FontMatrix.GetXUnit(); 1695 FX_FLOAT scale = m_FontMatrix.GetXUnit();
1694 pChar->m_Width = (int32_t)(pChar->m_Width * scale + 0.5f); 1696 pChar->m_Width = (int32_t)(pChar->m_Width * scale + 0.5f);
1695 FX_RECT &rcBBox = pChar->m_BBox; 1697 FX_RECT &rcBBox = pChar->m_BBox;
1696 CFX_FloatRect char_rect((FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bo ttom / 1000.0f, 1698 CFX_FloatRect char_rect((FX_FLOAT)rcBBox.left / 1000.0f, (FX_FLOAT)rcBBox.bo ttom / 1000.0f,
1697 (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.t op / 1000.0f); 1699 (FX_FLOAT)rcBBox.right / 1000.0f, (FX_FLOAT)rcBBox.t op / 1000.0f);
1698 if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) { 1700 if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) {
1699 char_rect = pChar->m_pForm->CalcBoundingBox(); 1701 char_rect = pChar->m_pForm->CalcBoundingBox();
1700 } 1702 }
1701 char_rect.Transform(&m_FontMatrix); 1703 char_rect.Transform(&m_FontMatrix);
1702 rcBBox.left = FXSYS_round(char_rect.left * 1000); 1704 rcBBox.left = FXSYS_round(char_rect.left * 1000);
1703 rcBBox.right = FXSYS_round(char_rect.right * 1000); 1705 rcBBox.right = FXSYS_round(char_rect.right * 1000);
1704 rcBBox.top = FXSYS_round(char_rect.top * 1000); 1706 rcBBox.top = FXSYS_round(char_rect.top * 1000);
1705 rcBBox.bottom = FXSYS_round(char_rect.bottom * 1000); 1707 rcBBox.bottom = FXSYS_round(char_rect.bottom * 1000);
1706 m_CacheMap.SetAt((FX_LPVOID)(uintptr_t)charcode, pChar); 1708 m_CacheMap.SetAt((void*)(uintptr_t)charcode, pChar);
1707 if (pChar->m_pForm->CountObjects() == 0) { 1709 if (pChar->m_pForm->CountObjects() == 0) {
1708 delete pChar->m_pForm; 1710 delete pChar->m_pForm;
1709 pChar->m_pForm = NULL; 1711 pChar->m_pForm = NULL;
1710 } 1712 }
1711 return pChar; 1713 return pChar;
1712 } 1714 }
1713 int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) 1715 int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level)
1714 { 1716 {
1715 if (charcode > 0xff) { 1717 if (charcode > 0xff) {
1716 charcode = 0; 1718 charcode = 0;
(...skipping 25 matching lines...) Expand all
1742 } 1744 }
1743 CPDF_Type3Char::~CPDF_Type3Char() 1745 CPDF_Type3Char::~CPDF_Type3Char()
1744 { 1746 {
1745 if (m_pForm) { 1747 if (m_pForm) {
1746 delete m_pForm; 1748 delete m_pForm;
1747 } 1749 }
1748 if (m_pBitmap) { 1750 if (m_pBitmap) {
1749 delete m_pBitmap; 1751 delete m_pBitmap;
1750 } 1752 }
1751 } 1753 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/font_int.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698