You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/05/13 17:37:52 UTC
svn commit: r1877704 -
/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
Author: tilman
Date: Wed May 13 17:37:52 2020
New Revision: 1877704
URL: http://svn.apache.org/viewvc?rev=1877704&view=rev
Log:
PDFBOX-4828: don't bother with improperly sorted tables as long as the contents aren't trash
Modified:
pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java?rev=1877704&r1=1877703&r2=1877704&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java (original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java Wed May 13 17:37:52 2020
@@ -176,9 +176,19 @@ public class GlyphSubstitutionTable exte
{
// catch corrupt file
// https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#flTbl
- LOG.warn("FeatureRecord array not alphabetically sorted by FeatureTag: " +
- featureRecord.featureTag + " < " + prevFeatureTag);
- return new FeatureRecord[0];
+ if (featureRecord.featureTag.matches("\\w{4}") && prevFeatureTag.matches("\\w{4}"))
+ {
+ // ArialUni.ttf has many warnings but isn't corrupt, so we assume that only
+ // strings with trash characters indicate real corruption
+ LOG.debug("FeatureRecord array not alphabetically sorted by FeatureTag: " +
+ featureRecord.featureTag + " < " + prevFeatureTag);
+ }
+ else
+ {
+ LOG.warn("FeatureRecord array not alphabetically sorted by FeatureTag: " +
+ featureRecord.featureTag + " < " + prevFeatureTag);
+ return new FeatureRecord[0];
+ }
}
featureOffsets[i] = data.readUnsignedShort();
featureRecords[i] = featureRecord;