Skip to content

Commit ad190d2

Browse files
committed
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #256
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1928706 13f79535-47bb-0310-9956-ffa450edef68
1 parent bebb747 commit ad190d2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,11 @@ private boolean probablyBarcodeFont(PDFontDescriptor fontDescriptor)
666666
*/
667667
private boolean isCharSetMatch(PDCIDSystemInfo cidSystemInfo, FontInfo info)
668668
{
669+
String ordering = cidSystemInfo.getOrdering();
669670
if (info.getCIDSystemInfo() != null)
670671
{
671672
return info.getCIDSystemInfo().getRegistry().equals(cidSystemInfo.getRegistry()) &&
672-
info.getCIDSystemInfo().getOrdering().equals(cidSystemInfo.getOrdering());
673+
info.getCIDSystemInfo().getOrdering().equals(ordering);
673674
}
674675
else
675676
{
@@ -686,24 +687,24 @@ private boolean isCharSetMatch(PDCIDSystemInfo cidSystemInfo, FontInfo info)
686687
// PDFBOX-4793 and PDF.js 10699: This font has only Korean, but has bits 17-21 set.
687688
codePageRange &= ~(JIS_JAPAN | CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL);
688689
}
689-
if (cidSystemInfo.getOrdering().equals("GB1") &&
690+
if (ordering.equals("GB1") &&
690691
(codePageRange & CHINESE_SIMPLIFIED) == CHINESE_SIMPLIFIED)
691692
{
692693
return true;
693694
}
694-
else if (cidSystemInfo.getOrdering().equals("CNS1") &&
695+
else if (ordering.equals("CNS1") &&
695696
(codePageRange & CHINESE_TRADITIONAL) == CHINESE_TRADITIONAL)
696697
{
697698
return true;
698699
}
699-
else if (cidSystemInfo.getOrdering().equals("Japan1") &&
700+
else if (ordering.equals("Japan1") &&
700701
(codePageRange & JIS_JAPAN) == JIS_JAPAN)
701702
{
702703
return true;
703704
}
704705
else
705706
{
706-
return cidSystemInfo.getOrdering().equals("Korea1") &&
707+
return ordering.equals("Korea1") &&
707708
((codePageRange & KOREAN_WANSUNG) == KOREAN_WANSUNG ||
708709
(codePageRange & KOREAN_JOHAB) == KOREAN_JOHAB);
709710
}

0 commit comments

Comments
 (0)