diff options
author | Jeremias Maerki <jeremias@apache.org> | 2003-05-27 14:05:49 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2003-05-27 14:05:49 +0000 |
commit | e261d72b6a5663db05beda713f102c4a9fc978bd (patch) | |
tree | 40021c7f0386079026a95890821ed84e7c946738 | |
parent | 77f33832b84793a7552a1f0aec56485702de3c26 (diff) | |
download | xmlgraphics-fop-e261d72b6a5663db05beda713f102c4a9fc978bd.tar.gz xmlgraphics-fop-e261d72b6a5663db05beda713f102c4a9fc978bd.zip |
Use copy method from Commons IO
Bugfix: Names in Unicode don't get extracted properly (#20239)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196460 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/fonts/truetype/FontFileReader.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java index 1c098a875..d141435c6 100644 --- a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java +++ b/src/java/org/apache/fop/fonts/truetype/FontFileReader.java @@ -54,7 +54,7 @@ import java.io.InputStream; import java.io.File; import java.io.IOException; -import org.apache.fop.util.StreamUtilities; +import org.apache.commons.io.IOUtil; /** * Reads a TrueType font file into a byte array and @@ -75,7 +75,7 @@ public class FontFileReader { private void init(InputStream in) throws java.io.IOException { java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream(); try { - StreamUtilities.streamCopy(in, bout); + IOUtil.copy(in, bout); this.file = bout.toByteArray(); this.fsize = this.file.length; this.current = 0; @@ -341,7 +341,13 @@ public class FontFileReader { byte[] tmp = new byte[len]; System.arraycopy(file, current, tmp, 0, len); current += len; - return new String(tmp, "ISO-8859-1"); + final String encoding; + if ((tmp.length > 0) && (tmp[0] == 0)) { + encoding = "UnicodeBig"; + } else { + encoding = "ISO-8859-1"; + } + return new String(tmp, encoding); } /** |