aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorChris Bowditch <cbowditch@apache.org>2012-11-02 14:07:14 +0000
committerChris Bowditch <cbowditch@apache.org>2012-11-02 14:07:14 +0000
commit4b4c1f125c93ad159a19e1da103d5e03d6976d8e (patch)
tree16e36fdce69a22d1a880f8d90765fbed9e6331a3 /src/java
parent8d8b0a939db3430aa7e6fca36abf84df008cad4e (diff)
downloadxmlgraphics-fop-4b4c1f125c93ad159a19e1da103d5e03d6976d8e.tar.gz
xmlgraphics-fop-4b4c1f125c93ad159a19e1da103d5e03d6976d8e.zip
bugzilla #48955: Allow AFP font codepage names to be less than 8 chars
Patch submitted by Peter Hancock git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1404968 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/afp/fonts/CharacterSet.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSet.java b/src/java/org/apache/fop/afp/fonts/CharacterSet.java
index d54d478bc..e0c3b9c9a 100644
--- a/src/java/org/apache/fop/afp/fonts/CharacterSet.java
+++ b/src/java/org/apache/fop/afp/fonts/CharacterSet.java
@@ -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
*