diff options
author | Robert Meyer <rmeyer@apache.org> | 2013-12-05 09:57:19 +0000 |
---|---|---|
committer | Robert Meyer <rmeyer@apache.org> | 2013-12-05 09:57:19 +0000 |
commit | d86afe17fd341ac115a4ab9b3012d1e5e62f8e48 (patch) | |
tree | 8818084081523a0f9a606e25a650cea146ae2578 | |
parent | 922d33c57d1ecf805bd42971d9db3bb90af23081 (diff) | |
download | xmlgraphics-fop-d86afe17fd341ac115a4ab9b3012d1e5e62f8e48.tar.gz xmlgraphics-fop-d86afe17fd341ac115a4ab9b3012d1e5e62f8e48.zip |
FOP-2322: Type1 Font with Custom Encoding not visible in Postscript output; Patch submitted by Simon Steiner
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1548054 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/fonts/type1/Type1FontLoader.java | 16 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSFontUtils.java | 9 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java index dddf2a3a3..716faa61e 100644 --- a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java +++ b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java @@ -173,7 +173,21 @@ public class Type1FontLoader extends FontLoader { addUnencodedBasedOnAFM(afm); } } else { - if (pfm.getCharSet() >= 0 && pfm.getCharSet() <= 2) { + if (pfm.getCharSet() == 2 && !pfm.getCharSetName().equals("Symbol")) { + int[] table = new int[256]; + String[] charNameMap = new String[256]; + int j = 0; + for (int i = pfm.getFirstChar(); i < pfm.getLastChar(); i++) { + if (j < table.length) { + table[j] = i; + table[j + 1] = i; + j += 2; + } + charNameMap[i] = String.format("x%03o", i); + } + CodePointMapping mapping = new CodePointMapping("custom", table, charNameMap); + singleFont.setEncoding(mapping); + } else if (pfm.getCharSet() >= 0 && pfm.getCharSet() <= 2) { singleFont.setEncoding(pfm.getCharSetName() + "Encoding"); } else { log.warn("The PFM reports an unsupported encoding (" diff --git a/src/java/org/apache/fop/render/ps/PSFontUtils.java b/src/java/org/apache/fop/render/ps/PSFontUtils.java index c22a3ba28..06191f84d 100644 --- a/src/java/org/apache/fop/render/ps/PSFontUtils.java +++ b/src/java/org/apache/fop/render/ps/PSFontUtils.java @@ -175,6 +175,15 @@ public class PSFontUtils extends org.apache.xmlgraphics.ps.PSFontUtils { if (!tracker.isResourceSupplied(WINANSI_ENCODING_RESOURCE)) { //Only out Base 14 fonts still use that + for (Typeface tf : fonts.values()) { + if (tf instanceof LazyFont) { + tf = ((LazyFont)tf).getRealFont(); + if (tf instanceof SingleByteFont + && ((SingleByteFont) tf).getEncoding().getName().equals("custom")) { + defineEncoding(gen, ((SingleByteFont) tf).getEncoding()); + } + } + } defineWinAnsiEncoding(gen); } gen.commentln("%FOPBeginFontReencode"); |