You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2022/01/29 12:22:11 UTC
svn commit: r1897578 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
Author: lehmi
Date: Sat Jan 29 12:22:11 2022
New Revision: 1897578
URL: http://svn.apache.org/viewvc?rev=1897578&view=rev
Log:
PDFBOX-5339: split class EmptyCharset into EmptyCharsetCID and EmptzyCharsetType1 to avoid an IllegalStateException
Modified:
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java?rev=1897578&r1=1897577&r2=1897578&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java Sat Jan 29 12:22:11 2022
@@ -522,7 +522,7 @@ public class CFFParser
else
{
LOG.debug("Couldn't read CharStrings index - returning empty charset instead");
- charset = new EmptyCharset(0);
+ charset = new EmptyCharsetType1();
}
}
else
@@ -532,7 +532,7 @@ public class CFFParser
// CharStrings index could be null if the index data couldnÃt be read
int numEntries = charStringsIndex == null ? 0 : charStringsIndex.length;
// a CID font with no charset does not default to any predefined charset
- charset = new EmptyCharset(numEntries);
+ charset = new EmptyCharsetCID(numEntries);
}
else
{
@@ -1382,9 +1382,9 @@ public class CFFParser
/**
* An empty charset in a malformed CID font.
*/
- private static class EmptyCharset extends CFFCharsetCID
+ private static class EmptyCharsetCID extends CFFCharsetCID
{
- private EmptyCharset(int numCharStrings)
+ private EmptyCharsetCID(int numCharStrings)
{
addCID(0, 0); // .notdef
@@ -1403,7 +1403,24 @@ public class CFFParser
}
/**
- * Inner class representing a Format0 charset.
+ * An empty charset in a malformed Type1 font.
+ */
+ private static class EmptyCharsetType1 extends CFFCharsetType1
+ {
+ private EmptyCharsetType1()
+ {
+ addSID(0, 0, ".notdef");
+ }
+
+ @Override
+ public String toString()
+ {
+ return getClass().getName();
+ }
+ }
+
+ /**
+ * Inner class representing a Format0 charset.
*/
private static class Format0Charset extends EmbeddedCharset
{