diff options
author | Jeremias Maerki <jeremias@apache.org> | 2010-05-20 09:52:27 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2010-05-20 09:52:27 +0000 |
commit | 366b45e1f9cf6ad39b45a928fb45c906bfc6dc99 (patch) | |
tree | 416257afc8bbeb83aa2e917d1a919968b2b428c5 /src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java | |
parent | aefb5934f6097c0691162a899372b9f9d4532201 (diff) | |
download | xmlgraphics-fop-366b45e1f9cf6ad39b45a928fb45c906bfc6dc99.tar.gz xmlgraphics-fop-366b45e1f9cf6ad39b45a928fb45c906bfc6dc99.zip |
Changed many variables and parameters from "int" to "char" because AFP font support mostly uses Unicode code points unlike Type 1 and TrueType support which use internal character code points (the result of Font.mapChar()). This should improve code readability.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@946585 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java')
-rw-r--r-- | src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java b/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java index db0908acb..84e4b7a69 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java +++ b/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java @@ -58,7 +58,7 @@ public class CharacterSetOrientation { private int capHeight; /** - * The character widths in the character set + * The character widths in the character set (indexed using Unicode codepoints) */ private int[] charsWidths = null; @@ -68,14 +68,14 @@ public class CharacterSetOrientation { private int xHeight; /** - * The first character + * The first character (Unicode codepoint) */ - private int firstChar; + private char firstChar; /** - * The last character + * The last character (Unicode codepoint) */ - private int lastChar; + private char lastChar; /** @@ -138,17 +138,17 @@ public class CharacterSetOrientation { /** * The first character in the character set - * @return the first character + * @return the first character (Unicode codepoint) */ - public int getFirstChar() { + public char getFirstChar() { return firstChar; } /** * The last character in the character set - * @return the last character + * @return the last character (Unicode codepoint) */ - public int getLastChar() { + public char getLastChar() { return lastChar; } @@ -183,15 +183,16 @@ public class CharacterSetOrientation { /** * Get the width (in 1/1000ths of a point size) of the character * identified by the parameter passed. - * @param characterIndex the character to evaluate + * @param character the Unicode character to evaluate * @return the widths of the character */ - public int getWidth(int characterIndex) { - if (characterIndex >= charsWidths.length) { - throw new IllegalArgumentException("Invalid character index: " - + characterIndex + ", maximum is " + (charsWidths.length - 1)); + public int getWidth(char character) { + if (character >= charsWidths.length) { + throw new IllegalArgumentException("Invalid character: " + + character + " (" + Integer.toString(character) + + "), maximum is " + (charsWidths.length - 1)); } - return charsWidths[characterIndex]; + return charsWidths[character]; } /** @@ -234,7 +235,7 @@ public class CharacterSetOrientation { * The first character in the character set * @param firstChar the first character */ - public void setFirstChar(int firstChar) { + public void setFirstChar(char firstChar) { this.firstChar = firstChar; } @@ -242,17 +243,17 @@ public class CharacterSetOrientation { * The last character in the character set * @param lastChar the last character */ - public void setLastChar(int lastChar) { + public void setLastChar(char lastChar) { this.lastChar = lastChar; } /** * Set the width (in 1/1000ths of a point size) of the character * identified by the parameter passed. - * @param character the character for which the width is being set + * @param character the Unicode character for which the width is being set * @param width the widths of the character */ - public void setWidth(int character, int width) { + public void setWidth(char character, int width) { if (character >= charsWidths.length) { // Increase the size of the array if necessary // TODO Can we remove firstChar? surely firstChar==0 at this stage? |