/** * Returns the Type 2 charstring for the given CID. * * @param cid CID * @throws IOException if the charstring could not be read */ @Override public CIDKeyedType2CharString getType2CharString(int cid) throws IOException { CIDKeyedType2CharString type2 = charStringCache.get(cid); if (type2 == null) { int gid = charset.getGIDForCID(cid); byte[] bytes = charStrings[gid]; if (bytes == null) { bytes = charStrings[0]; // .notdef } Type2CharStringParser parser = new Type2CharStringParser(fontName, cid); List<Object> type2seq = parser.parse(bytes, globalSubrIndex, getLocalSubrIndex(gid)); type2 = new CIDKeyedType2CharString(reader, fontName, cid, gid, type2seq, getDefaultWidthX(gid), getNominalWidthX(gid)); charStringCache.put(cid, type2); } return type2; }
/** * Returns the Type 2 charstring for the given CID. * * @param cid CID * @throws IOException if the charstring could not be read */ @Override public CIDKeyedType2CharString getType2CharString(int cid) throws IOException { CIDKeyedType2CharString type2 = charStringCache.get(cid); if (type2 == null) { int gid = charset.getGIDForCID(cid); byte[] bytes = charStrings[gid]; if (bytes == null) { bytes = charStrings[0]; // .notdef } Type2CharStringParser parser = new Type2CharStringParser(fontName, cid); List<Object> type2seq = parser.parse(bytes, globalSubrIndex, getLocalSubrIndex(gid)); type2 = new CIDKeyedType2CharString(reader, fontName, cid, gid, type2seq, getDefaultWidthX(gid), getNominalWidthX(gid)); charStringCache.put(cid, type2); } return type2; }
/** * Returns the Type 2 charstring for the given CID. * * @param cid CID * @throws IOException if the charstring could not be read */ @Override public CIDKeyedType2CharString getType2CharString(int cid) throws IOException { CIDKeyedType2CharString type2 = charStringCache.get(cid); if (type2 == null) { int gid = charset.getGIDForCID(cid); byte[] bytes = charStrings[gid]; if (bytes == null) { bytes = charStrings[0]; // .notdef } Type2CharStringParser parser = new Type2CharStringParser(fontName, cid); List<Object> type2seq = parser.parse(bytes, globalSubrIndex, getLocalSubrIndex(gid)); type2 = new CIDKeyedType2CharString(reader, fontName, cid, gid, type2seq, getDefaultWidthX(gid), getNominalWidthX(gid)); charStringCache.put(cid, type2); } return type2; }