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/fxge/cfx_fontmapper.h" | 7 #include "core/fxge/cfx_fontmapper.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "core/fxge/cfx_substfont.h" | 13 #include "core/fxge/cfx_substfont.h" |
14 #include "core/fxge/fx_font.h" | 14 #include "core/fxge/fx_font.h" |
15 #include "core/fxge/ifx_systemfontinfo.h" | 15 #include "core/fxge/ifx_systemfontinfo.h" |
16 | 16 |
17 #include "third_party/base/stl_util.h" | 17 #include "third_party/base/stl_util.h" |
18 | 18 |
19 #define FX_FONT_STYLE_None 0x00 | 19 #define FX_FONT_STYLE_None 0x00 |
20 #define FX_FONT_STYLE_Bold 0x01 | 20 #define FX_FONT_STYLE_Bold 0x01 |
21 #define FX_FONT_STYLE_Italic 0x02 | 21 #define FX_FONT_STYLE_Italic 0x02 |
22 #define FX_FONT_STYLE_BoldBold 0x04 | 22 #define FX_FONT_STYLE_BoldBold 0x04 |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const int kExternalFontIndex = 12; | 26 const int kNumStandardFonts = 14; |
27 | 27 |
28 const FX_CHAR* const g_Base14FontNames[14] = { | 28 const FX_CHAR* const g_Base14FontNames[kNumStandardFonts] = { |
29 "Courier", | 29 "Courier", |
30 "Courier-Bold", | 30 "Courier-Bold", |
31 "Courier-BoldOblique", | 31 "Courier-BoldOblique", |
32 "Courier-Oblique", | 32 "Courier-Oblique", |
33 "Helvetica", | 33 "Helvetica", |
34 "Helvetica-Bold", | 34 "Helvetica-Bold", |
35 "Helvetica-BoldOblique", | 35 "Helvetica-BoldOblique", |
36 "Helvetica-Oblique", | 36 "Helvetica-Oblique", |
37 "Times-Roman", | 37 "Times-Roman", |
38 "Times-Bold", | 38 "Times-Bold", |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 if (match[0] == ' ') | 380 if (match[0] == ' ') |
381 match = m_InstalledTTFonts[i + 1]; | 381 match = m_InstalledTTFonts[i + 1]; |
382 return match; | 382 return match; |
383 } | 383 } |
384 | 384 |
385 FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, | 385 FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, |
386 int iBaseFont, | 386 int iBaseFont, |
387 int italic_angle, | 387 int italic_angle, |
388 int weight, | 388 int weight, |
389 int picthfamily) { | 389 int picthfamily) { |
390 if (iBaseFont < kExternalFontIndex) { | 390 if (iBaseFont < kNumStandardFonts) { |
dsinclair
2016/10/11 14:11:37
Doesn't this change the meaning? Previously it was
npm
2016/10/11 14:19:55
That is precisely what I want because I now use it
| |
391 if (m_FoxitFaces[iBaseFont]) | 391 if (m_FoxitFaces[iBaseFont]) |
392 return m_FoxitFaces[iBaseFont]; | 392 return m_FoxitFaces[iBaseFont]; |
393 const uint8_t* pFontData = nullptr; | 393 const uint8_t* pFontData = nullptr; |
394 uint32_t size = 0; | 394 uint32_t size = 0; |
395 if (m_pFontMgr->GetBuiltinFont(iBaseFont, &pFontData, &size)) { | 395 if (m_pFontMgr->GetBuiltinFont(iBaseFont, &pFontData, &size)) { |
396 m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); | 396 m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); |
397 return m_FoxitFaces[iBaseFont]; | 397 return m_FoxitFaces[iBaseFont]; |
398 } | 398 } |
399 } | 399 } |
400 pSubstFont->m_SubstFlags |= FXFONT_SUBST_MM; | 400 pSubstFont->m_SubstFlags |= FXFONT_SUBST_MM; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 italic_angle = 0; | 434 italic_angle = 0; |
435 } | 435 } |
436 CFX_ByteString SubstName = name; | 436 CFX_ByteString SubstName = name; |
437 SubstName.Remove(' '); | 437 SubstName.Remove(' '); |
438 if (bTrueType && name[0] == '@') | 438 if (bTrueType && name[0] == '@') |
439 SubstName = name.Mid(1); | 439 SubstName = name.Mid(1); |
440 PDF_GetStandardFontName(&SubstName); | 440 PDF_GetStandardFontName(&SubstName); |
441 if (SubstName == "Symbol" && !bTrueType) { | 441 if (SubstName == "Symbol" && !bTrueType) { |
442 pSubstFont->m_Family = "Chrome Symbol"; | 442 pSubstFont->m_Family = "Chrome Symbol"; |
443 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; | 443 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; |
444 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 444 return UseInternalSubst(pSubstFont, 12, italic_angle, weight, 0); |
445 if (m_FoxitFaces[12]) | |
446 return m_FoxitFaces[12]; | |
447 const uint8_t* pFontData = nullptr; | |
448 uint32_t size = 0; | |
449 m_pFontMgr->GetBuiltinFont(12, &pFontData, &size); | |
450 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); | |
451 return m_FoxitFaces[12]; | |
452 } | 445 } |
453 if (SubstName == "ZapfDingbats") { | 446 if (SubstName == "ZapfDingbats") { |
454 pSubstFont->m_Family = "Chrome Dingbats"; | 447 pSubstFont->m_Family = "Chrome Dingbats"; |
455 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; | 448 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; |
456 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 449 return UseInternalSubst(pSubstFont, 13, italic_angle, weight, 0); |
457 if (m_FoxitFaces[13]) | |
458 return m_FoxitFaces[13]; | |
459 const uint8_t* pFontData = nullptr; | |
460 uint32_t size = 0; | |
461 m_pFontMgr->GetBuiltinFont(13, &pFontData, &size); | |
462 m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0); | |
463 return m_FoxitFaces[13]; | |
464 } | 450 } |
465 int iBaseFont = 0; | 451 int iBaseFont = 0; |
466 CFX_ByteString family; | 452 CFX_ByteString family; |
467 CFX_ByteString style; | 453 CFX_ByteString style; |
468 bool bHasComma = false; | 454 bool bHasComma = false; |
469 bool bHasHyphen = false; | 455 bool bHasHyphen = false; |
470 int find = SubstName.Find(",", 0); | 456 int find = SubstName.Find(",", 0); |
471 if (find >= 0) { | 457 if (find >= 0) { |
472 family = SubstName.Left(find); | 458 family = SubstName.Left(find); |
473 PDF_GetStandardFontName(&family); | 459 PDF_GetStandardFontName(&family); |
474 style = SubstName.Mid(find + 1); | 460 style = SubstName.Mid(find + 1); |
475 bHasComma = true; | 461 bHasComma = true; |
476 } else { | 462 } else { |
477 family = SubstName; | 463 family = SubstName; |
478 } | 464 } |
479 for (; iBaseFont < kExternalFontIndex; iBaseFont++) { | 465 for (; iBaseFont < 12; iBaseFont++) { |
480 if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont])) | 466 if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont])) |
481 break; | 467 break; |
482 } | 468 } |
483 int PitchFamily = 0; | 469 int PitchFamily = 0; |
484 bool bItalic = false; | 470 bool bItalic = false; |
485 uint32_t nStyle = 0; | 471 uint32_t nStyle = 0; |
486 bool bStyleAvail = false; | 472 bool bStyleAvail = false; |
487 if (iBaseFont < kExternalFontIndex) { | 473 if (iBaseFont < 12) { |
488 if ((iBaseFont % 4) == 1 || (iBaseFont % 4) == 2) | 474 if ((iBaseFont % 4) == 1 || (iBaseFont % 4) == 2) |
489 nStyle |= FX_FONT_STYLE_Bold; | 475 nStyle |= FX_FONT_STYLE_Bold; |
490 if ((iBaseFont % 4) / 2) | 476 if ((iBaseFont % 4) / 2) |
491 nStyle |= FX_FONT_STYLE_Italic; | 477 nStyle |= FX_FONT_STYLE_Italic; |
492 if (iBaseFont < 4) | 478 if (iBaseFont < 4) |
493 PitchFamily |= FXFONT_FF_FIXEDPITCH; | 479 PitchFamily |= FXFONT_FF_FIXEDPITCH; |
494 if (iBaseFont >= 8) | 480 if (iBaseFont >= 8) |
495 PitchFamily |= FXFONT_FF_ROMAN; | 481 PitchFamily |= FXFONT_FF_ROMAN; |
496 } else { | 482 } else { |
483 iBaseFont = kNumStandardFonts; | |
497 if (!bHasComma) { | 484 if (!bHasComma) { |
498 find = family.ReverseFind('-'); | 485 find = family.ReverseFind('-'); |
499 if (find >= 0) { | 486 if (find >= 0) { |
500 style = family.Mid(find + 1); | 487 style = family.Mid(find + 1); |
501 family = family.Left(find); | 488 family = family.Left(find); |
502 bHasHyphen = true; | 489 bHasHyphen = true; |
503 } | 490 } |
504 } | 491 } |
505 if (!bHasHyphen) { | 492 if (!bHasHyphen) { |
506 int nLen = family.GetLength(); | 493 int nLen = family.GetLength(); |
(...skipping 14 matching lines...) Expand all Loading... | |
521 int nLen = style.GetLength(); | 508 int nLen = style.GetLength(); |
522 const FX_CHAR* pStyle = style.c_str(); | 509 const FX_CHAR* pStyle = style.c_str(); |
523 int i = 0; | 510 int i = 0; |
524 bool bFirstItem = true; | 511 bool bFirstItem = true; |
525 CFX_ByteString buf; | 512 CFX_ByteString buf; |
526 while (i < nLen) { | 513 while (i < nLen) { |
527 buf = ParseStyle(pStyle, nLen, i); | 514 buf = ParseStyle(pStyle, nLen, i); |
528 int32_t nRet = GetStyleType(buf, false); | 515 int32_t nRet = GetStyleType(buf, false); |
529 if ((i && !bStyleAvail) || (!i && nRet < 0)) { | 516 if ((i && !bStyleAvail) || (!i && nRet < 0)) { |
530 family = SubstName; | 517 family = SubstName; |
531 iBaseFont = kExternalFontIndex; | 518 iBaseFont = kNumStandardFonts; |
532 break; | 519 break; |
533 } | 520 } |
534 if (nRet >= 0) { | 521 if (nRet >= 0) { |
535 bStyleAvail = true; | 522 bStyleAvail = true; |
536 } | 523 } |
537 if (nRet == 1) { | 524 if (nRet == 1) { |
538 if (bFirstItem) { | 525 if (bFirstItem) { |
539 nStyle |= FX_FONT_STYLE_Italic; | 526 nStyle |= FX_FONT_STYLE_Italic; |
540 } else { | 527 } else { |
541 family = SubstName; | 528 family = SubstName; |
542 iBaseFont = kExternalFontIndex; | 529 iBaseFont = kNumStandardFonts; |
543 } | 530 } |
544 break; | 531 break; |
545 } | 532 } |
546 if (nRet == 0) { | 533 if (nRet == 0) { |
547 if (nStyle & FX_FONT_STYLE_Bold) | 534 if (nStyle & FX_FONT_STYLE_Bold) |
548 nStyle |= FX_FONT_STYLE_BoldBold; | 535 nStyle |= FX_FONT_STYLE_BoldBold; |
549 else | 536 else |
550 nStyle |= FX_FONT_STYLE_Bold; | 537 nStyle |= FX_FONT_STYLE_Bold; |
551 bFirstItem = false; | 538 bFirstItem = false; |
552 } else if (nRet == 2) { | 539 } else if (nRet == 2) { |
(...skipping 14 matching lines...) Expand all Loading... | |
567 nStyle & FX_FONT_STYLE_BoldBold | 554 nStyle & FX_FONT_STYLE_BoldBold |
568 ? 900 | 555 ? 900 |
569 : (nStyle & FX_FONT_STYLE_Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); | 556 : (nStyle & FX_FONT_STYLE_Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); |
570 } | 557 } |
571 if (nStyle & FX_FONT_STYLE_Italic) | 558 if (nStyle & FX_FONT_STYLE_Italic) |
572 bItalic = true; | 559 bItalic = true; |
573 int iExact = 0; | 560 int iExact = 0; |
574 int Charset = FXFONT_ANSI_CHARSET; | 561 int Charset = FXFONT_ANSI_CHARSET; |
575 if (WindowCP) | 562 if (WindowCP) |
576 Charset = GetCharsetFromCodePage(WindowCP); | 563 Charset = GetCharsetFromCodePage(WindowCP); |
577 else if (iBaseFont == kExternalFontIndex && (flags & FXFONT_SYMBOLIC)) | 564 else if (iBaseFont == kNumStandardFonts && (flags & FXFONT_SYMBOLIC)) |
578 Charset = FXFONT_SYMBOL_CHARSET; | 565 Charset = FXFONT_SYMBOL_CHARSET; |
579 bool bCJK = | 566 bool bCJK = |
580 (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET || | 567 (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET || |
581 Charset == FXFONT_HANGUL_CHARSET || | 568 Charset == FXFONT_HANGUL_CHARSET || |
582 Charset == FXFONT_CHINESEBIG5_CHARSET); | 569 Charset == FXFONT_CHINESEBIG5_CHARSET); |
583 if (!m_pFontInfo) { | 570 if (!m_pFontInfo) { |
584 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | |
585 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, | 571 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, |
586 PitchFamily); | 572 PitchFamily); |
587 } | 573 } |
588 family = GetFontFamily(family, nStyle); | 574 family = GetFontFamily(family, nStyle); |
589 CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str())); | 575 CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str())); |
590 if (match.IsEmpty() && family != SubstName && | 576 if (match.IsEmpty() && family != SubstName && |
591 (!bHasComma && (!bHasHyphen || (bHasHyphen && !bStyleAvail)))) { | 577 (!bHasComma && (!bHasHyphen || (bHasHyphen && !bStyleAvail)))) { |
592 match = MatchInstalledFonts(TT_NormalizeName(SubstName.c_str())); | 578 match = MatchInstalledFonts(TT_NormalizeName(SubstName.c_str())); |
593 } | 579 } |
594 if (match.IsEmpty() && iBaseFont >= kExternalFontIndex) { | 580 if (match.IsEmpty() && iBaseFont >= kNumStandardFonts) { |
595 if (!bCJK) { | 581 if (!bCJK) { |
596 if (!CheckSupportThirdPartFont(family, PitchFamily)) { | 582 if (!CheckSupportThirdPartFont(family, PitchFamily)) { |
597 bItalic = italic_angle != 0; | 583 bItalic = italic_angle != 0; |
598 weight = old_weight; | 584 weight = old_weight; |
599 } | 585 } |
600 } else { | 586 } else { |
601 pSubstFont->m_bSubstCJK = true; | 587 pSubstFont->m_bSubstCJK = true; |
602 if (nStyle) | 588 if (nStyle) |
603 pSubstFont->m_WeightCJK = nStyle ? weight : FXFONT_FW_NORMAL; | 589 pSubstFont->m_WeightCJK = nStyle ? weight : FXFONT_FW_NORMAL; |
604 if (nStyle & FX_FONT_STYLE_Italic) | 590 if (nStyle & FX_FONT_STYLE_Italic) |
605 pSubstFont->m_bItalicCJK = true; | 591 pSubstFont->m_bItalicCJK = true; |
606 } | 592 } |
607 } else { | 593 } else { |
608 italic_angle = 0; | 594 italic_angle = 0; |
609 weight = | 595 weight = |
610 nStyle & FX_FONT_STYLE_BoldBold | 596 nStyle & FX_FONT_STYLE_BoldBold |
611 ? 900 | 597 ? 900 |
612 : (nStyle & FX_FONT_STYLE_Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); | 598 : (nStyle & FX_FONT_STYLE_Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); |
613 } | 599 } |
614 if (!match.IsEmpty() || iBaseFont < kExternalFontIndex) { | 600 if (!match.IsEmpty() || iBaseFont < kNumStandardFonts) { |
615 if (!match.IsEmpty()) | 601 if (!match.IsEmpty()) |
616 family = match; | 602 family = match; |
617 if (iBaseFont < kExternalFontIndex) { | 603 if (iBaseFont < kNumStandardFonts) { |
618 if (nStyle && !(iBaseFont % 4)) { | 604 if (nStyle && !(iBaseFont % 4)) { |
619 if ((nStyle & 0x3) == 1) | 605 if ((nStyle & 0x3) == 1) |
620 iBaseFont += 1; | 606 iBaseFont += 1; |
621 if ((nStyle & 0x3) == 2) | 607 if ((nStyle & 0x3) == 2) |
622 iBaseFont += 3; | 608 iBaseFont += 3; |
623 if ((nStyle & 0x3) == 3) | 609 if ((nStyle & 0x3) == 3) |
624 iBaseFont += 2; | 610 iBaseFont += 2; |
625 } | 611 } |
626 family = g_Base14FontNames[iBaseFont]; | 612 family = g_Base14FontNames[iBaseFont]; |
627 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | |
628 } | 613 } |
629 } else { | 614 } else { |
630 if (flags & FXFONT_ITALIC) | 615 if (flags & FXFONT_ITALIC) |
631 bItalic = true; | 616 bItalic = true; |
632 } | 617 } |
633 iExact = !match.IsEmpty(); | 618 iExact = !match.IsEmpty(); |
634 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, | 619 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, |
635 family.c_str(), iExact); | 620 family.c_str(), iExact); |
636 if (iExact) | 621 if (iExact) |
637 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; | 622 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; |
(...skipping 11 matching lines...) Expand all Loading... | |
649 if (!hFont) { | 634 if (!hFont) { |
650 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, | 635 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, |
651 PitchFamily); | 636 PitchFamily); |
652 } | 637 } |
653 } else { | 638 } else { |
654 if (Charset == FXFONT_SYMBOL_CHARSET) { | 639 if (Charset == FXFONT_SYMBOL_CHARSET) { |
655 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ | 640 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ |
656 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ | 641 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ |
657 if (SubstName == "Symbol") { | 642 if (SubstName == "Symbol") { |
658 pSubstFont->m_Family = "Chrome Symbol"; | 643 pSubstFont->m_Family = "Chrome Symbol"; |
659 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | |
660 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; | 644 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; |
661 if (m_FoxitFaces[12]) | 645 return UseInternalSubst(pSubstFont, 12, italic_angle, old_weight, |
662 return m_FoxitFaces[12]; | 646 PitchFamily); |
663 const uint8_t* pFontData = nullptr; | |
664 uint32_t size = 0; | |
665 m_pFontMgr->GetBuiltinFont(12, &pFontData, &size); | |
666 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); | |
667 return m_FoxitFaces[12]; | |
668 } | 647 } |
669 #endif | 648 #endif |
670 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; | 649 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; |
671 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC, | 650 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC, |
672 weight, italic_angle, 0, pSubstFont); | 651 weight, italic_angle, 0, pSubstFont); |
673 } | 652 } |
674 if (Charset == FXFONT_ANSI_CHARSET) { | 653 if (Charset == FXFONT_ANSI_CHARSET) { |
675 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | |
676 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, | 654 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, |
677 PitchFamily); | 655 PitchFamily); |
678 } | 656 } |
679 | 657 |
680 auto it = | 658 auto it = |
681 std::find_if(m_FaceArray.begin(), m_FaceArray.end(), | 659 std::find_if(m_FaceArray.begin(), m_FaceArray.end(), |
682 [Charset](const FaceData& face) { | 660 [Charset](const FaceData& face) { |
683 return face.charset == static_cast<uint32_t>(Charset); | 661 return face.charset == static_cast<uint32_t>(Charset); |
684 }); | 662 }); |
685 if (it == m_FaceArray.end()) { | 663 if (it == m_FaceArray.end()) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
825 int PDF_GetStandardFontName(CFX_ByteString* name) { | 803 int PDF_GetStandardFontName(CFX_ByteString* name) { |
826 AltFontName* found = static_cast<AltFontName*>( | 804 AltFontName* found = static_cast<AltFontName*>( |
827 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 805 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
828 sizeof(AltFontName), CompareString)); | 806 sizeof(AltFontName), CompareString)); |
829 if (!found) | 807 if (!found) |
830 return -1; | 808 return -1; |
831 | 809 |
832 *name = g_Base14FontNames[found->m_Index]; | 810 *name = g_Base14FontNames[found->m_Index]; |
833 return found->m_Index; | 811 return found->m_Index; |
834 } | 812 } |
OLD | NEW |