@Override public GeneralPath getPath(String selector) throws IOException { int cid = selectorToCID(selector); return getType2CharString(cid).getPath(); }
@Override public int codeToGID(int code) { int cid = codeToCID(code); if (cidFont != null) { // The CIDs shall be used to determine the GID value for the glyph procedure using the // charset table in the CFF program return cidFont.getCharset().getGIDForCID(cid); } else { // The CIDs shall be used directly as GID values return cid; } }
/** * 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; }
if (isCIDFont) font = new CFFCIDFont(); DictData.Entry rosEntry = topDict.getEntry("ROS"); ((CFFCIDFont) font).setRegistry(readString(rosEntry.getNumber(0).intValue())); ((CFFCIDFont) font).setOrdering(readString(rosEntry.getNumber(1).intValue())); ((CFFCIDFont) font).setSupplement(rosEntry.getNumber(2).intValue()); List<Map<String, Object>> fontDicts = ((CFFCIDFont) font).getFontDicts(); if (!fontDicts.isEmpty() && fontDicts.get(0).containsKey("FontMatrix"))
String registry = cidFont.getRegistry(); String ordering = cidFont.getOrdering(); int supplement = cidFont.getSupplement(); ros = new CIDSystemInfo(registry, ordering, supplement);
@Override public Type1CharString getType1CharString(String name) throws IOException { return CFFCIDFont.this.getType2CharString(0); // .notdef } }
private BoundingBox generateBoundingBox() { if (getFontDescriptor() != null) { PDRectangle bbox = getFontDescriptor().getFontBoundingBox(); if (bbox != null && (Float.compare(bbox.getLowerLeftX(),0) != 0 || Float.compare(bbox.getLowerLeftY(),0) != 0 || Float.compare(bbox.getUpperRightX(),0) != 0 || Float.compare(bbox.getUpperRightY(),0) != 0)) { return new BoundingBox(bbox.getLowerLeftX(), bbox.getLowerLeftY(), bbox.getUpperRightX(), bbox.getUpperRightY()); } } if (cidFont != null) { return cidFont.getFontBBox(); } else { try { return t1Font.getFontBBox(); } catch (IOException e) { LOG.debug("Couldn't get font bounding box - returning default value", e); return new BoundingBox(); } } }
if (cidFont != null) numbers = cidFont.getFontMatrix();
if (isCIDFont) font = new CFFCIDFont(); DictData.Entry rosEntry = topDict.getEntry("ROS"); ((CFFCIDFont) font).setRegistry(readString(rosEntry.getNumber(0).intValue())); ((CFFCIDFont) font).setOrdering(readString(rosEntry.getNumber(1).intValue())); ((CFFCIDFont) font).setSupplement(rosEntry.getNumber(2).intValue()); List<Map<String, Object>> fontDicts = ((CFFCIDFont) font).getFontDicts(); if (fontDicts.size() > 0 && fontDicts.get(0).containsKey("FontMatrix"))
String registry = cidFont.getRegistry(); String ordering = cidFont.getOrdering(); int supplement = cidFont.getSupplement(); ros = new CIDSystemInfo(registry, ordering, supplement);
/** * 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; } }
private BoundingBox generateBoundingBox() { if (getFontDescriptor() != null) { PDRectangle bbox = getFontDescriptor().getFontBoundingBox(); if (bbox.getLowerLeftX() != 0 || bbox.getLowerLeftY() != 0 || bbox.getUpperRightX() != 0 || bbox.getUpperRightY() != 0) { return new BoundingBox(bbox.getLowerLeftX(), bbox.getLowerLeftY(), bbox.getUpperRightX(), bbox.getUpperRightY()); } } if (cidFont != null) { return cidFont.getFontBBox(); } else { try { return t1Font.getFontBBox(); } catch (IOException e) { return new BoundingBox(); } } }
if (cidFont != null) numbers = cidFont.getFontMatrix();
if (isCIDFont) font = new CFFCIDFont(); DictData.Entry rosEntry = topDict.getEntry("ROS"); ((CFFCIDFont) font).setRegistry(readString(rosEntry.getNumber(0).intValue())); ((CFFCIDFont) font).setOrdering(readString(rosEntry.getNumber(1).intValue())); ((CFFCIDFont) font).setSupplement(rosEntry.getNumber(2).intValue()); List<Map<String, Object>> fontDicts = ((CFFCIDFont) font).getFontDicts(); if (!fontDicts.isEmpty() && fontDicts.get(0).containsKey("FontMatrix"))
@Override public float getWidth(String selector) throws IOException { int cid = selectorToCID(selector); return getType2CharString(cid).getWidth(); }
/** * 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; }
String registry = cidFont.getRegistry(); String ordering = cidFont.getOrdering(); int supplement = cidFont.getSupplement(); ros = new CIDSystemInfo(registry, ordering, supplement);
@Override public Type1CharString getType1CharString(String name) throws IOException { return CFFCIDFont.this.getType2CharString(0); // .notdef } }
@Override public int codeToGID(int code) { int cid = codeToCID(code); if (cidFont != null) { // The CIDs shall be used to determine the GID value for the glyph procedure using the // charset table in the CFF program return cidFont.getCharset().getGIDForCID(cid); } else { // The CIDs shall be used directly as GID values return cid; } }
private BoundingBox generateBoundingBox() { if (getFontDescriptor() != null) { PDRectangle bbox = getFontDescriptor().getFontBoundingBox(); if (bbox.getLowerLeftX() != 0 || bbox.getLowerLeftY() != 0 || bbox.getUpperRightX() != 0 || bbox.getUpperRightY() != 0) { return new BoundingBox(bbox.getLowerLeftX(), bbox.getLowerLeftY(), bbox.getUpperRightX(), bbox.getUpperRightY()); } } if (cidFont != null) { return cidFont.getFontBBox(); } else { try { return t1Font.getFontBBox(); } catch (IOException e) { return new BoundingBox(); } } }