-
- public class Glyph {
- public char c;
- public int baseline; // within the picture, this is the y-coordinate of the baseline
- public int advance; // amount to increment the x-coordinate
- public Picture p;
- public final Font font;
- public Glyph(char c) { this.c = c; font = Font.this; }
+ public int textwidth(String s) { return (int)(textsize(s) >>> 16L); }
+ public int textheight(String s) { return (int)(textsize(s) & 0xffffffffL); }
+ public long textsize(String s) {
+ Long l = (Long)sizeCache.get(s);
+ if (l != null) return ((Long)l).longValue();
+ long ret = rasterizeGlyphs(s, null, 0, 0, 0, 0, 0, 0, 0, null);
+ if (ret != -1) sizeCache.put(s, new Long(ret));
+ return ret == -1 ? 0 : ret;