pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1798251 - in /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf: MemoryTTFDataStream.java RAFDataStream.java TTCDataStream.java TTFDataStream.java TrueTypeFont.java
Date Fri, 09 Jun 2017 17:23:56 GMT
Author: tilman
Date: Fri Jun  9 17:23:55 2017
New Revision: 1798251

URL: http://svn.apache.org/viewvc?rev=1798251&view=rev
Log:
PDFBOX-3824: get the length of a ttf datastream

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/RAFDataStream.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTCDataStream.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java?rev=1798251&r1=1798250&r2=1798251&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/MemoryTTFDataStream.java Fri
Jun  9 17:23:55 2017
@@ -207,4 +207,13 @@ class MemoryTTFDataStream extends TTFDat
     {
         return new ByteArrayInputStream( data );
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public long getOriginalDataSize()
+    {
+        return data.length;
+    }
 }
\ No newline at end of file

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/RAFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/RAFDataStream.java?rev=1798251&r1=1798250&r2=1798251&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/RAFDataStream.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/RAFDataStream.java Fri Jun 
9 17:23:55 2017
@@ -175,4 +175,13 @@ class RAFDataStream extends TTFDataStrea
     {
         return new FileInputStream( ttfFile );
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public long getOriginalDataSize()
+    {
+        return ttfFile.length();
+    }
 }

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTCDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTCDataStream.java?rev=1798251&r1=1798250&r2=1798251&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTCDataStream.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTCDataStream.java Fri Jun 
9 17:23:55 2017
@@ -88,4 +88,10 @@ class TTCDataStream extends TTFDataStrea
     {
         return stream.getOriginalData();
     }
+
+    @Override
+    public long getOriginalDataSize()
+    {
+        return stream.getOriginalDataSize();
+    }
 }

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java?rev=1798251&r1=1798250&r2=1798251&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java Fri Jun 
9 17:23:55 2017
@@ -304,4 +304,11 @@ abstract class TTFDataStream implements
      */
     public abstract InputStream getOriginalData() throws IOException;
 
+    /**
+     * This will get the original data size that was used for this stream.
+     * 
+     * @return The size of the original data.
+     * @throws IOException If there is an issue reading the data.
+     */
+    public abstract long getOriginalDataSize();
 }

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java?rev=1798251&r1=1798250&r2=1798251&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TrueTypeFont.java Fri Jun  9
17:23:55 2017
@@ -325,7 +325,20 @@ public class TrueTypeFont implements Fon
     {
        return data.getOriginalData(); 
     }
-    
+
+    /**
+     * Get the data size of the TrueType Font program representing the stream used to build
this
+     * object (normally from the TTFParser object).
+     *
+     * @return the size.
+     *
+     * @throws IOException If there is an error getting the font data.
+     */
+    public long getOriginalDataSize()
+    {
+        return data.getOriginalDataSize();
+    }
+
     /**
      * Read the given table if necessary. Package-private, used by TTFParser only.
      * 



Mime
View raw message