aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schweinsberg <[email protected]>2015-12-19 21:03:07 -0800
committerDavid Schweinsberg <[email protected]>2015-12-19 21:03:07 -0800
commitcebb5365de45b22f18284079056a8b78b8941093 (patch)
tree7f6e25f22f5fda19a2d2c0f8e192dff18e6312ba
parentc7ac6c8d031aaafd9a5301b78a2b7f43b594f9ab (diff)
Load Private DICT and Local Subrs INDEX for each CFF font.
-rw-r--r--src/net/java/dev/typecast/ot/table/CffTable.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/net/java/dev/typecast/ot/table/CffTable.java b/src/net/java/dev/typecast/ot/table/CffTable.java
index 744ccdd..0eb56e0 100644
--- a/src/net/java/dev/typecast/ot/table/CffTable.java
+++ b/src/net/java/dev/typecast/ot/table/CffTable.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
/**
@@ -47,6 +48,17 @@ public class CffTable implements Table {
}
}
+ protected Dict(DataInput di, int length) throws IOException {
+ _data = new int[length];
+ for (int i = 0; i < length; ++i) {
+ _data[i] = di.readUnsignedByte();
+ }
+ _index = 0;
+ while (_index < length) {
+ addKeyAndValueEntry();
+ }
+ }
+
public Object getValue(int key) {
return _entries.get(key);
}
@@ -483,6 +495,8 @@ public class CffTable implements Table {
private Index _charStringsIndexArray[];
private Charset[] _charsets;
private Charstring[][] _charstringsArray;
+ private Dict _privateDictArray[];
+ private Index _localSubrsIndexArray[];
private byte[] _buf;
@@ -522,9 +536,12 @@ public class CffTable implements Table {
// within the CFF data.
// Load each of the fonts
+ // TODO Bundle the following into an individual font class
_charStringsIndexArray = new Index[_topDictIndex.getCount()];
_charsets = new Charset[_topDictIndex.getCount()];
_charstringsArray = new Charstring[_topDictIndex.getCount()][];
+ _privateDictArray = new Dict[_topDictIndex.getCount()];
+ _localSubrsIndexArray = new Index[_topDictIndex.getCount()];
for (int i = 0; i < _topDictIndex.getCount(); ++i) {
// Charstrings INDEX
@@ -534,6 +551,18 @@ public class CffTable implements Table {
di2 = getDataInputForOffset(charStringsOffset);
_charStringsIndexArray[i] = new Index(di2);
int glyphCount = _charStringsIndexArray[i].getCount();
+
+ // Private DICT
+ List<Integer> privateSizeAndOffset = (List<Integer>) _topDictIndex.getTopDict(i).getValue(18);
+ di2 = getDataInputForOffset(privateSizeAndOffset.get(1));
+ _privateDictArray[i] = new Dict(di2, privateSizeAndOffset.get(0));
+
+ // Local Subrs INDEX
+ Integer localSubrsOffset = (Integer) _privateDictArray[i].getValue(19);
+ if (localSubrsOffset != null) {
+ di2 = getDataInputForOffset(privateSizeAndOffset.get(1) + localSubrsOffset);
+ _localSubrsIndexArray[i] = new Index(di2);
+ }
// Charsets
Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15);