aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-07-22 10:57:01 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-07-22 10:57:01 +0000
commit6135b505469fd83b78b710635a06c558eeecf8d6 (patch)
treed5859f1d860f1ddb113f1791c92fad2102bfbaf5 /src/java/org/apache
parent52b95f1c48e84eaaca934d8b0504734fd52fc9bf (diff)
downloadxmlgraphics-fop-6135b505469fd83b78b710635a06c558eeecf8d6.tar.gz
xmlgraphics-fop-6135b505469fd83b78b710635a06c558eeecf8d6.zip
Minor cleanup.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@678710 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/render/afp/fonts/CharacterSet.java45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java b/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
index 59511e693..d36c78d7d 100644
--- a/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
+++ b/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
@@ -49,6 +49,8 @@ public class CharacterSet {
/** Static logging instance */
protected static final Log log = LogFactory.getLog(CharacterSet.class.getName());
+ private static final int MAX_NAME_LEN = 8;
+
/** The code page to which the character set relates */
protected String codePage;
@@ -64,7 +66,7 @@ public class CharacterSet {
/** Indicator as to whether to metrics have been loaded */
private boolean isMetricsLoaded = false;
- /** The current orientation (currently only 0 is suppoted by FOP) */
+ /** The current orientation (currently only 0 is supported by FOP) */
private String currentOrientation = "0";
/** The collection of objects for each orientation */
@@ -79,27 +81,23 @@ public class CharacterSet {
* @param name the character set name
* @param path the path to the installed afp fonts
*/
- public CharacterSet(
- String codePage,
- String encoding,
- String name,
- String path) {
-
- if (name.length() > 8) {
- String msg = "Character set name must be a maximum of 8 characters " + name;
+ public CharacterSet(String codePage, String encoding, String name, String path) {
+ if (name.length() > MAX_NAME_LEN) {
+ String msg = "Character set name '" + name + "' must be a maximum of "
+ + MAX_NAME_LEN + " characters";
log.error("Constructor:: " + msg);
throw new IllegalArgumentException(msg);
}
- if (name.length() < 8) {
- this.name = StringUtils.rpad(name, ' ', 8);
+ if (name.length() < MAX_NAME_LEN) {
+ this.name = StringUtils.rpad(name, ' ', MAX_NAME_LEN);
} else {
this.name = name;
}
-
this.codePage = codePage;
this.encoding = encoding;
this.path = path;
+
this.characterSetOrientations = new java.util.HashMap(4);
}
@@ -121,7 +119,7 @@ public class CharacterSet {
* a character rotation other than 0, ascender height loses its
* meaning when the character is lying on its side or is upside down
* with respect to normal viewing orientation. For the general case,
- * Ascender Height is the character�s most positive y-axis value.
+ * Ascender Height is the characters most positive y-axis value.
* For bounded character boxes, for a given character having an
* ascender, ascender height and baseline offset are equal.
*
@@ -157,9 +155,9 @@ public class CharacterSet {
}
/**
- * The first character in the character set
+ * Returns the first character in the character set
*
- * @return the first character
+ * @return the first character in the character set
*/
public int getFirstChar() {
load();
@@ -169,7 +167,7 @@ public class CharacterSet {
/**
* Returns the last character in the character set
*
- * @return the last character
+ * @return the last character in the character set
*/
public int getLastChar() {
load();
@@ -197,6 +195,7 @@ public class CharacterSet {
/**
* XHeight refers to the height of the lower case letters above the baseline.
+ *
* @return the typical height of characters
*/
public int getXHeight() {
@@ -231,16 +230,16 @@ public class CharacterSet {
/**
* Returns the AFP character set identifier
*
- * @return String
+ * @return the AFP character set identifier
*/
public String getName() {
return name;
}
/**
- * Returns the AFP character set identifier
+ * Returns the AFP character set identifier as a byte array
*
- * @return the AFP character set identifier
+ * @return the AFP character set identifier as a byte array
*/
public byte[] getNameBytes() {
byte[] nameBytes = null;
@@ -249,8 +248,7 @@ public class CharacterSet {
} catch (UnsupportedEncodingException usee) {
nameBytes = name.getBytes();
log.warn(
- "UnsupportedEncodingException translating the name "
- + name);
+ "UnsupportedEncodingException translating the name " + name);
}
return nameBytes;
}
@@ -281,16 +279,15 @@ public class CharacterSet {
* implementation (whenever FOP implement the mechanism). This is also
* the case for landscape prints which use an orientation of 270 degrees,
* in 99.9% of cases the font metrics will be the same as the 0 degrees
- * therefore the implementation currely will always use 0 degrees.
+ * therefore the implementation currently will always use 0 degrees.
+ *
*
* @return characterSetOrentation The current orientation metrics.
*/
private CharacterSetOrientation getCharacterSetOrientation() {
-
CharacterSetOrientation c
= (CharacterSetOrientation) characterSetOrientations.get(currentOrientation);
return c;
-
}
/**