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());
@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 {
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 {