aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-01-21 10:44:36 +0000
committerJeremias Maerki <jeremias@apache.org>2003-01-21 10:44:36 +0000
commit10d2871a4accc07921a770113fd134f8c6c3e778 (patch)
tree195cc689e647ca13ba04cb4bbb8070d06eb7c0d8 /src
parent32d91d65bc6eb17693e65b04d76ae7b5c4f30c23 (diff)
downloadxmlgraphics-fop-10d2871a4accc07921a770113fd134f8c6c3e778.tar.gz
xmlgraphics-fop-10d2871a4accc07921a770113fd134f8c6c3e778.zip
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. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195875 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/fonts/truetype/TTFFile.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/org/apache/fop/fonts/truetype/TTFFile.java b/src/org/apache/fop/fonts/truetype/TTFFile.java
index 1efe0f88c..e1140e947 100644
--- a/src/org/apache/fop/fonts/truetype/TTFFile.java
+++ b/src/org/apache/fop/fonts/truetype/TTFFile.java
@@ -83,6 +83,8 @@ public class TTFFile extends AbstractLogEnabled {
private int ansiWidth[];
private Map ansiIndex;
+
+ private TTFDirTabEntry currentDirTab;
/**
* Position inputstream to position indicated
@@ -93,10 +95,10 @@ public class TTFFile extends AbstractLogEnabled {
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 @@ public class TTFFile extends AbstractLogEnabled {
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
+ }
+ }
+
}
/**