OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" | 7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 default: | 182 default: |
183 encoding = FXFT_ENCODING_UNICODE; | 183 encoding = FXFT_ENCODING_UNICODE; |
184 } | 184 } |
185 int err = FXFT_Select_Charmap(face, encoding); | 185 int err = FXFT_Select_Charmap(face, encoding); |
186 if (err) | 186 if (err) |
187 err = FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE); | 187 err = FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE); |
188 if (err && FXFT_Get_Face_Charmaps(face)) | 188 if (err && FXFT_Get_Face_Charmaps(face)) |
189 FXFT_Set_Charmap(face, *FXFT_Get_Face_Charmaps(face)); | 189 FXFT_Set_Charmap(face, *FXFT_Get_Face_Charmaps(face)); |
190 } | 190 } |
191 | 191 |
| 192 bool IsMetricForCID(const uint32_t* pEntry, uint16_t CID) { |
| 193 return pEntry[0] <= CID && pEntry[1] >= CID; |
| 194 } |
| 195 |
192 } // namespace | 196 } // namespace |
193 | 197 |
194 CPDF_CIDFont::CPDF_CIDFont() | 198 CPDF_CIDFont::CPDF_CIDFont() |
195 : m_pCMap(nullptr), | 199 : m_pCMap(nullptr), |
196 m_pCID2UnicodeMap(nullptr), | 200 m_pCID2UnicodeMap(nullptr), |
197 m_bCIDIsGID(FALSE), | 201 m_bCIDIsGID(false), |
198 m_bAnsiWidthsFixed(false), | 202 m_bAnsiWidthsFixed(false), |
199 m_bAdobeCourierStd(FALSE) {} | 203 m_bAdobeCourierStd(false) { |
| 204 for (size_t i = 0; i < FX_ArraySize(m_CharBBox); ++i) |
| 205 m_CharBBox[i] = FX_RECT(-1, -1, -1, -1); |
| 206 } |
200 | 207 |
201 CPDF_CIDFont::~CPDF_CIDFont() {} | 208 CPDF_CIDFont::~CPDF_CIDFont() {} |
202 | 209 |
203 bool CPDF_CIDFont::IsCIDFont() const { | 210 bool CPDF_CIDFont::IsCIDFont() const { |
204 return true; | 211 return true; |
205 } | 212 } |
206 | 213 |
207 const CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() const { | 214 const CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() const { |
208 return this; | 215 return this; |
209 } | 216 } |
210 | 217 |
211 CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() { | 218 CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() { |
212 return this; | 219 return this; |
213 } | 220 } |
214 | 221 |
215 uint16_t CPDF_CIDFont::CIDFromCharCode(uint32_t charcode) const { | 222 uint16_t CPDF_CIDFont::CIDFromCharCode(uint32_t charcode) const { |
216 if (!m_pCMap) { | 223 return m_pCMap ? m_pCMap->CIDFromCharCode(charcode) |
217 return (uint16_t)charcode; | 224 : static_cast<uint16_t>(charcode); |
218 } | |
219 return m_pCMap->CIDFromCharCode(charcode); | |
220 } | 225 } |
221 | 226 |
222 FX_BOOL CPDF_CIDFont::IsVertWriting() const { | 227 FX_BOOL CPDF_CIDFont::IsVertWriting() const { |
223 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE; | 228 return m_pCMap && m_pCMap->IsVertWriting(); |
224 } | 229 } |
225 | 230 |
226 CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const { | 231 CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const { |
227 CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode); | 232 CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode); |
228 if (!str.IsEmpty()) | 233 if (!str.IsEmpty()) |
229 return str; | 234 return str; |
230 FX_WCHAR ret = GetUnicodeFromCharCode(charcode); | 235 FX_WCHAR ret = GetUnicodeFromCharCode(charcode); |
231 return ret ? ret : CFX_WideString(); | 236 return ret ? ret : CFX_WideString(); |
232 } | 237 } |
233 | 238 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 CPDF_Dictionary* pCIDFontDict = pFonts->GetDictAt(0); | 334 CPDF_Dictionary* pCIDFontDict = pFonts->GetDictAt(0); |
330 if (!pCIDFontDict) | 335 if (!pCIDFontDict) |
331 return FALSE; | 336 return FALSE; |
332 | 337 |
333 m_BaseFont = pCIDFontDict->GetStringBy("BaseFont"); | 338 m_BaseFont = pCIDFontDict->GetStringBy("BaseFont"); |
334 if ((m_BaseFont.Compare("CourierStd") == 0 || | 339 if ((m_BaseFont.Compare("CourierStd") == 0 || |
335 m_BaseFont.Compare("CourierStd-Bold") == 0 || | 340 m_BaseFont.Compare("CourierStd-Bold") == 0 || |
336 m_BaseFont.Compare("CourierStd-BoldOblique") == 0 || | 341 m_BaseFont.Compare("CourierStd-BoldOblique") == 0 || |
337 m_BaseFont.Compare("CourierStd-Oblique") == 0) && | 342 m_BaseFont.Compare("CourierStd-Oblique") == 0) && |
338 !IsEmbedded()) { | 343 !IsEmbedded()) { |
339 m_bAdobeCourierStd = TRUE; | 344 m_bAdobeCourierStd = true; |
340 } | 345 } |
341 CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDictBy("FontDescriptor"); | 346 CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDictBy("FontDescriptor"); |
342 if (pFontDesc) | 347 if (pFontDesc) |
343 LoadFontDescriptor(pFontDesc); | 348 LoadFontDescriptor(pFontDesc); |
344 | 349 |
345 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding"); | 350 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding"); |
346 if (!pEncoding) | 351 if (!pEncoding) |
347 return FALSE; | 352 return FALSE; |
348 | 353 |
349 CFX_ByteString subtype = pCIDFontDict->GetStringBy("Subtype"); | 354 CFX_ByteString subtype = pCIDFontDict->GetStringBy("Subtype"); |
350 m_bType1 = (subtype == "CIDFontType0"); | 355 m_bType1 = (subtype == "CIDFontType0"); |
351 | 356 |
352 CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager; | 357 CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager; |
353 if (pEncoding->IsName()) { | 358 if (pEncoding->IsName()) { |
354 CFX_ByteString cmap = pEncoding->GetString(); | 359 CFX_ByteString cmap = pEncoding->GetString(); |
355 bool bPromptCJK = m_pFontFile && m_bType1; | 360 bool bPromptCJK = m_pFontFile && m_bType1; |
356 m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK); | 361 m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK); |
| 362 if (!m_pCMap) |
| 363 return FALSE; |
357 } else if (CPDF_Stream* pStream = pEncoding->AsStream()) { | 364 } else if (CPDF_Stream* pStream = pEncoding->AsStream()) { |
358 m_pCMap = new CPDF_CMap; | 365 m_pCMap = new CPDF_CMap; |
359 m_pAllocatedCMap.reset(m_pCMap); | 366 m_pAllocatedCMap.reset(m_pCMap); |
360 CPDF_StreamAcc acc; | 367 CPDF_StreamAcc acc; |
361 acc.LoadAllData(pStream, FALSE); | 368 acc.LoadAllData(pStream, FALSE); |
362 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize()); | 369 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize()); |
363 } else { | 370 } else { |
364 return FALSE; | 371 return FALSE; |
365 } | 372 } |
366 if (!m_pCMap) | |
367 return FALSE; | |
368 | 373 |
369 m_Charset = m_pCMap->m_Charset; | 374 m_Charset = m_pCMap->m_Charset; |
370 if (m_Charset == CIDSET_UNKNOWN) { | 375 if (m_Charset == CIDSET_UNKNOWN) { |
371 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictBy("CIDSystemInfo"); | 376 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictBy("CIDSystemInfo"); |
372 if (pCIDInfo) { | 377 if (pCIDInfo) { |
373 m_Charset = | 378 m_Charset = |
374 CharsetFromOrdering(pCIDInfo->GetStringBy("Ordering").AsStringC()); | 379 CharsetFromOrdering(pCIDInfo->GetStringBy("Ordering").AsStringC()); |
375 } | 380 } |
376 } | 381 } |
377 if (m_Charset != CIDSET_UNKNOWN) { | 382 if (m_Charset != CIDSET_UNKNOWN) { |
(...skipping 16 matching lines...) Expand all Loading... |
394 | 399 |
395 if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) { | 400 if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) { |
396 CPDF_Object* pmap = pCIDFontDict->GetDirectObjectBy("CIDToGIDMap"); | 401 CPDF_Object* pmap = pCIDFontDict->GetDirectObjectBy("CIDToGIDMap"); |
397 if (pmap) { | 402 if (pmap) { |
398 if (CPDF_Stream* pStream = pmap->AsStream()) { | 403 if (CPDF_Stream* pStream = pmap->AsStream()) { |
399 m_pStreamAcc.reset(new CPDF_StreamAcc); | 404 m_pStreamAcc.reset(new CPDF_StreamAcc); |
400 m_pStreamAcc->LoadAllData(pStream, FALSE); | 405 m_pStreamAcc->LoadAllData(pStream, FALSE); |
401 } else if (pmap->GetString() == "Identity") { | 406 } else if (pmap->GetString() == "Identity") { |
402 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 407 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
403 if (m_pFontFile) { | 408 if (m_pFontFile) { |
404 m_bCIDIsGID = TRUE; | 409 m_bCIDIsGID = true; |
405 } | 410 } |
406 #else | 411 #else |
407 m_bCIDIsGID = TRUE; | 412 m_bCIDIsGID = true; |
408 #endif | 413 #endif |
409 } | 414 } |
410 } | 415 } |
411 } | 416 } |
412 | 417 |
413 CheckFontMetrics(); | 418 CheckFontMetrics(); |
414 if (IsVertWriting()) { | 419 if (IsVertWriting()) { |
415 pWidthArray = pCIDFontDict->GetArrayBy("W2"); | 420 pWidthArray = pCIDFontDict->GetArrayBy("W2"); |
416 if (pWidthArray) { | 421 if (pWidthArray) { |
417 LoadMetricsArray(pWidthArray, m_VertMetrics, 3); | 422 LoadMetricsArray(pWidthArray, m_VertMetrics, 3); |
418 } | 423 } |
419 CPDF_Array* pDefaultArray = pCIDFontDict->GetArrayBy("DW2"); | 424 CPDF_Array* pDefaultArray = pCIDFontDict->GetArrayBy("DW2"); |
420 if (pDefaultArray) { | 425 if (pDefaultArray) { |
421 m_DefaultVY = pDefaultArray->GetIntegerAt(0); | 426 m_DefaultVY = pDefaultArray->GetIntegerAt(0); |
422 m_DefaultW1 = pDefaultArray->GetIntegerAt(1); | 427 m_DefaultW1 = pDefaultArray->GetIntegerAt(1); |
423 } else { | 428 } else { |
424 m_DefaultVY = 880; | 429 m_DefaultVY = 880; |
425 m_DefaultW1 = -1000; | 430 m_DefaultW1 = -1000; |
426 } | 431 } |
427 } | 432 } |
428 return TRUE; | 433 return TRUE; |
429 } | 434 } |
430 | 435 |
431 FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode, int level) { | 436 FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode, int level) { |
432 if (charcode < 256 && m_CharBBox[charcode].right != FX_SMALL_RECT::kInvalid) | 437 if (charcode < 256 && m_CharBBox[charcode].right != -1) |
433 return FX_RECT(m_CharBBox[charcode]); | 438 return m_CharBBox[charcode]; |
434 | 439 |
435 FX_RECT rect; | 440 FX_RECT rect; |
436 bool bVert = false; | 441 bool bVert = false; |
437 int glyph_index = GlyphFromCharCode(charcode, &bVert); | 442 int glyph_index = GlyphFromCharCode(charcode, &bVert); |
438 FXFT_Face face = m_Font.GetFace(); | 443 FXFT_Face face = m_Font.GetFace(); |
439 if (face) { | 444 if (face) { |
440 if (FXFT_Is_Face_Tricky(face)) { | 445 if (FXFT_Is_Face_Tricky(face)) { |
441 int err = FXFT_Load_Glyph(face, glyph_index, | 446 int err = FXFT_Load_Glyph(face, glyph_index, |
442 FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH); | 447 FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH); |
443 if (!err) { | 448 if (!err) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 CIDTransformToFloat(pTransform[2]), | 494 CIDTransformToFloat(pTransform[2]), |
490 CIDTransformToFloat(pTransform[3]), | 495 CIDTransformToFloat(pTransform[3]), |
491 CIDTransformToFloat(pTransform[4]) * 1000, | 496 CIDTransformToFloat(pTransform[4]) * 1000, |
492 CIDTransformToFloat(pTransform[5]) * 1000); | 497 CIDTransformToFloat(pTransform[5]) * 1000); |
493 CFX_FloatRect rect_f(rect); | 498 CFX_FloatRect rect_f(rect); |
494 rect_f.Transform(&matrix); | 499 rect_f.Transform(&matrix); |
495 rect = rect_f.GetOuterRect(); | 500 rect = rect_f.GetOuterRect(); |
496 } | 501 } |
497 } | 502 } |
498 if (charcode < 256) | 503 if (charcode < 256) |
499 m_CharBBox[charcode] = rect.ToSmallRect(); | 504 m_CharBBox[charcode] = rect; |
500 | 505 |
501 return rect; | 506 return rect; |
502 } | 507 } |
| 508 |
503 int CPDF_CIDFont::GetCharWidthF(uint32_t charcode, int level) { | 509 int CPDF_CIDFont::GetCharWidthF(uint32_t charcode, int level) { |
504 if (charcode < 0x80 && m_bAnsiWidthsFixed) | 510 if (charcode < 0x80 && m_bAnsiWidthsFixed) |
505 return charcode >= 32 && charcode < 127 ? 500 : 0; | 511 return charcode >= 32 && charcode < 127 ? 500 : 0; |
506 | 512 |
507 uint16_t cid = CIDFromCharCode(charcode); | 513 uint16_t cid = CIDFromCharCode(charcode); |
508 int size = m_WidthList.GetSize(); | 514 int size = m_WidthList.GetSize(); |
509 uint32_t* list = m_WidthList.GetData(); | 515 const uint32_t* pList = m_WidthList.GetData(); |
510 for (int i = 0; i < size; i += 3) { | 516 for (int i = 0; i < size; i += 3) { |
511 if (cid >= list[i] && cid <= list[i + 1]) { | 517 const uint32_t* pEntry = pList + i; |
512 return (int)list[i + 2]; | 518 if (IsMetricForCID(pEntry, cid)) |
513 } | 519 return static_cast<int>(pEntry[2]); |
514 } | 520 } |
515 return m_DefaultWidth; | 521 return m_DefaultWidth; |
516 } | 522 } |
| 523 |
517 short CPDF_CIDFont::GetVertWidth(uint16_t CID) const { | 524 short CPDF_CIDFont::GetVertWidth(uint16_t CID) const { |
518 uint32_t vertsize = m_VertMetrics.GetSize() / 5; | 525 uint32_t vertsize = m_VertMetrics.GetSize() / 5; |
519 if (vertsize == 0) { | 526 if (vertsize) { |
520 return m_DefaultW1; | 527 const uint32_t* pTable = m_VertMetrics.GetData(); |
| 528 for (uint32_t i = 0; i < vertsize; i++) { |
| 529 const uint32_t* pEntry = pTable + (i * 5); |
| 530 if (IsMetricForCID(pEntry, CID)) |
| 531 return static_cast<short>(pEntry[2]); |
| 532 } |
521 } | 533 } |
522 const uint32_t* pTable = m_VertMetrics.GetData(); | |
523 for (uint32_t i = 0; i < vertsize; i++) | |
524 if (pTable[i * 5] <= CID && pTable[i * 5 + 1] >= CID) { | |
525 return (short)(int)pTable[i * 5 + 2]; | |
526 } | |
527 return m_DefaultW1; | 534 return m_DefaultW1; |
528 } | 535 } |
| 536 |
529 void CPDF_CIDFont::GetVertOrigin(uint16_t CID, short& vx, short& vy) const { | 537 void CPDF_CIDFont::GetVertOrigin(uint16_t CID, short& vx, short& vy) const { |
530 uint32_t vertsize = m_VertMetrics.GetSize() / 5; | 538 uint32_t vertsize = m_VertMetrics.GetSize() / 5; |
531 if (vertsize) { | 539 if (vertsize) { |
532 const uint32_t* pTable = m_VertMetrics.GetData(); | 540 const uint32_t* pTable = m_VertMetrics.GetData(); |
533 for (uint32_t i = 0; i < vertsize; i++) | 541 for (uint32_t i = 0; i < vertsize; i++) { |
534 if (pTable[i * 5] <= CID && pTable[i * 5 + 1] >= CID) { | 542 const uint32_t* pEntry = pTable + (i * 5); |
535 vx = (short)(int)pTable[i * 5 + 3]; | 543 if (IsMetricForCID(pEntry, CID)) { |
536 vy = (short)(int)pTable[i * 5 + 4]; | 544 vx = static_cast<short>(pEntry[3]); |
| 545 vy = static_cast<short>(pEntry[4]); |
537 return; | 546 return; |
538 } | 547 } |
| 548 } |
539 } | 549 } |
540 uint32_t dwWidth = m_DefaultWidth; | 550 uint32_t dwWidth = m_DefaultWidth; |
541 int size = m_WidthList.GetSize(); | 551 int size = m_WidthList.GetSize(); |
542 const uint32_t* list = m_WidthList.GetData(); | 552 const uint32_t* pList = m_WidthList.GetData(); |
543 for (int i = 0; i < size; i += 3) { | 553 for (int i = 0; i < size; i += 3) { |
544 if (CID >= list[i] && CID <= list[i + 1]) { | 554 const uint32_t* pEntry = pList + i; |
545 dwWidth = (uint16_t)list[i + 2]; | 555 if (IsMetricForCID(pEntry, CID)) { |
| 556 dwWidth = pEntry[2]; |
546 break; | 557 break; |
547 } | 558 } |
548 } | 559 } |
549 vx = (short)dwWidth / 2; | 560 vx = static_cast<short>(dwWidth) / 2; |
550 vy = (short)m_DefaultVY; | 561 vy = m_DefaultVY; |
551 } | 562 } |
552 | 563 |
553 int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, bool* pVertGlyph) { | 564 int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, bool* pVertGlyph) { |
554 if (pVertGlyph) | 565 if (pVertGlyph) |
555 *pVertGlyph = false; | 566 *pVertGlyph = false; |
556 | 567 |
557 FXFT_Face face = m_Font.GetFace(); | 568 FXFT_Face face = m_Font.GetFace(); |
558 int index = FXFT_Get_Char_Index(face, unicode); | 569 int index = FXFT_Get_Char_Index(face, unicode); |
559 if (unicode == 0x2502) | 570 if (unicode == 0x2502) |
560 return index; | 571 return index; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 return (ch < 128 ? ch : ch - 255) * (1.0f / 127); | 824 return (ch < 128 ? ch : ch - 255) * (1.0f / 127); |
814 } | 825 } |
815 | 826 |
816 void CPDF_CIDFont::LoadGB2312() { | 827 void CPDF_CIDFont::LoadGB2312() { |
817 m_BaseFont = m_pFontDict->GetStringBy("BaseFont"); | 828 m_BaseFont = m_pFontDict->GetStringBy("BaseFont"); |
818 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); | 829 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); |
819 if (pFontDesc) | 830 if (pFontDesc) |
820 LoadFontDescriptor(pFontDesc); | 831 LoadFontDescriptor(pFontDesc); |
821 | 832 |
822 m_Charset = CIDSET_GB1; | 833 m_Charset = CIDSET_GB1; |
823 m_bType1 = FALSE; | 834 m_bType1 = false; |
824 CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager; | 835 CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager; |
825 m_pCMap = manager.GetPredefinedCMap("GBK-EUC-H", FALSE); | 836 m_pCMap = manager.GetPredefinedCMap("GBK-EUC-H", FALSE); |
826 m_pCID2UnicodeMap = manager.GetCID2UnicodeMap(m_Charset, FALSE); | 837 m_pCID2UnicodeMap = manager.GetCID2UnicodeMap(m_Charset, FALSE); |
827 if (!IsEmbedded()) | 838 if (!IsEmbedded()) |
828 LoadSubstFont(); | 839 LoadSubstFont(); |
829 | 840 |
830 CheckFontMetrics(); | 841 CheckFontMetrics(); |
831 m_DefaultWidth = 1000; | 842 m_DefaultWidth = 1000; |
832 m_bAnsiWidthsFixed = true; | 843 m_bAnsiWidthsFixed = true; |
833 } | 844 } |
834 | 845 |
835 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { | 846 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { |
836 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 847 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
837 return nullptr; | 848 return nullptr; |
838 | 849 |
839 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs); | 850 const auto* pEnd = g_Japan1_VertCIDs + FX_ArraySize(g_Japan1_VertCIDs); |
840 const auto* pTransform = std::lower_bound( | 851 const auto* pTransform = std::lower_bound( |
841 g_Japan1_VertCIDs, pEnd, CID, | 852 g_Japan1_VertCIDs, pEnd, CID, |
842 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; }); | 853 [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; }); |
843 return pTransform < pEnd && CID == pTransform->cid ? &pTransform->a : nullptr; | 854 return pTransform < pEnd && CID == pTransform->cid ? &pTransform->a : nullptr; |
844 } | 855 } |
OLD | NEW |