diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2010-07-02 17:23:36 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2010-07-02 17:23:36 +0000 |
commit | 589c8ab356833617014977ab1a7a8ee6c181359a (patch) | |
tree | 24324df53f44154ecf31f7d056ff760a4ace134c | |
parent | 28e4838961e59c4d016a27a6a6f1efa158fa6bf9 (diff) | |
download | xmlgraphics-fop-589c8ab356833617014977ab1a7a8ee6c181359a.tar.gz xmlgraphics-fop-589c8ab356833617014977ab1a7a8ee6c181359a.zip |
Trying to get a glyph name out of a Unicode code point is already done by the call to mapChar, so doing it again in TTFFontLoader is useless. Instead, make use of the post table if it exists, that may contain a list of glyph names and allow more glyphs to be supported.
That allows to reference instead of embed a TrueType font that is already installed on the printer.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript@960065 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/fonts/truetype/TTFFile.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/java/org/apache/fop/fonts/truetype/TTFFile.java index 9fd6adbce..a1b6319ed 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFFile.java @@ -1691,6 +1691,10 @@ public class TTFFile { return result; } + String getGlyphName(int glyphIndex) { + return mtxTab[glyphIndex].getName(); + } + /** * Static main method to get info about a TrueType font. * @param args The command line arguments diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java b/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java index df8cce1b2..10e618adf 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java @@ -27,8 +27,6 @@ import java.util.Map; import org.apache.commons.io.IOUtils; -import org.apache.xmlgraphics.fonts.Glyphs; - import org.apache.fop.fonts.BFEntry; import org.apache.fop.fonts.CIDFontType; import org.apache.fop.fonts.EncodingMode; @@ -187,11 +185,11 @@ public class TTFFontLoader extends FontLoader { for (char u = (char)ce.getUnicodeStart(); u <= ce.getUnicodeEnd(); u++) { int codePoint = singleFont.getEncoding().mapChar(u); if (codePoint <= 0) { - String unicode = Character.toString(u); - String charName = Glyphs.stringToGlyph(unicode); - if (charName.length() > 0) { - NamedCharacter nc = new NamedCharacter(charName, unicode); - int glyphIndex = ce.getGlyphStartIndex() + u - ce.getUnicodeStart(); + int glyphIndex = ce.getGlyphStartIndex() + u - ce.getUnicodeStart(); + String glyphName = ttf.getGlyphName(glyphIndex); + if (glyphName != "") { + String unicode = Character.toString(u); + NamedCharacter nc = new NamedCharacter(glyphName, unicode); singleFont.addUnencodedCharacter(nc, wx[glyphIndex]); } } |