jeremias 2003/01/21 02:43:56 Modified: src/org/apache/fop/fonts Tag: fop-0_20_2-maintain 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 No revision No revision 1.6.2.7 +15 -4 xml-fop/src/org/apache/fop/fonts/Attic/TTFFile.java Index: TTFFile.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/Attic/TTFFile.java,v retrieving revision 1.6.2.6 retrieving revision 1.6.2.7 diff -u -r1.6.2.6 -r1.6.2.7 --- TTFFile.java 9 Jan 2003 13:47:25 -0000 1.6.2.6 +++ TTFFile.java 21 Jan 2003 10:43:56 -0000 1.6.2.7 @@ -68,6 +68,8 @@ int ansiWidth[]; HashMap ansiIndex; + private TTFDirTabEntry currentDirTab; + /** * Position inputstream to position indicated * in the dirtab offset + offset @@ -77,10 +79,10 @@ TTFDirTabEntry dt = (TTFDirTabEntry)dirTabs.get(name); if (dt == null) { System.out.println("Dirtab " + name + " not found."); - return; + } else { + in.seek_set(dt.offset + offset); + this.currentDirTab = dt; } - - in.seek_set(dt.offset + offset); } /** @@ -638,6 +640,15 @@ in.skip(2 + 2 + 3 * 2 + 8 * 2); nhmtx = in.readTTFUShort(); // System.out.println("Number of horizontal metrics: " + nhmtx); + + //Check OS/2 table for ascender/descender if necessary + if (ascender == 0 || descender == 0) { + seek_tab(in, "OS/2", 68); + if (this.currentDirTab.length >= 78) { + ascender = in.readTTFShort(); //sTypoAscender + descender = in.readTTFShort(); //sTypoDescender + } + } } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]