xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From me...@apache.org
Subject svn commit: r1371629 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/afp/fonts/
Date Fri, 10 Aug 2012 09:50:48 GMT
Author: mehdi
Date: Fri Aug 10 09:50:47 2012
New Revision: 1371629

URL: http://svn.apache.org/viewvc?rev=1371629&view=rev
Log:
Buzilla#53657 - AFP fonts use nominal character increment when the glyph metrics aren't available


Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java?rev=1371629&r1=1371628&r2=1371629&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java Fri Aug 10 09:50:47
2012
@@ -363,4 +363,12 @@ public class CharacterSet {
         return getCharacterSetOrientation().getEmSpaceIncrement();
     }
 
+    /**
+     * Returns the nominal character increment.
+     * @return the nominal character increment
+     */
+    public int getNominalCharIncrement() {
+        return getCharacterSetOrientation().getNominalCharIncrement();
+    }
+
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java?rev=1371629&r1=1371628&r2=1371629&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java Fri Aug
10 09:50:47 2012
@@ -446,20 +446,15 @@ public abstract class CharacterSetBuilde
             position++;
 
             if (position == 26) {
-
                 position = 0;
 
                 int orientation = determineOrientation(fnoData[2]);
-                //  Space Increment
-                int space = ((fnoData[8] & 0xFF ) << 8) + (fnoData[9] & 0xFF);
-                //  Em-Space Increment
-                int em = ((fnoData[14] & 0xFF ) << 8) + (fnoData[15] & 0xFF);
-
-                CharacterSetOrientation cso = new CharacterSetOrientation(orientation);
-                cso.setSpaceIncrement(space);
-                cso.setEmSpaceIncrement(em);
-                orientations.add(cso);
+                int spaceIncrement = getUBIN(fnoData, 8);
+                int emIncrement = getUBIN(fnoData, 14);
+                int nominalCharacterIncrement = getUBIN(fnoData, 20);
 
+                orientations.add(new CharacterSetOrientation(orientation, spaceIncrement,
+                        emIncrement, nominalCharacterIncrement));
             }
         }
         return orientations.toArray(EMPTY_CSO_ARRAY);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java?rev=1371629&r1=1371628&r2=1371629&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java Fri
Aug 10 09:50:47 2012
@@ -60,7 +60,7 @@ public class CharacterSetOrientation {
     /**
      * The character widths in the character set (indexed using Unicode codepoints)
      */
-    private int[] charsWidths = null;
+    private int[] charsWidths;
 
     /**
      * The height of lowercase letters
@@ -77,25 +77,26 @@ public class CharacterSetOrientation {
      */
     private char lastChar;
 
-
-    /**
-     * The character set orientation
-     */
-    private int orientation = 0;
-
+    /** The character set orientation */
+    private final int orientation;
     /** space increment */
-    private int spaceIncrement;
+    private final int spaceIncrement;
     /** em space increment */
-    private int emSpaceIncrement = -1;
-
+    private final int emSpaceIncrement;
+    /** Nominal Character Increment */
+    private final int nomCharIncrement;
 
     /**
      * Constructor for the CharacterSetOrientation, the orientation is
      * expressed as the degrees rotation (i.e 0, 90, 180, 270)
      * @param orientation the character set orientation
      */
-    public CharacterSetOrientation(int orientation) {
+    public CharacterSetOrientation(int orientation, int spaceIncrement, int emSpaceIncrement,
+            int nomCharIncrement) {
         this.orientation = orientation;
+        this.spaceIncrement = spaceIncrement;
+        this.emSpaceIncrement = emSpaceIncrement;
+        this.nomCharIncrement = nomCharIncrement;
         charsWidths = new int[256];
         Arrays.fill(charsWidths, -1);
     }
@@ -284,14 +285,6 @@ public class CharacterSetOrientation {
     }
 
     /**
-     * Sets the space increment.
-     * @param value the space increment
-     */
-    public void setSpaceIncrement(int value) {
-        this.spaceIncrement = value;
-    }
-
-    /**
      * Returns the em space increment.
      * @return the em space increment
      */
@@ -300,11 +293,10 @@ public class CharacterSetOrientation {
     }
 
     /**
-     * Sets the em space increment.
-     * @param value the em space increment
+     * Returns the nominal character increment.
+     * @return the nominal character increment
      */
-    public void setEmSpaceIncrement(int value) {
-        this.emSpaceIncrement = value;
+    public int getNominalCharIncrement() {
+        return this.nomCharIncrement;
     }
-
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java?rev=1371629&r1=1371628&r2=1371629&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java Fri Aug 10
09:50:47 2012
@@ -80,11 +80,20 @@ public class DoubleByteFont extends Abst
         }
 
         if (charWidth == -1) {
-            charWidth = inferCharWidth(character);
+            charWidth = getDefaultCharacterWidth(character);
         }
         return charWidth * size;
     }
 
+    private int getDefaultCharacterWidth(int character) {
+        int nominalCharIncrement = charSet.getNominalCharIncrement();
+        if (nominalCharIncrement > 0) {
+            return nominalCharIncrement;
+        } else {
+            return inferCharWidth(character);
+        }
+    }
+
     private int inferCharWidth(int character) {
 
         //Is this character an ideograph?

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1371629&r1=1371628&r2=1371629&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Fri Aug 10 09:50:47 2012
@@ -62,6 +62,10 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Fonts" dev="MH" type="fix" fixes-bug="53657" due-to="Robert Meyer">
+        AFP fonts default to the nominal character increment to font metrics when glyph info
+        is missing from the characterset.
+      </action>
       <action context="Layout" dev="VH" type="fix" fixes-bug="53688">
         Wrong page number reported when a column overflows the region-body in a multi-column

         document.



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


Mime
View raw message