Skip to content

Commit f26a8ae

Browse files
committed
Update fontKey calculation
Make fontKey independent from culture. DEVSIX-717
1 parent c7a7c96 commit f26a8ae

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

io/src/main/java/com/itextpdf/io/font/FontProgramFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.io.IOException;
4747
import com.itextpdf.io.util.ArrayUtil;
4848

49-
import java.text.MessageFormat;
5049
import java.util.Set;
5150

5251
/**
@@ -277,7 +276,7 @@ public static FontProgram createFont(String name, byte[] font, boolean cached) t
277276
if (name != null) {
278277
fontKey = name;
279278
} else {
280-
fontKey = MessageFormat.format("{0}", ArrayUtil.hashCode(font));
279+
fontKey = Integer.toString(ArrayUtil.hashCode(font));
281280
}
282281
fontFound = FontCache.getFont(fontKey);
283282
if (fontFound != null) {
@@ -378,7 +377,7 @@ public static FontProgram createType1Font(String name, byte[] afm, byte[] pfb, b
378377
if (name != null) {
379378
fontKey = name;
380379
} else {
381-
fontKey = MessageFormat.format("{0}", ArrayUtil.hashCode(afm));
380+
fontKey = Integer.toString(ArrayUtil.hashCode(afm));
382381
}
383382
fontProgram = FontCache.getFont(fontKey);
384383
if (fontProgram != null) {
@@ -463,7 +462,7 @@ public static FontProgram createFont(String ttc, int ttcIndex, boolean cached) t
463462
public static FontProgram createFont(byte[] ttc, int ttcIndex, boolean cached) throws java.io.IOException {
464463
String fontKey = null;
465464
if (cached) {
466-
fontKey = MessageFormat.format("{0}{1}", ArrayUtil.hashCode(ttc), ttcIndex);
465+
fontKey = Integer.toString(ArrayUtil.hashCode(ttc)) + Integer.toString(ttcIndex);
467466
FontProgram fontFound = FontCache.getFont(fontKey);
468467
if (fontFound != null) {
469468
return fontFound;

0 commit comments

Comments
 (0)