@Override public FontMetrics getFontMetrics(Font font) { if (font != null) { PGFont prismFont = (PGFont) font.impl_getNativeFont(); Metrics metrics = PrismFontUtils.getFontMetrics(prismFont); // TODO: what's the difference between ascent and maxAscent? float maxAscent = -metrics.getAscent(); // metrics.getMaxAscent(); float ascent = -metrics.getAscent(); float xheight = metrics.getXHeight(); float descent = metrics.getDescent(); // TODO: what's the difference between descent and maxDescent? float maxDescent = metrics.getDescent(); // metrics.getMaxDescent(); float leading = metrics.getLineGap(); return FontMetrics.impl_createFontMetrics( maxAscent, ascent, xheight, descent, maxDescent, leading, font); } else { return null; // this should never happen } }
@Override public float computeStringWidth(String string, Font font) { PGFont prismFont = (PGFont) font.impl_getNativeFont(); return (float) PrismFontUtils.computeStringWidth(prismFont, string); }