aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKelly Campbell <kellyc@apache.org>2001-04-08 14:55:39 +0000
committerKelly Campbell <kellyc@apache.org>2001-04-08 14:55:39 +0000
commitc0ada782e6e094e4126919c596a700cc756038c5 (patch)
tree98a14cc3839f6f7a2b70e4ffbe660dbce0830ed7 /src
parent3e0b2cfc1208009c85742054880394f1a2b4c240 (diff)
downloadxmlgraphics-fop-c0ada782e6e094e4126919c596a700cc756038c5.tar.gz
xmlgraphics-fop-c0ada782e6e094e4126919c596a700cc756038c5.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/fonts/TTFSubSetFile.java47
1 files changed, 42 insertions, 5 deletions
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();