You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/07/22 12:57:02 UTC

svn commit: r678710 - /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java

Author: acumiskey
Date: Tue Jul 22 03:57:01 2008
New Revision: 678710

URL: http://svn.apache.org/viewvc?rev=678710&view=rev
Log:
Minor cleanup.

Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java?rev=678710&r1=678709&r2=678710&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java Tue Jul 22 03:57:01 2008
@@ -49,6 +49,8 @@
     /** 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 @@
     /** 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 @@
      * @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 @@
      * 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 @@
     }
 
     /**
-     * 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 @@
     /**
      * 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 @@
 
     /**
      * 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 @@
     /**
      * 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 @@
         } catch (UnsupportedEncodingException usee) {
             nameBytes = name.getBytes();
             log.warn(
-                "UnsupportedEncodingException translating the name "
-                + name);
+                "UnsupportedEncodingException translating the name " + name);
         }
         return nameBytes;
     }
@@ -281,16 +279,15 @@
      * 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;
-
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org