You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2003/05/27 16:05:50 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fonts/truetype FontFileReader.java

jeremias    2003/05/27 07:05:50

  Modified:    src/java/org/apache/fop/fonts/truetype FontFileReader.java
  Log:
  Use copy method from Commons IO
  Bugfix: Names in Unicode don't get extracted properly (#20239)
  
  Revision  Changes    Path
  1.2       +9 -3      xml-fop/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
  
  Index: FontFileReader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/truetype/FontFileReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FontFileReader.java	11 Mar 2003 13:05:23 -0000	1.1
  +++ FontFileReader.java	27 May 2003 14:05:49 -0000	1.2
  @@ -54,7 +54,7 @@
   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 @@
       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 @@
           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);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org