From: Kelly Campbell Date: Sun, 8 Apr 2001 14:55:39 +0000 (+0000) Subject: Made some tables in the TTF embedding optional to be compatible with more X-Git-Tag: PRE_CODEFORMATTING~180 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c0ada782e6e094e4126919c596a700cc756038c5;p=xmlgraphics-fop.git Made some tables in the TTF embedding optional to be compatible with more 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 --- diff --git a/src/org/apache/fop/fonts/TTFSubSetFile.java b/src/org/apache/fop/fonts/TTFSubSetFile.java index 29d7a7ee4..7f349b4b8 100644 --- a/src/org/apache/fop/fonts/TTFSubSetFile.java +++ b/src/org/apache/fop/fonts/TTFSubSetFile.java @@ -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();