From: Jeremias Maerki Date: Tue, 27 May 2003 14:03:34 +0000 (+0000) Subject: Improve error messages X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1446 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=77f33832b84793a7552a1f0aec56485702de3c26;p=xmlgraphics-fop.git Improve error messages Better debug info git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196459 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/java/org/apache/fop/fonts/truetype/TTFFile.java index 0490bdf03..5148f4e35 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java +++ b/src/java/org/apache/fop/fonts/truetype/TTFFile.java @@ -441,7 +441,14 @@ public class TTFFile extends AbstractLogEnabled { * exists in the collection */ if (!checkTTC(in, name)) { - throw new IOException("Failed to read font"); + if (name == null) { + throw new IllegalArgumentException( + "For TrueType collection you must specify which font " + + "to select (-ttcname)"); + } else { + throw new IOException( + "Name does not exist in the TrueType collection: " + name); + } } readDirTabs(in); @@ -1000,18 +1007,21 @@ public class TTFFile extends AbstractLogEnabled { in.seekSet(i); final int platformID = in.readTTFUShort(); final int encodingID = in.readTTFUShort(); - /*final int language_id =*/ in.readTTFUShort(); //Skip language id + final int languageID = in.readTTFUShort(); int k = in.readTTFUShort(); int l = in.readTTFUShort(); - if (((platformID == 1 || platformID == 3) && (encodingID == 0 || encodingID == 1)) + if (((platformID == 1 || platformID == 3) + && (encodingID == 0 || encodingID == 1)) && (k == 1 || k == 2 || k == 0 || k == 4 || k == 6)) { - // if (k==1 || k==2 || k==0 || k==4 || k==6) { in.seekSet(j + in.readTTFUShort()); String txt = in.readTTFString(l); - // getLogger().debug(platform_id + " " + encoding_id - // + " " + k + " " + txt); + + getLogger().debug(platformID + " " + + encodingID + " " + + languageID + " " + + k + " " + txt); switch (k) { case 0: notice = txt; @@ -1190,9 +1200,9 @@ public class TTFFile extends AbstractLogEnabled { dirOffsets[i] = in.readTTFULong(); } - getLogger().debug("This is a TrueType collection file with" + getLogger().info("This is a TrueType collection file with " + numDirectories + " fonts"); - getLogger().debug("Containing the following fonts: "); + getLogger().info("Containing the following fonts: "); // Read all the directories and name tables to check // If the font exists - this is a bit ugly, but... boolean found = false; @@ -1209,9 +1219,9 @@ public class TTFFile extends AbstractLogEnabled { if (fullName.equals(name)) { found = true; dirTabOffset = dirOffsets[i]; - getLogger().debug("* " + fullName); + getLogger().info(fullName + " <-- selected"); } else { - getLogger().debug(fullName); + getLogger().info(fullName); } // Reset names