@Override public GeneralPath getPath(String name) throws IOException { int gid = nameToGID(name); return getCFF().getFont().getType2CharString(gid).getPath(); }
@Override protected TTFTable readTable(TrueTypeFont font, String tag) { // todo: this is a stub, a full implementation is needed switch (tag) { case "BASE": case "GDEF": case "GPOS": case "GSUB": case "JSTF": return new OTLTable(font); case "CFF ": return new CFFTable(font); default: return super.readTable(font, tag); } }
/** * This will read the required data from the stream. * * @param ttf The font that is being read. * @param data The stream to read the data from. * @throws java.io.IOException If there is an error reading the data. */ public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException { byte[] bytes = data.read((int)getLength()); CFFParser parser = new CFFParser(); cffFont = parser.parse(bytes, new ByteSource(font)).get(0); initialized = true; }
@Override public GeneralPath getPath(int code) throws IOException { if (ttf instanceof OpenTypeFont && ((OpenTypeFont)ttf).isPostScript()) { // we're not supposed to have CFF fonts inside PDCIDFontType2, but if we do, // then we treat their CIDs as GIDs, see PDFBOX-3344 int cid = codeToGID(code); Type2CharString charstring = ((OpenTypeFont)ttf).getCFF().getFont().getType2CharString(cid); return charstring.getPath(); } else { int gid = codeToGID(code); GlyphData glyph = ttf.getGlyph().getGlyph(gid); if (glyph != null) { return glyph.getPath(); } return new GeneralPath(); } }
/** * This will read the required data from the stream. * * @param ttf The font that is being read. * @param data The stream to read the data from. * @throws java.io.IOException If there is an error reading the data. */ public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException { byte[] bytes = data.read((int)getLength()); CFFParser parser = new CFFParser(); cffFont = parser.parse(bytes, new ByteSource(font)).get(0); initialized = true; }
@Override protected TTFTable readTable(TrueTypeFont font, String tag) { // todo: this is a stub, a full implementation is needed if (tag.equals("BASE") || tag.equals("GDEF") || tag.equals("GPOS") || tag.equals("GSUB") || tag.equals("JSTF")) { return new OTLTable(font); } else if (tag.equals("CFF ")) { return new CFFTable(font); } else { return super.readTable(font, tag); } }
CFFFont cff = ((OpenTypeFont)ttf).getCFF().getFont(); CIDSystemInfo ros = null; if (cff instanceof CFFCIDFont)
/** * This will read the required data from the stream. * * @param ttf The font that is being read. * @param data The stream to read the data from. * @throws java.io.IOException If there is an error reading the data. */ public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException { byte[] bytes = data.read((int)getLength()); CFFParser parser = new CFFParser(); cffFont = parser.parse(bytes, new ByteSource(font)).get(0); initialized = true; }
@Override protected TTFTable readTable(TrueTypeFont font, String tag) { // todo: this is a stub, a full implementation is needed switch (tag) { case "BASE": case "GDEF": case "GPOS": case "GSUB": case "JSTF": return new OTLTable(font); case "CFF ": return new CFFTable(font); default: return super.readTable(font, tag); } }
if (mapping.isCIDFont()) cffFont = mapping.getFont().getCFF().getFont(); if (cffFont instanceof CFFCIDFont)
@Override public GeneralPath getPath(String name) throws IOException { int gid = nameToGID(name); return getCFF().getFont().getType2CharString(gid).getPath(); }
@Override public GeneralPath getPath(String name) throws IOException { int gid = nameToGID(name); return getCFF().getFont().getType2CharString(gid).getPath(); }
@Override public GeneralPath getPath(int code) throws IOException { if (ttf instanceof OpenTypeFont && ((OpenTypeFont)ttf).isPostScript()) { // we're not supposed to have CFF fonts inside PDCIDFontType2, but if we do, // then we treat their CIDs as GIDs, see PDFBOX-3344 int cid = codeToGID(code); Type2CharString charstring = ((OpenTypeFont)ttf).getCFF().getFont().getType2CharString(cid); return charstring.getPath(); } else { int gid = codeToGID(code); GlyphData glyph = ttf.getGlyph().getGlyph(gid); if (glyph != null) { return glyph.getPath(); } return new GeneralPath(); } }
@Override public GeneralPath getPath(int code) throws IOException { if (ttf instanceof OpenTypeFont && ((OpenTypeFont)ttf).isPostScript()) { // we're not supposed to have CFF fonts inside PDCIDFontType2, but if we do, // then we treat their CIDs as GIDs, see PDFBOX-3344 int cid = codeToGID(code); Type2CharString charstring = ((OpenTypeFont)ttf).getCFF().getFont().getType2CharString(cid); return charstring.getPath(); } else { int gid = codeToGID(code); GlyphData glyph = ttf.getGlyph().getGlyph(gid); if (glyph != null) { return glyph.getPath(); } return new GeneralPath(); } }
CFFFont cff = ((OpenTypeFont)ttf).getCFF().getFont(); CIDSystemInfo ros = null; if (cff instanceof CFFCIDFont)
CFFFont cff = ((OpenTypeFont)ttf).getCFF().getFont(); CIDSystemInfo ros = null; if (cff instanceof CFFCIDFont)
if (mapping.isCIDFont()) cffFont = mapping.getFont().getCFF().getFont(); if (cffFont instanceof CFFCIDFont)
if (mapping.isCIDFont()) cffFont = mapping.getFont().getCFF().getFont(); if (cffFont instanceof CFFCIDFont)