@Override public float getWidthFromFont(int code) throws IOException { String name = codeToName(code); // width of .notdef is ignored for substitutes, see PDFBOX-1900 if (!isEmbedded && name.equals(".notdef")) { return 250; } float width = genericFont.getWidth(name); Point2D p = new Point2D.Float(width, 0); fontMatrixTransform.transform(p, p); return (float)p.getX(); }
@Override public float getHeight(int code) throws IOException { String name = codeToName(code); if (getStandard14AFM() != null) { String afmName = getEncoding().getName(code); return getStandard14AFM().getCharacterHeight(afmName); // todo: isn't this the y-advance, not the height? } else { // todo: should be scaled by font matrix return (float) genericFont.getPath(name).getBounds().getHeight(); } }
String name = PDType1Font.ZAPF_DINGBATS.codeToName(normalCaption.codePointAt(0)); String unicode = PDType1Font.ZAPF_DINGBATS.getGlyphList().toUnicode(name); Rectangle2D bounds = PDType1Font.ZAPF_DINGBATS.getPath(name).getBounds2D();
@Override public float getWidthFromFont(int code) throws IOException { String name = codeToName(code); // width of .notdef is ignored for substitutes, see PDFBOX-1900 if (!isEmbedded && ".notdef".equals(name)) { return 250; } float width = genericFont.getWidth(name); Point2D p = new Point2D.Float(width, 0); fontMatrixTransform.transform(p, p); return (float)p.getX(); }
@Override public float getWidthFromFont(int code) throws IOException { String name = codeToName(code); // width of .notdef is ignored for substitutes, see PDFBOX-1900 if (!isEmbedded && name.equals(".notdef")) { return 250; } float width = genericFont.getWidth(name); Point2D p = new Point2D.Float(width, 0); fontMatrixTransform.transform(p, p); return (float)p.getX(); }
@Override public float getHeight(int code) throws IOException { String name = codeToName(code); if (getStandard14AFM() != null) { String afmName = getEncoding().getName(code); return getStandard14AFM().getCharacterHeight(afmName); // todo: isn't this the y-advance, not the height? } else { // todo: should be scaled by font matrix return (float) genericFont.getPath(name).getBounds().getHeight(); } }
@Override public float getHeight(int code) throws IOException { String name = codeToName(code); if (getStandard14AFM() != null) { String afmName = getEncoding().getName(code); return getStandard14AFM().getCharacterHeight(afmName); // todo: isn't this the y-advance, not the height? } else { // todo: should be scaled by font matrix return (float) genericFont.getPath(name).getBounds().getHeight(); } }