]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Made some tables in the TTF embedding optional to be compatible with more
authorKelly Campbell <kellyc@apache.org>
Sun, 8 Apr 2001 14:55:39 +0000 (14:55 +0000)
committerKelly Campbell <kellyc@apache.org>
Sun, 8 Apr 2001 14:55:39 +0000 (14:55 +0000)
fonts. This adheres to the TrueType spec, and makes the MS OpenType
extras optional.
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194197 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fonts/TTFSubSetFile.java

index 29d7a7ee44966193f4bb90ddbeb9026e7b7cc778..7f349b4b8dd9de02a34ec1ff221ad024992c0232 100644 (file)
@@ -10,6 +10,7 @@ import java.io.*;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Vector;
+import org.apache.fop.messaging.MessageHandler;
 
 /**
  * Reads a TrueType file and generates a subset
@@ -578,16 +579,52 @@ public class TTFSubSetFile extends TTFFile {
         scanGlyphs(in, glyphs);
 
         createDirectory(); // Create the TrueType header and directory
-        createCvt(in); // copy the cvt table
-        createFpgm(in); // copy fpgm table
+
         createHead(in);
         createHhea(in, glyphs.size()); // Create the hhea table
         createHmtx(in, glyphs); // Create hmtx table
         createMaxp(in, glyphs.size()); // copy the maxp table
-        createPrep(in); // copy prep table
-        createLoca(glyphs.size()); // create empty loca table
-        createGlyf(in, glyphs);
 
+       try {
+           createCvt(in); // copy the cvt table
+       }
+       catch (IOException ex) {
+           //  Cvt is optional (only required for OpenType (MS) fonts)
+           MessageHandler.errorln("TrueType warning: "+ex.getMessage());
+       }
+       
+       try {
+           createFpgm(in); // copy fpgm table
+       }
+       catch (IOException ex) {
+           // Fpgm is optional (only required for OpenType (MS) fonts)
+           MessageHandler.errorln("TrueType warning: "+ex.getMessage());
+       }
+
+       try {
+           createPrep(in); // copy prep table
+       }
+       catch (IOException ex) {
+           // Prep is optional (only required for OpenType (MS) fonts)
+           MessageHandler.errorln("TrueType warning: "+ex.getMessage());
+       }
+       
+       try {
+           createLoca(glyphs.size()); // create empty loca table
+       }
+       catch (IOException ex) {
+           // Loca is optional (only required for OpenType (MS) fonts)
+           MessageHandler.errorln("TrueType warning: "+ex.getMessage());
+       }
+       
+       try {
+           createGlyf(in, glyphs);
+       }
+       catch (IOException ex) {
+           // Glyf is optional (only required for OpenType (MS) fonts)
+           MessageHandler.errorln("TrueType warning: "+ex.getMessage());
+       }
+       
         pad4();
         createCheckSumAdjustment();