/** * Returns the Type 1 charstring for the given GID. * * @param gid GID * @throws IOException if the charstring could not be read */ @Override public Type2CharString getType2CharString(int gid) throws IOException { String name = "GID+" + gid; // for debugging only return getType2CharString(gid, name); }
/** * Returns the Type 1 charstring for the given PostScript glyph name. * * @param name PostScript glyph name * @throws IOException if the charstring could not be read */ public Type1CharString getType1CharString(String name) throws IOException { // lookup via charset int gid = nameToGID(name); // lookup in CharStrings INDEX return getType2CharString(gid, name); }
/** * Returns the Type 2 charstring for the given CID, or null if the substituted font does not * contain Type 2 charstrings. * * @param cid CID * @throws IOException if the charstring could not be read */ public Type2CharString getType2CharString(int cid) throws IOException { if (cidFont != null) { return cidFont.getType2CharString(cid); } else if (t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid); } else { return null; } }
@Override public float getWidthFromFont(int code) throws IOException { int cid = codeToCID(code); float width; if (cidFont != null) { width = getType2CharString(cid).getWidth(); } else if (isEmbedded && t1Font instanceof CFFType1Font) { width = ((CFFType1Font)t1Font).getType2CharString(cid).getWidth(); } else { width = t1Font.getWidth(getGlyphName(code)); } Point2D p = new Point2D.Float(width, 0); fontMatrixTransform.transform(p, p); return (float)p.getX(); }
@Override public boolean hasGlyph(int code) throws IOException { int cid = codeToCID(code); Type2CharString charstring = getType2CharString(cid); if (charstring != null) { return charstring.getGID() != 0; } else if (isEmbedded && t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid).getGID() != 0; } else { return t1Font.hasGlyph(getGlyphName(code)); } }
@Override public GeneralPath getPath(int code) throws IOException { int cid = codeToCID(code); if (cid2gid != null && isEmbedded) { // PDFBOX-4093: despite being a type 0 font, there is a CIDToGIDMap cid = cid2gid[cid]; } Type2CharString charstring = getType2CharString(cid); if (charstring != null) { return charstring.getPath(); } else if (isEmbedded && t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid).getPath(); } else { return t1Font.getPath(getGlyphName(code)); } }
/** * Returns the Type 1 charstring for the given GID. * * @param gid GID * @throws IOException if the charstring could not be read */ @Override public Type2CharString getType2CharString(int gid) throws IOException { String name = "GID+" + gid; // for debugging only return getType2CharString(gid, name); }
/** * Returns the Type 1 charstring for the given GID. * * @param gid GID * @throws IOException if the charstring could not be read */ @Override public Type2CharString getType2CharString(int gid) throws IOException { String name = "GID+" + gid; // for debugging only return getType2CharString(gid, name); }
/** * Returns the Type 1 charstring for the given PostScript glyph name. * * @param name PostScript glyph name * @throws IOException if the charstring could not be read */ public Type1CharString getType1CharString(String name) throws IOException { // lookup via charset int gid = nameToGID(name); // lookup in CharStrings INDEX return getType2CharString(gid, name); }
/** * Returns the Type 1 charstring for the given PostScript glyph name. * * @param name PostScript glyph name * @throws IOException if the charstring could not be read */ public Type1CharString getType1CharString(String name) throws IOException { // lookup via charset int gid = nameToGID(name); // lookup in CharStrings INDEX return getType2CharString(gid, name); }
/** * Returns the Type 2 charstring for the given CID, or null if the substituted font does not * contain Type 2 charstrings. * * @param cid CID * @throws IOException if the charstring could not be read */ public Type2CharString getType2CharString(int cid) throws IOException { if (cidFont != null) { return cidFont.getType2CharString(cid); } else if (t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid); } else { return null; } }
/** * Returns the Type 2 charstring for the given CID, or null if the substituted font does not * contain Type 2 charstrings. * * @param cid CID * @throws IOException if the charstring could not be read */ public Type2CharString getType2CharString(int cid) throws IOException { if (cidFont != null) { return cidFont.getType2CharString(cid); } else if (t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid); } else { return null; } }
@Override public float getWidthFromFont(int code) throws IOException { int cid = codeToCID(code); float width; if (cidFont != null) { width = getType2CharString(cid).getWidth(); } else if (isEmbedded && t1Font instanceof CFFType1Font) { width = ((CFFType1Font)t1Font).getType2CharString(cid).getWidth(); } else { width = t1Font.getWidth(getGlyphName(code)); } Point2D p = new Point2D.Float(width, 0); fontMatrixTransform.transform(p, p); return (float)p.getX(); }
@Override public float getWidthFromFont(int code) throws IOException { int cid = codeToCID(code); float width; if (cidFont != null) { width = getType2CharString(cid).getWidth(); } else if (isEmbedded && t1Font instanceof CFFType1Font) { width = ((CFFType1Font)t1Font).getType2CharString(cid).getWidth(); } else { width = t1Font.getWidth(getGlyphName(code)); } Point2D p = new Point2D.Float(width, 0); fontMatrixTransform.transform(p, p); return (float)p.getX(); }
@Override public boolean hasGlyph(int code) throws IOException { int cid = codeToCID(code); Type2CharString charstring = getType2CharString(cid); if (charstring != null) { return charstring.getGID() != 0; } else if (isEmbedded && t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid).getGID() != 0; } else { return t1Font.hasGlyph(getGlyphName(code)); } }
@Override public boolean hasGlyph(int code) throws IOException { int cid = codeToCID(code); Type2CharString charstring = getType2CharString(cid); if (charstring != null) { return charstring.getGID() != 0; } else if (isEmbedded && t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid).getGID() != 0; } else { return t1Font.hasGlyph(getGlyphName(code)); } }
@Override public GeneralPath getPath(int code) throws IOException { int cid = codeToCID(code); Type2CharString charstring = getType2CharString(cid); if (charstring != null) { return charstring.getPath(); } else if (isEmbedded && t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid).getPath(); } else { return t1Font.getPath(getGlyphName(code)); } }
@Override public GeneralPath getPath(int code) throws IOException { int cid = codeToCID(code); if (cid2gid != null && isEmbedded) { // PDFBOX-4093: despite being a type 0 font, there is a CIDToGIDMap cid = cid2gid[cid]; } Type2CharString charstring = getType2CharString(cid); if (charstring != null) { return charstring.getPath(); } else if (isEmbedded && t1Font instanceof CFFType1Font) { return ((CFFType1Font)t1Font).getType2CharString(cid).getPath(); } else { return t1Font.getPath(getGlyphName(code)); } }