diff options
author | Simon Steiner <ssteiner@apache.org> | 2015-12-02 14:18:41 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2015-12-02 14:18:41 +0000 |
commit | adce6da98782037c3802a76aad195c11fb9cb929 (patch) | |
tree | 354a2ab9ef58d5cb24503537f6c3bb702aa50594 /src | |
parent | a386b5966a8e3548c8025c5a4976a8a45582867f (diff) | |
download | xmlgraphics-fop-adce6da98782037c3802a76aad195c11fb9cb929.tar.gz xmlgraphics-fop-adce6da98782037c3802a76aad195c11fb9cb929.zip |
FOP-2546: ArrayIndexOutOfBoundsException merging fonts
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1717634 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFFactory.java | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index ad117c9d0..e2c17b4e9 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -981,27 +981,31 @@ public class PDFFactory { //No ToUnicode CMap necessary if PDF 1.4, chapter 5.9 (page 368) is to be //believed. } else if (mapping.getName().equals("FOPPDFEncoding")) { - String[] charNameMap = mapping.getCharNameMap(); - char[] intmap = mapping.getUnicodeCharMap(); - PDFArray differences = new PDFArray(); - int len = intmap.length; - if (charNameMap.length < len) { - len = charNameMap.length; - } - int last = 0; - for (int i = 0; i < len; i++) { - if (intmap[i] - 1 != last) { - differences.add(intmap[i]); + if (fonttype == FontType.TRUETYPE) { + font.setEncoding("WinAnsiEncoding"); + } else { + String[] charNameMap = mapping.getCharNameMap(); + char[] intmap = mapping.getUnicodeCharMap(); + PDFArray differences = new PDFArray(); + int len = intmap.length; + if (charNameMap.length < len) { + len = charNameMap.length; + } + int last = 0; + for (int i = 0; i < len; i++) { + if (intmap[i] - 1 != last) { + differences.add(intmap[i]); + } + last = intmap[i]; + differences.add(new PDFName(charNameMap[i])); + } + PDFEncoding pdfEncoding = new PDFEncoding(singleByteFont.getEncodingName()); + getDocument().registerObject(pdfEncoding); + pdfEncoding.setDifferences(differences); + font.setEncoding(pdfEncoding); + if (mapping.getUnicodeCharMap() != null) { + generateToUnicodeCmap(nonBase14, mapping); } - last = intmap[i]; - differences.add(new PDFName(charNameMap[i])); - } - PDFEncoding pdfEncoding = new PDFEncoding(singleByteFont.getEncodingName()); - getDocument().registerObject(pdfEncoding); - pdfEncoding.setDifferences(differences); - font.setEncoding(pdfEncoding); - if (mapping.getUnicodeCharMap() != null) { - generateToUnicodeCmap(nonBase14, mapping); } } else { Object pdfEncoding = createPDFEncoding(mapping, |