git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1371629 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_0
@@ -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(); | |||
} | |||
} |
@@ -446,20 +446,15 @@ public abstract class CharacterSetBuilder { | |||
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); |
@@ -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); | |||
} | |||
@@ -283,14 +284,6 @@ public class CharacterSetOrientation { | |||
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 | |||
@@ -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; | |||
} | |||
} |
@@ -80,11 +80,20 @@ public class DoubleByteFont extends AbstractOutlineFont { | |||
} | |||
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? |
@@ -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. |