pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1618898 - in /pdfbox/branches/no-awt: fontbox/src/main/java/org/apache/fontbox/ttf/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/ pdfbox/src/main/java/org/apache/pdfbox/rendering/font/
Date Tue, 19 Aug 2014 17:03:03 GMT
Author: jahewson
Date: Tue Aug 19 17:03:02 2014
New Revision: 1618898

URL: http://svn.apache.org/r1618898
Log:
PDFBOX-2262: Don't use RAFDataStream

Modified:
    pdfbox/branches/no-awt/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfSimpleDescript.java
    pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
    pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/TTFGlyph2D.java

Modified: pdfbox/branches/no-awt/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfSimpleDescript.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/no-awt/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfSimpleDescript.java?rev=1618898&r1=1618897&r2=1618898&view=diff
==============================================================================
--- pdfbox/branches/no-awt/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfSimpleDescript.java
(original)
+++ pdfbox/branches/no-awt/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfSimpleDescript.java
Tue Aug 19 17:03:02 2014
@@ -186,26 +186,18 @@ public class GlyfSimpleDescript extends 
      */
     private void readFlags(int flagCount, TTFDataStream bais) throws IOException
     {
-        try
+        for (int index = 0; index < flagCount; index++)
         {
-            for (int index = 0; index < flagCount; index++)
+            flags[index] = (byte) bais.readUnsignedByte();
+            if ((flags[index] & REPEAT) != 0)
             {
-                flags[index] = (byte) bais.readUnsignedByte();
-                if ((flags[index] & REPEAT) != 0)
+                int repeats = bais.readUnsignedByte();
+                for (int i = 1; i <= repeats; i++)
                 {
-                    int repeats = bais.readUnsignedByte();
-                    for (int i = 1; i <= repeats; i++)
-                    {
-                        flags[index + i] = flags[index];
-                    }
-                    index += repeats;
+                    flags[index + i] = flags[index];
                 }
+                index += repeats;
             }
         }
-        catch (ArrayIndexOutOfBoundsException e)
-        {
-            LOG.error("error: array index out of bounds", e);
-        }
     }
-
 }

Modified: pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java?rev=1618898&r1=1618897&r2=1618898&view=diff
==============================================================================
--- pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
(original)
+++ pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java
Tue Aug 19 17:03:02 2014
@@ -188,7 +188,10 @@ final class FileSystemFontProvider imple
             TTFParser ttfParser = new TTFParser(false, true);
             try
             {
-                ttf = ttfParser.parseTTF(file);
+                // fixme: RAFDataStream appears to be broken
+                //ttf = ttfParser.parseTTF(file);
+                ttf = ttfParser.parseTTF(new FileInputStream(file));
+
                 ttfFonts.put(postScriptName, ttf);
                 if (LOG.isDebugEnabled())
                 {

Modified: pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/TTFGlyph2D.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/TTFGlyph2D.java?rev=1618898&r1=1618897&r2=1618898&view=diff
==============================================================================
--- pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/TTFGlyph2D.java
(original)
+++ pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/TTFGlyph2D.java
Tue Aug 19 17:03:02 2014
@@ -203,8 +203,9 @@ public class TTFGlyph2D implements Glyph
             }
             catch (RuntimeException e)
             {
-                throw new RuntimeException("Error in TTF:" + pdFont.getBaseFont() + " ->
" +
-                        ttf.getNaming().getPostScriptName(), e);
+                LOG.error("Error in TTF: " + pdFont.getBaseFont() + " -> " +
+                        ttf.getNaming().getPostScriptName());
+                throw e;
             }
 
             if (glyphId >= glyphData.length)



Mime
View raw message