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);
/**
* The character widths in the character set (indexed using Unicode codepoints)
*/
- private int[] charsWidths = null;
+ private int[] charsWidths;
/**
* The height of lowercase letters
*/
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);
}
return this.spaceIncrement;
}
- /**
- * 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
}
/**
- * 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;
}
-
}
}
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?
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.