Author: ssteiner
Date: Thu Oct 12 14:43:48 2017
New Revision: 1811970
URL: http://svn.apache.org/viewvc?rev=1811970&view=rev
Log:
FOP-2751: OTF subset: correct charstring offset size
Modified:
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java
Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java?rev=1811970&r1=1811969&r2=1811970&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java Thu Oct 12 14:43:48 2017
@@ -282,8 +282,8 @@ public class OTFSubSetFile extends OTFSu
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());
Modified: xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java?rev=1811970&r1=1811969&r2=1811970&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java Thu Oct 12 14:43:48 2017
@@ -446,8 +446,8 @@ public class OTFSubSetFileTestCase exten
@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 exten
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 {
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.