aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java4
-rw-r--r--fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java9
2 files changed, 7 insertions, 6 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
index fd3a9988e..7884fff85 100644
--- a/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
+++ b/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
@@ -282,8 +282,8 @@ public class OTFSubSetFile extends OTFSubSetWriter {
DICTEntry entry = dictEntry.getValue();
//If the value is an SID, update the reference but keep the size the same
entry.setOffset(entry.getOffset() + offsetExtra);
- if (dictKey.equals("CharStrings") && entry.getOperandLength() == 3) {
- byte[] extra = new byte[2];
+ if (dictKey.equals("CharStrings") && entry.getOperandLength() < 5) {
+ byte[] extra = new byte[5 - entry.getOperandLength()];
offsetExtra += extra.length;
dict.write(extra);
dict.write(entry.getByteData());
diff --git a/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java b/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java
index c872c731e..fef8ce114 100644
--- a/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java
@@ -446,8 +446,8 @@ public class OTFSubSetFileTestCase extends OTFFileTestCase {
@Test
public void testFDSelect() throws IOException {
- Assert.assertEquals(getSubset(1).length, 42);
- Assert.assertEquals(getSubset(2).length, 49);
+ Assert.assertEquals(getSubset(1).length, 46);
+ Assert.assertEquals(getSubset(2).length, 45);
}
private byte[] getSubset(final int opLen) throws IOException {
@@ -583,9 +583,10 @@ public class OTFSubSetFileTestCase extends OTFFileTestCase {
public void testOrderOfEntries() throws IOException {
OTFSubSetFileEntryOrder otfSubSetFile = getFont(3, 2);
assertTrue(otfSubSetFile.offsets.fdArray < otfSubSetFile.offsets.charString);
-
+ assertEquals(otfSubSetFile.cffReader.getTopDictEntries().get("CharStrings").getOperandLength(), 5);
otfSubSetFile = getFont(2, 3);
- assertTrue(otfSubSetFile.offsets.fdArray > otfSubSetFile.offsets.charString);
+ assertTrue(otfSubSetFile.offsets.fdArray < otfSubSetFile.offsets.charString);
+ assertEquals(otfSubSetFile.cffReader.getTopDictEntries().get("CharStrings").getOperandLength(), 5);
}
private OTFSubSetFileEntryOrder getFont(int csLen, int fdLen) throws IOException {