diff options
author | Mehdi Houshmand <mehdi@apache.org> | 2012-05-31 08:33:36 +0000 |
---|---|---|
committer | Mehdi Houshmand <mehdi@apache.org> | 2012-05-31 08:33:36 +0000 |
commit | eccd73c523bdda6a0634e9849141492f7b14ad63 (patch) | |
tree | 72f06ec1481249bdd639083ee646b3c3fd4be7a4 /src/java/org/apache/fop/fonts/apps | |
parent | 05761b1df54ada8a762bfa879dc0e3455d33d828 (diff) | |
download | xmlgraphics-fop-eccd73c523bdda6a0634e9849141492f7b14ad63.tar.gz xmlgraphics-fop-eccd73c523bdda6a0634e9849141492f7b14ad63.zip |
Started unifying URI resolution mechanism, redesigned configuration system and created flexible config testing
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_URI_Unification@1344594 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fonts/apps')
-rw-r--r-- | src/java/org/apache/fop/fonts/apps/TTFReader.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/fonts/apps/TTFReader.java b/src/java/org/apache/fop/fonts/apps/TTFReader.java index 6acb490c2..8d06f0e6b 100644 --- a/src/java/org/apache/fop/fonts/apps/TTFReader.java +++ b/src/java/org/apache/fop/fonts/apps/TTFReader.java @@ -19,7 +19,9 @@ package org.apache.fop.fonts.apps; +import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -220,12 +222,17 @@ public class TTFReader extends AbstractFontReader { public TTFFile loadTTF(String fileName, String fontName, boolean useKerning, boolean useAdvanced) throws IOException { TTFFile ttfFile = new TTFFile(useKerning, useAdvanced); log.info("Reading " + fileName + "..."); - - FontFileReader reader = new FontFileReader(fileName); - boolean supported = ttfFile.readFont(reader, fontName); - if (!supported) { - return null; + InputStream stream = new FileInputStream(fileName); + try { + FontFileReader reader = new FontFileReader(stream); + boolean supported = ttfFile.readFont(reader, fontName); + if (!supported) { + return null; + } + } finally { + stream.close(); } + log.info("Font Family: " + ttfFile.getFamilyNames()); if (ttfFile.isCFF()) { throw new UnsupportedOperationException( @@ -460,9 +467,9 @@ public class TTFReader extends AbstractFontReader { Map h2; if (isCid) { - h2 = (Map)ttf.getKerning().get(kpx1); + h2 = ttf.getKerning().get(kpx1); } else { - h2 = (Map)ttf.getAnsiKerning().get(kpx1); + h2 = ttf.getAnsiKerning().get(kpx1); } Iterator iter2 = h2.keySet().iterator(); |