Author: cbowditch
Date: Fri Nov  2 14:07:14 2012
New Revision: 1404968

URL: http://svn.apache.org/viewvc?rev=1404968&view=rev
Log:
bugzilla #48955: Allow AFP font codepage names to be less than 8 chars
Patch submitted by Peter Hancock

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java
    xmlgraphics/fop/trunk/status.xml

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java?rev=1404968&r1=1404967&r2=1404968&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java 
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java 
Fri Nov  2 14:07:14 2012
@@ -108,12 +108,11 @@ public class CharacterSet {
             throw new IllegalArgumentException(msg);
         }
 
-        if (name.length() < MAX_NAME_LEN) {
-            this.name = StringUtils.rpad(name, ' ', MAX_NAME_LEN);
-        } else {
-            this.name = name;
-        }
-        this.codePage = codePage;
+        // the character set name must be 8 chars long
+        this.name = padName(name);
+        // the code page name must be 8 chars long
+        this.codePage = padName(codePage);
+
         this.encoding = encoding;
         this.encoder = charsetType.getEncoder(encoding);
         this.accessor = accessor;
@@ -121,6 +120,11 @@ public class CharacterSet {
         this.characterSetOrientations = new HashMap<String, 
CharacterSetOrientation>(4);
     }
 
+     // right pad short names with space
+     private String padName(String name) {
+         return name.length() < MAX_NAME_LEN ? StringUtils.rpad(name, ' ', 
MAX_NAME_LEN) : name;
+     }
+
     /**
      * Add character set metric information for the different orientations
      *

Modified: xmlgraphics/fop/trunk/status.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1404968&r1=1404967&r2=1404968&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Fri Nov  2 14:07:14 2012
@@ -59,6 +59,9 @@
       documents. Example: the fix of marks layering will be such a case when 
it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Code" dev="CB" type="fix" fixes-bug="48955" 
due-to="Peter Hancock">
+        Allow AFP font codepage names to be less than 8 chars
+      </action>
       <action context="Code" dev="PH" type="fix" fixes-bug="54075">
         Fixed a regression
       </action>



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

Reply via email to