jeremias 2003/01/21 02:44:36
Modified: src/org/apache/fop/fonts/truetype TTFFile.java
Log:
Fix for bug 16257 (bad ascender/descender in XML font metrics)
Ascender and Descender are now read from the OS/2 table if the values in the hhea
table are zero.
Revision Changes Path
1.3 +16 -4 xml-fop/src/org/apache/fop/fonts/truetype/TTFFile.java
Index: TTFFile.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/truetype/TTFFile.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TTFFile.java 9 Jan 2003 13:51:06 -0000 1.2
+++ TTFFile.java 21 Jan 2003 10:44:36 -0000 1.3
@@ -83,6 +83,8 @@
private int ansiWidth[];
private Map ansiIndex;
+
+ private TTFDirTabEntry currentDirTab;
/**
* Position inputstream to position indicated
@@ -93,10 +95,10 @@
TTFDirTabEntry dt = (TTFDirTabEntry)dirTabs.get(name);
if (dt == null) {
getLogger().error("Dirtab " + name + " not found.");
- return;
+ } else {
+ in.seekSet(dt.getOffset() + offset);
+ this.currentDirTab = dt;
}
-
- in.seekSet(dt.getOffset() + offset);
}
/**
@@ -711,6 +713,16 @@
in.skip(2 + 2 + 3 * 2 + 8 * 2);
nhmtx = in.readTTFUShort();
getLogger().debug("Number of horizontal metrics: " + nhmtx);
+
+ //Check OS/2 table for ascender/descender if necessary
+ if (ascender == 0 || descender == 0) {
+ seekTab(in, "OS/2", 68);
+ if (this.currentDirTab.getLength() >= 78) {
+ ascender = in.readTTFShort(); //sTypoAscender
+ descender = in.readTTFShort(); //sTypoDescender
+ }
+ }
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]