aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org')
-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
*