svn commit: r1739076 - in /xmlgraphics/fop/trunk: fop-core/ fop-core/src/main/java/org/apache/fop/fonts/truetype/ fop-core/src/test/java/org/apache/fop/fonts/truetype/ fop/lib/

[email protected]
Newsgroups gmane.text.xml.fop.cvs
Message-ID <[email protected]>
Author: ssteiner
Date: Thu Apr 14 12:40:55 2016
New Revision: 1739076

URL: http://svn.apache.org/viewvc?rev=1739076&view=rev
Log:
FOP-2562: Update to PDFBox 2

Added:
    xmlgraphics/fop/trunk/fop/lib/fontbox-2.0.0.jar   (with props)
Removed:
    xmlgraphics/fop/trunk/fop/lib/fontbox-1.8.5.jar
Modified:
    xmlgraphics/fop/trunk/fop-core/pom.xml
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFFile.java
    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
    xmlgraphics/fop/trunk/fop/lib/xmlgraphics-commons-svn-trunk.jar

Modified: xmlgraphics/fop/trunk/fop-core/pom.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/pom.xml?rev=1739076&r1=1739075&r2=1739076&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/pom.xml (original)
+++ xmlgraphics/fop/trunk/fop-core/pom.xml Thu Apr 14 12:40:55 2016
@@ -100,7 +100,7 @@
     <dependency>
       <groupId>org.apache.pdfbox</groupId>
       <artifactId>fontbox</artifactId>
-      <version>1.8.5</version>
+      <version>2.0.0</version>
     </dependency>
     <!-- test deps -->
     <dependency>

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFFile.java?rev=1739076&r1=1739075&r2=1739076&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFFile.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFFile.java Thu Apr 14 12:40:55 2016
@@ -20,17 +20,10 @@
 package org.apache.fop.fonts.truetype;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.fontbox.cff.CFFDataInput;
 import org.apache.fontbox.cff.CFFFont;
 import org.apache.fontbox.cff.CFFParser;
-import org.apache.fontbox.cff.charset.CFFCharset;
 
 public class OTFFile extends OpenFont {
 
@@ -56,44 +49,6 @@ public class OTFFile extends OpenFont {
 
     @Override
     protected void updateBBoxAndOffset() throws IOException {
-        List<Mapping> gidMappings = getGIDMappings(fileFont);
-        Map<Integer, String> sidNames = constructNameMap(gidMappings);
-        UnicodeMapping[] mappings = unicodeMappings.toArray(new UnicodeMapping[unicodeMappings.size()]);
-        for (int i = 0; i < mappings.length; i++) {
-            int glyphIdx = mappings[i].getGlyphIndex();
-            Mapping m = gidMappings.get(glyphIdx);
-            String name = sidNames.get(m.getSID());
-            mtxTab[glyphIdx].setName(name);
-        }
-    }
-
-    private List<Mapping> getGIDMappings(CFFFont font) {
-        List<Mapping> gidMappings = new ArrayList<Mapping>();
-        Mapping notdef = new Mapping();
-        gidMappings.add(notdef);
-        for (CFFCharset.Entry entry : font.getCharset().getEntries()) {
-            String name = entry.getName();
-            byte[] bytes = font.getCharStringsDict().get(name);
-            if (bytes == null) {
-                continue;
-            }
-            Mapping mapping = new Mapping();
-            mapping.setSID(entry.getSID());
-            mapping.setName(name);
-            mapping.setBytes(bytes);
-            gidMappings.add(mapping);
-        }
-        return gidMappings;
-    }
-
-    private Map<Integer, String> constructNameMap(Collection<Mapping> mappings) {
-        Map<Integer, String> sidNames = new HashMap<Integer, String>();
-        Iterator<Mapping> it = mappings.iterator();
-        while (it.hasNext()) {
-            Mapping mapping = it.next();
-            sidNames.put(mapping.getSID(), mapping.getName());
-        }
-        return sidNames;
     }
 
     private static class Mapping {
@@ -136,7 +91,7 @@ public class OTFFile extends OpenFont {
     }
 
     protected void readName() throws IOException {
-        Object familyName = fileFont.getProperty("FamilyName");
+        Object familyName = fileFont.getTopDict().get("FamilyName");
         if (familyName != null && !familyName.equals("")) {
             familyNames.add(familyName.toString());
             fullName = familyName.toString();

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=1739076&r1=1739075&r2=1739076&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 Thu Apr 14 12:40:55 2016
@@ -35,7 +35,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.fontbox.cff.CFFStandardString;
-import org.apache.fontbox.cff.encoding.CFFEncoding;
 
 import org.apache.fop.fonts.MultiByteFont;
 import org.apache.fop.fonts.cff.CFFDataReader;
@@ -207,7 +206,6 @@ public class OTFSubSetFile extends OTFFi
 
         //Encoding
         int encodingOffset = currentPos;
-        writeEncoding(fileFont.getEncoding());
 
         //Charset table
         int charsetOffset = currentPos;
@@ -271,20 +269,6 @@ public class OTFSubSetFile extends OTFFi
         }
     }
 
-    private void writeEncoding(CFFEncoding encoding) throws IOException {
-        LinkedHashMap<String, DICTEntry> topDICT = cffReader.getTopDictEntries();
-        DICTEntry encodingEntry = topDICT.get("Encoding");
-        if (encodingEntry != null && encodingEntry.getOperands().get(0).intValue() != 0
-                && encodingEntry.getOperands().get(0).intValue() != 1) {
-            writeByte(0);
-            writeByte(gidToSID.size());
-            for (int gid : gidToSID.keySet()) {
-                int code = encoding.getCode(gidToSID.get(gid));
-                writeByte(code);
-            }
-        }
-    }
-
     protected void writeTopDICT() throws IOException {
         LinkedHashMap<String, DICTEntry> topDICT = cffReader.getTopDictEntries();
         List<String> topDictStringEntries = Arrays.asList("version", "Notice", "Copyright",

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=1739076&r1=1739075&r2=1739076&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 Thu Apr 14 12:40:55 2016
@@ -102,10 +102,9 @@ public class OTFSubSetFileTestCase exten
             throws IOException {
         CFFFont sourceSansOriginal = sourceSansProBold.fileFont;
         CFFIndexData charStrings = subsetCFF.getCharStringIndex();
-        Map<String, byte[]> origCharStringData = sourceSansOriginal.getCharStringsDict();
+        List<byte[]> origCharStringData = sourceSansOriginal.getCharStringBytes();
         for (int i = 0; i < charStrings.getNumObjects(); i++) {
-            byte[] origCharData = origCharStringData.get(origCharStringData.keySet().toArray(
-                    new String[0])[i]);
+            byte[] origCharData = origCharStringData.get(i);
             byte[] charData = charStrings.getValue(i);
             List<BytesNumber> origOperands = getFullCharString(new Context(), origCharData, origCFF);
             List<BytesNumber> subsetOperands = getFullCharString(new Context(), charData, subsetCFF);

Added: xmlgraphics/fop/trunk/fop/lib/fontbox-2.0.0.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/lib/fontbox-2.0.0.jar?rev=1739076&view=auto
==============================================================================
Binary file - no diff available.

Propchange: xmlgraphics/fop/trunk/fop/lib/fontbox-2.0.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: xmlgraphics/fop/trunk/fop/lib/xmlgraphics-commons-svn-trunk.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/lib/xmlgraphics-commons-svn-trunk.jar?rev=1739076&r1=1739075&r2=1739076&view=diff
==============================================================================
Binary files - no diff available.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.