public DescendantFontValidator(PreflightContext context, PDCIDFont font, T fContainer) { super(context, font, font.getCOSObject(), fContainer); cosDocument = context.getDocument().getDocument(); }
@Override public PDFontDescriptor getFontDescriptor() { return descendantFont.getFontDescriptor(); }
for (int code = 0; code < 65535; ++code) if (descendantFont.hasGlyph(code)) for (int code = 0; code < 65535; ++code) if (descendantFont.hasGlyph(code)) tab[index][1] = descendantFont.codeToCID(code); tab[index][2] = descendantFont.codeToGID(code); tab[index][3] = parentFont.toUnicode(code); GeneralPath path = descendantFont.getPath(code); tab[index][4] = path; if (!path.getBounds2D().isEmpty())
@Override public float getWidth(int code) throws IOException { // these widths are supposed to be consistent with the actual widths given in the CIDFont // program, but PDFBOX-563 shows that when they are not, Acrobat overrides the embedded // font widths with the widths given in the font dictionary return getWidthForCID(codeToCID(code)); }
@Override public Vector getPositionVector(int code) { int cid = codeToCID(code); Vector v = positionVectors.get(cid); if (v == null) { v = getDefaultPositionVector(cid); } return v; }
this.type = cid.getCOSObject().getNameAsString(COSName.SUBTYPE); this.baseFont = cid.getBaseFont(); COSBase dw = cid.getCOSObject().getDictionaryObject(COSName.DW); if (dw instanceof COSInteger) { this.defaultWidth = Double.valueOf(((COSNumber) dw).intValue()); PDCIDSystemInfo cidSystemInfo = cid.getCIDSystemInfo(); this.isCIDSystemInfoPresent = cidSystemInfo != null; if (this.isCIDSystemInfoPresent) {
PDCIDSystemInfo ros = descendantFont.getCIDSystemInfo(); if (ros != null)
private Object[][] readCIDToGIDMap(PDCIDFont font, PDFont parentFont) throws IOException COSDictionary dict = font.getCOSObject(); COSBase map = dict.getDictionaryObject(COSName.CID_TO_GID_MAP); if (map instanceof COSStream) GeneralPath path = font.getPath(index); cid2gid[index][3] = path; if (!path.getBounds2D().isEmpty())
/** * Returns the CID for the given character code. If not found then CID 0 is returned. * * @param code character code * @return CID */ public int codeToCID(int code) { return descendantFont.codeToCID(code); }
@Override public boolean hasGlyph(int code) throws IOException { return descendantFont.hasGlyph(code); }
@Override public String getName() { return getBaseFont(); }
/** * Returns the GID for the given character code. * * @param code character code * @return GID */ public int codeToGID(int code) throws IOException { return descendantFont.codeToGID(code); }
@Override public GeneralPath getPath(int code) throws IOException { return descendantFont.getPath(code); }
@Override protected byte[] encode(int unicode) throws IOException { return descendantFont.encode(unicode); }
@Override public float getAverageFontWidth() { return descendantFont.getAverageFontWidth(); }
if (isDescendantCJK) strName = descendantFont.getCIDSystemInfo().getRegistry() + "-" + descendantFont.getCIDSystemInfo().getOrdering() + "-" + descendantFont.getCIDSystemInfo().getSupplement();
@Override public float getWidth(int code) throws IOException { // these widths are supposed to be consistent with the actual widths given in the CIDFont // program, but PDFBOX-563 shows that when they are not, Acrobat overrides the embedded // font widths with the widths given in the font dictionary return getWidthForCID(codeToCID(code)); }
@Override public Vector getPositionVector(int code) { int cid = codeToCID(code); Vector v = positionVectors.get(cid); if (v == null) { v = getDefaultPositionVector(cid); } return v; }
@Override public boolean hasExplicitWidth(int code) throws IOException { return widths.get(codeToCID(code)) != null; }
@Override public boolean hasGlyph(int code) throws IOException { return descendantFont.hasGlyph(code); } }