use of org.apache.fontbox.cff.CFFType1Font in project pdfbox by apache.
the class PDCIDFontType0 method hasGlyph.
@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));
}
}
use of org.apache.fontbox.cff.CFFType1Font in project pdfbox by apache.
the class PDCIDFontType0 method getPath.
@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));
}
}
use of org.apache.fontbox.cff.CFFType1Font in project pdfbox by apache.
the class PDCIDFontType0 method getWidthFromFont.
@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();
}
Aggregations