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:38:00 UTC
svn commit: r1877706 -
/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
Author: tilman
Date: Wed May 13 17:38:00 2020
New Revision: 1877706
URL: http://svn.apache.org/viewvc?rev=1877706&view=rev
Log:
PDFBOX-4828: don't bother with improperly sorted tables as long as the contents aren't trash
Modified:
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java?rev=1877706&r1=1877705&r2=1877706&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java Wed May 13 17:38:00 2020
@@ -204,9 +204,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: " +
- featureTags[i] + " < " + featureTags[i - 1]);
- return new FeatureListTable(0, new FeatureRecord[0]);
+ if (featureTags[i].matches("\\w{4}") && featureTags[i-1].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: " +
+ featureTags[i] + " < " + featureTags[i - 1]);
+ }
+ else
+ {
+ LOG.warn("FeatureRecord array not alphabetically sorted by FeatureTag: " +
+ featureTags[i] + " < " + featureTags[i - 1]);
+ return new FeatureListTable(0, new FeatureRecord[0]);
+ }
}
featureOffsets[i] = data.readUnsignedShort();
}