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 ss...@apache.org on 2017/03/08 13:58:08 UTC

svn commit: r1785969 - in /xmlgraphics/fop/trunk/fop-core/src: main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java

Author: ssteiner
Date: Wed Mar  8 13:58:08 2017
New Revision: 1785969

URL: http://svn.apache.org/viewvc?rev=1785969&view=rev
Log:
FOP-2697: Adobe Reader error with Adobe Kozuka Mincho font

Modified:
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
    xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java?rev=1785969&r1=1785968&r2=1785969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java Wed Mar  8 13:58:08 2017
@@ -172,7 +172,7 @@ public class OTFSubSetFile extends OTFFi
         writeBytes(cffReader.getHeader());
 
         //Name Index
-        writeIndex(Arrays.asList(embeddedName.getBytes()));
+        writeIndex(Arrays.asList(embedFontName.getBytes()));
 
         //Keep offset of the topDICT so it can be updated once all data has been written
         int topDictOffset = currentPos;

Modified: xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java?rev=1785969&r1=1785968&r2=1785969&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java Wed Mar  8 13:58:08 2017
@@ -37,6 +37,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import org.apache.fontbox.cff.CFFFont;
+import org.apache.fontbox.cff.CFFParser;
 
 import org.apache.fop.fonts.cff.CFFDataReader;
 import org.apache.fop.fonts.cff.CFFDataReader.CFFIndexData;
@@ -435,8 +436,8 @@ public class OTFSubSetFileTestCase exten
 
     @Test
     public void testFDSelect() throws IOException {
-        Assert.assertEquals(getSubset(1).length, 39);
-        Assert.assertEquals(getSubset(2).length, 46);
+        Assert.assertEquals(getSubset(1).length, 41);
+        Assert.assertEquals(getSubset(2).length, 48);
     }
 
     private byte[] getSubset(final int opLen) throws IOException {
@@ -468,4 +469,19 @@ public class OTFSubSetFileTestCase exten
         otfSubSetFile.readFont(reader, "StandardOpenType", header, new HashMap<Integer, Integer>());
         return otfSubSetFile.getFontSubset();
     }
+
+    @Test
+    public void testOffsets() throws IOException {
+        Map<Integer, Integer> glyphs = new HashMap<Integer, Integer>();
+        for (int i = 0; i < 256; i++) {
+            glyphs.put(i, i);
+        }
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < 2048; i++) {
+            sb.append("SourceSansProBold");
+        }
+        OTFSubSetFile otfSubSetFile = new OTFSubSetFile();
+        otfSubSetFile.readFont(sourceSansReader, sb.toString(), null, glyphs);
+        new CFFParser().parse(otfSubSetFile.getFontSubset());
+    }
 }



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