OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../include/fpdfapi/fpdf_module.h" | 7 #include "../../../include/fpdfapi/fpdf_module.h" |
8 #include "../../../include/fpdfapi/fpdf_page.h" | 8 #include "../../../include/fpdfapi/fpdf_page.h" |
9 #include "font_int.h" | 9 #include "font_int.h" |
10 #include "../fpdf_cmaps/cmap_int.h" | 10 #include "../fpdf_cmaps/cmap_int.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 m_Status = 0; | 117 m_Status = 0; |
118 m_CodeSeq = 0; | 118 m_CodeSeq = 0; |
119 m_AddMaps.EstimateSize(0, 10240); | 119 m_AddMaps.EstimateSize(0, 10240); |
120 return TRUE; | 120 return TRUE; |
121 } | 121 } |
122 static FX_DWORD CMap_GetCode(FX_BSTR word) | 122 static FX_DWORD CMap_GetCode(FX_BSTR word) |
123 { | 123 { |
124 int num = 0; | 124 int num = 0; |
125 if (word.GetAt(0) == '<') { | 125 if (word.GetAt(0) == '<') { |
126 for (int i = 1; i < word.GetLength(); i ++) { | 126 for (int i = 1; i < word.GetLength(); i ++) { |
127 FX_BYTE digit = word.GetAt(i); | 127 uint8_t digit = word.GetAt(i); |
128 if (digit >= '0' && digit <= '9') { | 128 if (digit >= '0' && digit <= '9') { |
129 digit = digit - '0'; | 129 digit = digit - '0'; |
130 } else if (digit >= 'a' && digit <= 'f') { | 130 } else if (digit >= 'a' && digit <= 'f') { |
131 digit = digit - 'a' + 10; | 131 digit = digit - 'a' + 10; |
132 } else if (digit >= 'A' && digit <= 'F') { | 132 } else if (digit >= 'A' && digit <= 'F') { |
133 digit = digit - 'A' + 10; | 133 digit = digit - 'A' + 10; |
134 } else { | 134 } else { |
135 return num; | 135 return num; |
136 } | 136 } |
137 num = num * 16 + digit; | 137 num = num * 16 + digit; |
(...skipping 16 matching lines...) Expand all Loading... |
154 int i; | 154 int i; |
155 for (i = 1; i < first.GetLength(); i ++) | 155 for (i = 1; i < first.GetLength(); i ++) |
156 if (first.GetAt(i) == '>') { | 156 if (first.GetAt(i) == '>') { |
157 break; | 157 break; |
158 } | 158 } |
159 range.m_CharSize = (i - 1) / 2; | 159 range.m_CharSize = (i - 1) / 2; |
160 if (range.m_CharSize > 4) { | 160 if (range.m_CharSize > 4) { |
161 return FALSE; | 161 return FALSE; |
162 } | 162 } |
163 for (i = 0; i < range.m_CharSize; i ++) { | 163 for (i = 0; i < range.m_CharSize; i ++) { |
164 FX_BYTE digit1 = first.GetAt(i * 2 + 1); | 164 uint8_t digit1 = first.GetAt(i * 2 + 1); |
165 FX_BYTE digit2 = first.GetAt(i * 2 + 2); | 165 uint8_t digit2 = first.GetAt(i * 2 + 2); |
166 FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((dig
it1 & 0xdf) - 'A' + 10); | 166 uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((dig
it1 & 0xdf) - 'A' + 10); |
167 byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') :
((digit2 & 0xdf) - 'A' + 10)); | 167 byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') :
((digit2 & 0xdf) - 'A' + 10)); |
168 range.m_Lower[i] = byte; | 168 range.m_Lower[i] = byte; |
169 } | 169 } |
170 FX_DWORD size = second.GetLength(); | 170 FX_DWORD size = second.GetLength(); |
171 for (i = 0; i < range.m_CharSize; i ++) { | 171 for (i = 0; i < range.m_CharSize; i ++) { |
172 FX_BYTE digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE
)i * 2 + 1) : 0; | 172 uint8_t digit1 = ((FX_DWORD)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE
)i * 2 + 1) : 0; |
173 FX_BYTE digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE
)i * 2 + 2) : 0; | 173 uint8_t digit2 = ((FX_DWORD)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE
)i * 2 + 2) : 0; |
174 FX_BYTE byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((dig
it1 & 0xdf) - 'A' + 10); | 174 uint8_t byte = (digit1 >= '0' && digit1 <= '9') ? (digit1 - '0') : ((dig
it1 & 0xdf) - 'A' + 10); |
175 byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') :
((digit2 & 0xdf) - 'A' + 10)); | 175 byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') :
((digit2 & 0xdf) - 'A' + 10)); |
176 range.m_Upper[i] = byte; | 176 range.m_Upper[i] = byte; |
177 } | 177 } |
178 return TRUE; | 178 return TRUE; |
179 } | 179 } |
180 static CFX_ByteString CMap_GetString(FX_BSTR word) | 180 static CFX_ByteString CMap_GetString(FX_BSTR word) |
181 { | 181 { |
182 return word.Mid(1, word.GetLength() - 2); | 182 return word.Mid(1, word.GetLength() - 2); |
183 } | 183 } |
184 void CPDF_CMapParser::ParseWord(FX_BSTR word) | 184 void CPDF_CMapParser::ParseWord(FX_BSTR word) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 m_Status = 0; | 247 m_Status = 0; |
248 } else if (m_Status == 6) { | 248 } else if (m_Status == 6) { |
249 m_pCMap->m_bVertical = CMap_GetCode(word); | 249 m_pCMap->m_bVertical = CMap_GetCode(word); |
250 m_Status = 0; | 250 m_Status = 0; |
251 } else if (m_Status == 7) { | 251 } else if (m_Status == 7) { |
252 if (word == FX_BSTRC("endcodespacerange")) { | 252 if (word == FX_BSTRC("endcodespacerange")) { |
253 int nSegs = m_CodeRanges.GetSize(); | 253 int nSegs = m_CodeRanges.GetSize(); |
254 if (nSegs > 1) { | 254 if (nSegs > 1) { |
255 m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes; | 255 m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes; |
256 m_pCMap->m_nCodeRanges = nSegs; | 256 m_pCMap->m_nCodeRanges = nSegs; |
257 m_pCMap->m_pLeadingBytes = FX_Alloc2D(FX_BYTE, nSegs, sizeof(_CM
ap_CodeRange)); | 257 m_pCMap->m_pLeadingBytes = FX_Alloc2D(uint8_t, nSegs, sizeof(_CM
ap_CodeRange)); |
258 FXSYS_memcpy32(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(),
nSegs * sizeof(_CMap_CodeRange)); | 258 FXSYS_memcpy32(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(),
nSegs * sizeof(_CMap_CodeRange)); |
259 } else if (nSegs == 1) { | 259 } else if (nSegs == 1) { |
260 m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CP
DF_CMap::TwoBytes : CPDF_CMap::OneByte; | 260 m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CP
DF_CMap::TwoBytes : CPDF_CMap::OneByte; |
261 } | 261 } |
262 m_Status = 0; | 262 m_Status = 0; |
263 } else { | 263 } else { |
264 if (word.GetLength() == 0 || word.GetAt(0) != '<') { | 264 if (word.GetLength() == 0 || word.GetAt(0) != '<') { |
265 return; | 265 return; |
266 } | 266 } |
267 if (m_CodeSeq % 2) { | 267 if (m_CodeSeq % 2) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 if (cmapid == CFX_ByteStringC(g_PredefinedCMaps[index].m_pName)) { | 369 if (cmapid == CFX_ByteStringC(g_PredefinedCMaps[index].m_pName)) { |
370 break; | 370 break; |
371 } | 371 } |
372 index ++; | 372 index ++; |
373 } | 373 } |
374 const CPDF_PredefinedCMap& map = g_PredefinedCMaps[index]; | 374 const CPDF_PredefinedCMap& map = g_PredefinedCMaps[index]; |
375 m_Charset = map.m_Charset; | 375 m_Charset = map.m_Charset; |
376 m_Coding = map.m_Coding; | 376 m_Coding = map.m_Coding; |
377 m_CodingScheme = map.m_CodingScheme; | 377 m_CodingScheme = map.m_CodingScheme; |
378 if (m_CodingScheme == MixedTwoBytes) { | 378 if (m_CodingScheme == MixedTwoBytes) { |
379 m_pLeadingBytes = FX_Alloc(FX_BYTE, 256); | 379 m_pLeadingBytes = FX_Alloc(uint8_t, 256); |
380 for (FX_DWORD i = 0; i < map.m_LeadingSegCount; i ++) { | 380 for (FX_DWORD i = 0; i < map.m_LeadingSegCount; i ++) { |
381 for (int b = map.m_LeadingSegs[i * 2]; b <= map.m_LeadingSegs[i * 2
+ 1]; b ++) { | 381 for (int b = map.m_LeadingSegs[i * 2]; b <= map.m_LeadingSegs[i * 2
+ 1]; b ++) { |
382 m_pLeadingBytes[b] = 1; | 382 m_pLeadingBytes[b] = 1; |
383 } | 383 } |
384 } | 384 } |
385 } | 385 } |
386 FPDFAPI_FindEmbeddedCMap(pName, m_Charset, m_Coding, m_pEmbedMap); | 386 FPDFAPI_FindEmbeddedCMap(pName, m_Charset, m_Coding, m_pEmbedMap); |
387 if (m_pEmbedMap) { | 387 if (m_pEmbedMap) { |
388 m_bLoaded = TRUE; | 388 m_bLoaded = TRUE; |
389 return TRUE; | 389 return TRUE; |
(...skipping 13 matching lines...) Expand all Loading... |
403 parser.Initialize(this); | 403 parser.Initialize(this); |
404 CPDF_SimpleParser syntax(pData, size); | 404 CPDF_SimpleParser syntax(pData, size); |
405 while (1) { | 405 while (1) { |
406 CFX_ByteStringC word = syntax.GetWord(); | 406 CFX_ByteStringC word = syntax.GetWord(); |
407 if (word.IsEmpty()) { | 407 if (word.IsEmpty()) { |
408 break; | 408 break; |
409 } | 409 } |
410 parser.ParseWord(word); | 410 parser.ParseWord(word); |
411 } | 411 } |
412 if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) { | 412 if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) { |
413 m_pAddMapping = FX_Alloc(FX_BYTE, parser.m_AddMaps.GetSize() + 4); | 413 m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4); |
414 *(FX_DWORD*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; | 414 *(FX_DWORD*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; |
415 FXSYS_memcpy32(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m
_AddMaps.GetSize()); | 415 FXSYS_memcpy32(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m
_AddMaps.GetSize()); |
416 FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, compar
e_dword); | 416 FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, compar
e_dword); |
417 } | 417 } |
418 return TRUE; | 418 return TRUE; |
419 } | 419 } |
420 extern "C" { | 420 extern "C" { |
421 static int compareCID(const void* key, const void* element) | 421 static int compareCID(const void* key, const void* element) |
422 { | 422 { |
423 if ((*(FX_DWORD*)key) < (*(FX_DWORD*)element)) { | 423 if ((*(FX_DWORD*)key) < (*(FX_DWORD*)element)) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 } | 493 } |
494 FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) con
st | 494 FX_DWORD CPDF_CMap::GetNextChar(FX_LPCSTR pString, int nStrLen, int& offset) con
st |
495 { | 495 { |
496 switch (m_CodingScheme) { | 496 switch (m_CodingScheme) { |
497 case OneByte: | 497 case OneByte: |
498 return ((FX_LPBYTE)pString)[offset++]; | 498 return ((FX_LPBYTE)pString)[offset++]; |
499 case TwoBytes: | 499 case TwoBytes: |
500 offset += 2; | 500 offset += 2; |
501 return ((FX_LPBYTE)pString)[offset - 2] * 256 + ((FX_LPBYTE)pString)
[offset - 1]; | 501 return ((FX_LPBYTE)pString)[offset - 2] * 256 + ((FX_LPBYTE)pString)
[offset - 1]; |
502 case MixedTwoBytes: { | 502 case MixedTwoBytes: { |
503 FX_BYTE byte1 = ((FX_LPBYTE)pString)[offset++]; | 503 uint8_t byte1 = ((FX_LPBYTE)pString)[offset++]; |
504 if (!m_pLeadingBytes[byte1]) { | 504 if (!m_pLeadingBytes[byte1]) { |
505 return byte1; | 505 return byte1; |
506 } | 506 } |
507 FX_BYTE byte2 = ((FX_LPBYTE)pString)[offset++]; | 507 uint8_t byte2 = ((FX_LPBYTE)pString)[offset++]; |
508 return byte1 * 256 + byte2; | 508 return byte1 * 256 + byte2; |
509 } | 509 } |
510 case MixedFourBytes: { | 510 case MixedFourBytes: { |
511 FX_BYTE codes[4]; | 511 uint8_t codes[4]; |
512 int char_size = 1; | 512 int char_size = 1; |
513 codes[0] = ((FX_LPBYTE)pString)[offset++]; | 513 codes[0] = ((FX_LPBYTE)pString)[offset++]; |
514 _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; | 514 _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; |
515 while (1) { | 515 while (1) { |
516 int ret = _CheckCodeRange(codes, char_size, pRanges, m_nCode
Ranges); | 516 int ret = _CheckCodeRange(codes, char_size, pRanges, m_nCode
Ranges); |
517 if (ret == 0) { | 517 if (ret == 0) { |
518 return 0; | 518 return 0; |
519 } | 519 } |
520 if (ret == 2) { | 520 if (ret == 2) { |
521 FX_DWORD charcode = 0; | 521 FX_DWORD charcode = 0; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 return count; | 582 return count; |
583 } | 583 } |
584 } | 584 } |
585 return size; | 585 return size; |
586 } | 586 } |
587 int _GetCharSize(FX_DWORD charcode, _CMap_CodeRange* pRanges, int iRangesSize) | 587 int _GetCharSize(FX_DWORD charcode, _CMap_CodeRange* pRanges, int iRangesSize) |
588 { | 588 { |
589 if (!iRangesSize) { | 589 if (!iRangesSize) { |
590 return 1; | 590 return 1; |
591 } | 591 } |
592 FX_BYTE codes[4]; | 592 uint8_t codes[4]; |
593 codes[0] = codes[1] = 0x00; | 593 codes[0] = codes[1] = 0x00; |
594 codes[2] = (FX_BYTE)(charcode >> 8 & 0xFF); | 594 codes[2] = (uint8_t)(charcode >> 8 & 0xFF); |
595 codes[3] = (FX_BYTE)charcode; | 595 codes[3] = (uint8_t)charcode; |
596 int offset = 0, size = 4; | 596 int offset = 0, size = 4; |
597 for (int i = 0; i < 4; ++i) { | 597 for (int i = 0; i < 4; ++i) { |
598 int iSeg = iRangesSize - 1; | 598 int iSeg = iRangesSize - 1; |
599 while (iSeg >= 0) { | 599 while (iSeg >= 0) { |
600 if (pRanges[iSeg].m_CharSize < size) { | 600 if (pRanges[iSeg].m_CharSize < size) { |
601 iSeg --; | 601 iSeg --; |
602 continue; | 602 continue; |
603 } | 603 } |
604 int iChar = 0; | 604 int iChar = 0; |
605 while (iChar < size) { | 605 while (iChar < size) { |
(...skipping 10 matching lines...) Expand all Loading... |
616 } | 616 } |
617 size --; | 617 size --; |
618 offset ++; | 618 offset ++; |
619 } | 619 } |
620 return 1; | 620 return 1; |
621 } | 621 } |
622 int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const | 622 int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const |
623 { | 623 { |
624 switch (m_CodingScheme) { | 624 switch (m_CodingScheme) { |
625 case OneByte: | 625 case OneByte: |
626 str[0] = (FX_BYTE)charcode; | 626 str[0] = (uint8_t)charcode; |
627 return 1; | 627 return 1; |
628 case TwoBytes: | 628 case TwoBytes: |
629 str[0] = (FX_BYTE)(charcode / 256); | 629 str[0] = (uint8_t)(charcode / 256); |
630 str[1] = (FX_BYTE)(charcode % 256); | 630 str[1] = (uint8_t)(charcode % 256); |
631 return 2; | 631 return 2; |
632 case MixedTwoBytes: | 632 case MixedTwoBytes: |
633 case MixedFourBytes: | 633 case MixedFourBytes: |
634 if (charcode < 0x100) { | 634 if (charcode < 0x100) { |
635 _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; | 635 _CMap_CodeRange* pRanges = (_CMap_CodeRange*)m_pLeadingBytes; |
636 int iSize = _GetCharSize(charcode, pRanges, m_nCodeRanges); | 636 int iSize = _GetCharSize(charcode, pRanges, m_nCodeRanges); |
637 if (iSize == 0) { | 637 if (iSize == 0) { |
638 iSize = 1; | 638 iSize = 1; |
639 } | 639 } |
640 if (iSize > 1) { | 640 if (iSize > 1) { |
641 FXSYS_memset32(str, 0, sizeof(FX_BYTE) * iSize); | 641 FXSYS_memset32(str, 0, sizeof(uint8_t) * iSize); |
642 } | 642 } |
643 str[iSize - 1] = (FX_BYTE)charcode; | 643 str[iSize - 1] = (uint8_t)charcode; |
644 return iSize; | 644 return iSize; |
645 } else if (charcode < 0x10000) { | 645 } else if (charcode < 0x10000) { |
646 str[0] = (FX_BYTE)(charcode >> 8); | 646 str[0] = (uint8_t)(charcode >> 8); |
647 str[1] = (FX_BYTE)charcode; | 647 str[1] = (uint8_t)charcode; |
648 return 2; | 648 return 2; |
649 } else if (charcode < 0x1000000) { | 649 } else if (charcode < 0x1000000) { |
650 str[0] = (FX_BYTE)(charcode >> 16); | 650 str[0] = (uint8_t)(charcode >> 16); |
651 str[1] = (FX_BYTE)(charcode >> 8); | 651 str[1] = (uint8_t)(charcode >> 8); |
652 str[2] = (FX_BYTE)charcode; | 652 str[2] = (uint8_t)charcode; |
653 return 3; | 653 return 3; |
654 } else { | 654 } else { |
655 str[0] = (FX_BYTE)(charcode >> 24); | 655 str[0] = (uint8_t)(charcode >> 24); |
656 str[1] = (FX_BYTE)(charcode >> 16); | 656 str[1] = (uint8_t)(charcode >> 16); |
657 str[2] = (FX_BYTE)(charcode >> 8); | 657 str[2] = (uint8_t)(charcode >> 8); |
658 str[3] = (FX_BYTE)charcode; | 658 str[3] = (uint8_t)charcode; |
659 return 4; | 659 return 4; |
660 } | 660 } |
661 } | 661 } |
662 return 0; | 662 return 0; |
663 } | 663 } |
664 CPDF_CID2UnicodeMap::CPDF_CID2UnicodeMap() | 664 CPDF_CID2UnicodeMap::CPDF_CID2UnicodeMap() |
665 { | 665 { |
666 m_EmbeddedCount = 0; | 666 m_EmbeddedCount = 0; |
667 } | 667 } |
668 CPDF_CID2UnicodeMap::~CPDF_CID2UnicodeMap() | 668 CPDF_CID2UnicodeMap::~CPDF_CID2UnicodeMap() |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 break; | 830 break; |
831 } | 831 } |
832 } | 832 } |
833 | 833 |
834 if (unicode < 0x80) { | 834 if (unicode < 0x80) { |
835 return static_cast<FX_DWORD>(unicode); | 835 return static_cast<FX_DWORD>(unicode); |
836 } else if (m_pCMap->m_Coding == CIDCODING_CID) { | 836 } else if (m_pCMap->m_Coding == CIDCODING_CID) { |
837 return 0; | 837 return 0; |
838 } | 838 } |
839 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 839 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
840 FX_BYTE buffer[32]; | 840 uint8_t buffer[32]; |
841 int ret = FXSYS_WideCharToMultiByte(g_CharsetCPs[m_pCMap->m_Coding], 0, &uni
code, 1, (char*)buffer, 4, NULL, NULL); | 841 int ret = FXSYS_WideCharToMultiByte(g_CharsetCPs[m_pCMap->m_Coding], 0, &uni
code, 1, (char*)buffer, 4, NULL, NULL); |
842 if (ret == 1) { | 842 if (ret == 1) { |
843 return buffer[0]; | 843 return buffer[0]; |
844 } else if (ret == 2) { | 844 } else if (ret == 2) { |
845 return buffer[0] * 256 + buffer[1]; | 845 return buffer[0] * 256 + buffer[1]; |
846 } | 846 } |
847 return 0; | 847 return 0; |
848 #endif | 848 #endif |
849 if (m_pCMap->m_pEmbedMap) { | 849 if (m_pCMap->m_pEmbedMap) { |
850 return _EmbeddedCharcodeFromUnicode(m_pCMap->m_pEmbedMap, m_pCMap->m_Cha
rset, unicode); | 850 return _EmbeddedCharcodeFromUnicode(m_pCMap->m_pEmbedMap, m_pCMap->m_Cha
rset, unicode); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 if (pDefaultArray) { | 983 if (pDefaultArray) { |
984 m_DefaultVY = pDefaultArray->GetInteger(0); | 984 m_DefaultVY = pDefaultArray->GetInteger(0); |
985 m_DefaultW1 = pDefaultArray->GetInteger(1); | 985 m_DefaultW1 = pDefaultArray->GetInteger(1); |
986 } else { | 986 } else { |
987 m_DefaultVY = 880; | 987 m_DefaultVY = 880; |
988 m_DefaultW1 = -1000; | 988 m_DefaultW1 = -1000; |
989 } | 989 } |
990 } | 990 } |
991 return TRUE; | 991 return TRUE; |
992 } | 992 } |
993 FX_FLOAT _CIDTransformToFloat(FX_BYTE ch) | 993 FX_FLOAT _CIDTransformToFloat(uint8_t ch) |
994 { | 994 { |
995 if (ch < 128) { | 995 if (ch < 128) { |
996 return ch * 1.0f / 127; | 996 return ch * 1.0f / 127; |
997 } | 997 } |
998 return (-255 + ch) * 1.0f / 127; | 998 return (-255 + ch) * 1.0f / 127; |
999 } | 999 } |
1000 void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) | 1000 void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) |
1001 { | 1001 { |
1002 if (charcode < 256 && m_CharBBox[charcode].Right != -1) { | 1002 if (charcode < 256 && m_CharBBox[charcode].Right != -1) { |
1003 rect.bottom = m_CharBBox[charcode].Bottom; | 1003 rect.bottom = m_CharBBox[charcode].Bottom; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 if (pVertGlyph) { | 1143 if (pVertGlyph) { |
1144 *pVertGlyph = TRUE; | 1144 *pVertGlyph = TRUE; |
1145 } | 1145 } |
1146 } | 1146 } |
1147 return index; | 1147 return index; |
1148 } | 1148 } |
1149 if (NULL == m_Font.m_pGsubData) { | 1149 if (NULL == m_Font.m_pGsubData) { |
1150 unsigned long length = 0; | 1150 unsigned long length = 0; |
1151 int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S
', 'U', 'B'), 0, NULL, &length); | 1151 int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S
', 'U', 'B'), 0, NULL, &length); |
1152 if (!error) { | 1152 if (!error) { |
1153 m_Font.m_pGsubData = (unsigned char*)FX_Alloc(FX_BYTE, length); | 1153 m_Font.m_pGsubData = (unsigned char*)FX_Alloc(uint8_t, length); |
1154 } | 1154 } |
1155 } | 1155 } |
1156 int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', '
U', 'B'), 0, m_Font.m_pGsubData, NULL); | 1156 int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', '
U', 'B'), 0, m_Font.m_pGsubData, NULL); |
1157 if (!error && m_Font.m_pGsubData) { | 1157 if (!error && m_Font.m_pGsubData) { |
1158 m_pTTGSUBTable = new CFX_CTTGSUBTable; | 1158 m_pTTGSUBTable = new CFX_CTTGSUBTable; |
1159 m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.m_pGsubData); | 1159 m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.m_pGsubData); |
1160 TT_uint32_t vindex = 0; | 1160 TT_uint32_t vindex = 0; |
1161 m_pTTGSUBTable->GetVerticalGlyph(index, &vindex); | 1161 m_pTTGSUBTable->GetVerticalGlyph(index, &vindex); |
1162 if (vindex) { | 1162 if (vindex) { |
1163 index = vindex; | 1163 index = vindex; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 CheckFontMetrics(); | 1414 CheckFontMetrics(); |
1415 m_DefaultWidth = 1000; | 1415 m_DefaultWidth = 1000; |
1416 m_pAnsiWidths = FX_Alloc(FX_WORD, 128); | 1416 m_pAnsiWidths = FX_Alloc(FX_WORD, 128); |
1417 for (int i = 32; i < 127; i ++) { | 1417 for (int i = 32; i < 127; i ++) { |
1418 m_pAnsiWidths[i] = 500; | 1418 m_pAnsiWidths[i] = 500; |
1419 } | 1419 } |
1420 return TRUE; | 1420 return TRUE; |
1421 } | 1421 } |
1422 const struct _CIDTransform { | 1422 const struct _CIDTransform { |
1423 FX_WORD CID; | 1423 FX_WORD CID; |
1424 FX_BYTE» » a, b, c, d, e, f; | 1424 uint8_t» » a, b, c, d, e, f; |
1425 } | 1425 } |
1426 Japan1_VertCIDs[] = { | 1426 Japan1_VertCIDs[] = { |
1427 {97, 129, 0, 0, 127, 55, 0}, | 1427 {97, 129, 0, 0, 127, 55, 0}, |
1428 {7887, 127, 0, 0, 127, 76, 89}, | 1428 {7887, 127, 0, 0, 127, 76, 89}, |
1429 {7888, 127, 0, 0, 127, 79, 94}, | 1429 {7888, 127, 0, 0, 127, 79, 94}, |
1430 {7889, 0, 129, 127, 0, 17, 127}, | 1430 {7889, 0, 129, 127, 0, 17, 127}, |
1431 {7890, 0, 129, 127, 0, 17, 127}, | 1431 {7890, 0, 129, 127, 0, 17, 127}, |
1432 {7891, 0, 129, 127, 0, 17, 127}, | 1432 {7891, 0, 129, 127, 0, 17, 127}, |
1433 {7892, 0, 129, 127, 0, 17, 127}, | 1433 {7892, 0, 129, 127, 0, 17, 127}, |
1434 {7893, 0, 129, 127, 0, 17, 127}, | 1434 {7893, 0, 129, 127, 0, 17, 127}, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 if (middlecode > CID) { | 1592 if (middlecode > CID) { |
1593 end = middle - 1; | 1593 end = middle - 1; |
1594 } else if (middlecode < CID) { | 1594 } else if (middlecode < CID) { |
1595 begin = middle + 1; | 1595 begin = middle + 1; |
1596 } else { | 1596 } else { |
1597 return &Japan1_VertCIDs[middle].a; | 1597 return &Japan1_VertCIDs[middle].a; |
1598 } | 1598 } |
1599 } | 1599 } |
1600 return NULL; | 1600 return NULL; |
1601 } | 1601 } |
OLD | NEW |