Browse Source

Buzilla#53657 - AFP fonts use nominal character increment when the glyph metrics aren't available


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1371629 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_0
Mehdi Houshmand 11 years ago
parent
commit
ce3600f754

+ 8
- 0
src/java/org/apache/fop/afp/fonts/CharacterSet.java View File

return getCharacterSetOrientation().getEmSpaceIncrement(); return getCharacterSetOrientation().getEmSpaceIncrement();
} }


/**
* Returns the nominal character increment.
* @return the nominal character increment
*/
public int getNominalCharIncrement() {
return getCharacterSetOrientation().getNominalCharIncrement();
}

} }

+ 5
- 10
src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java View File

position++; position++;


if (position == 26) { if (position == 26) {

position = 0; position = 0;


int orientation = determineOrientation(fnoData[2]); 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); return orientations.toArray(EMPTY_CSO_ARRAY);

+ 16
- 24
src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java View File

/** /**
* The character widths in the character set (indexed using Unicode codepoints) * The character widths in the character set (indexed using Unicode codepoints)
*/ */
private int[] charsWidths = null;
private int[] charsWidths;


/** /**
* The height of lowercase letters * The height of lowercase letters
*/ */
private char lastChar; private char lastChar;



/**
* The character set orientation
*/
private int orientation = 0;

/** The character set orientation */
private final int orientation;
/** space increment */ /** space increment */
private int spaceIncrement;
private final int spaceIncrement;
/** em space increment */ /** 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 * Constructor for the CharacterSetOrientation, the orientation is
* expressed as the degrees rotation (i.e 0, 90, 180, 270) * expressed as the degrees rotation (i.e 0, 90, 180, 270)
* @param orientation the character set orientation * @param orientation the character set orientation
*/ */
public CharacterSetOrientation(int orientation) {
public CharacterSetOrientation(int orientation, int spaceIncrement, int emSpaceIncrement,
int nomCharIncrement) {
this.orientation = orientation; this.orientation = orientation;
this.spaceIncrement = spaceIncrement;
this.emSpaceIncrement = emSpaceIncrement;
this.nomCharIncrement = nomCharIncrement;
charsWidths = new int[256]; charsWidths = new int[256];
Arrays.fill(charsWidths, -1); Arrays.fill(charsWidths, -1);
} }
return this.spaceIncrement; 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. * Returns the em space increment.
* @return 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;
} }

} }

+ 10
- 1
src/java/org/apache/fop/afp/fonts/DoubleByteFont.java View File

} }


if (charWidth == -1) { if (charWidth == -1) {
charWidth = inferCharWidth(character);
charWidth = getDefaultCharacterWidth(character);
} }
return charWidth * size; 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) { private int inferCharWidth(int character) {


//Is this character an ideograph? //Is this character an ideograph?

+ 4
- 0
status.xml View File

documents. Example: the fix of marks layering will be such a case when it's done. documents. Example: the fix of marks layering will be such a case when it's done.
--> -->
<release version="FOP Trunk" date="TBD"> <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"> <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 Wrong page number reported when a column overflows the region-body in a multi-column
document. document.

Loading…
Cancel
Save