Author: rmeyer
Date: Thu Dec  5 09:57:19 2013
New Revision: 1548054

URL: http://svn.apache.org/r1548054
Log:
FOP-2322: Type1 Font with Custom Encoding not visible in Postscript output; 
Patch submitted by Simon Steiner

Modified:
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java?rev=1548054&r1=1548053&r2=1548054&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java 
Thu Dec  5 09:57:19 2013
@@ -173,7 +173,21 @@ public class Type1FontLoader extends Fon
                 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 ("

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java?rev=1548054&r1=1548053&r2=1548054&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontUtils.java 
Thu Dec  5 09:57:19 2013
@@ -175,6 +175,15 @@ public class PSFontUtils extends org.apa
 
         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");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to