Skip to content

Commit 23d78b8

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

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.util.Collections;
2424
import java.util.List;
2525
import java.util.Map;
26+
import java.util.Set;
27+
2628
import org.apache.fontbox.ttf.HorizontalMetricsTable;
2729
import org.apache.fontbox.ttf.TrueTypeFont;
2830
import org.apache.pdfbox.cos.COSArray;
@@ -79,9 +81,9 @@ private void setWidths(COSDictionary font, GlyphList glyphList) throws IOExcepti
7981
HorizontalMetricsTable hmtx = ttf.getHorizontalMetrics();
8082

8183
Map<Integer, String> codeToName = getFontEncoding().getCodeToNameMap();
82-
83-
int firstChar = Collections.min(codeToName.keySet());
84-
int lastChar = Collections.max(codeToName.keySet());
84+
Set<Integer> codes = codeToName.keySet();
85+
int firstChar = Collections.min(codes);
86+
int lastChar = Collections.max(codes);
8587

8688
List<Integer> widths = new ArrayList<>(lastChar - firstChar + 1);
8789
for (int i = 0; i < lastChar - firstChar + 1; i++)

0 commit comments

Comments
 (0)