/** * Returns the geometry of the specified character. This method also put * the in cache the geometry associated to the specified character if * needed. */ public static AWTGlyphGeometryCache.Value getGlyphGeometry(AWTGVTFont font, char c, GlyphVector gv, int glyphIndex, Point2D glyphPos) { AWTGlyphGeometryCache glyphCache = (AWTGlyphGeometryCache)fontCache.get(font.awtFont); AWTGlyphGeometryCache.Value v = glyphCache.get(c); if (v == null) { Shape outline = gv.getGlyphOutline(glyphIndex); GlyphMetrics metrics = gv.getGlyphMetrics(glyphIndex); Rectangle2D gmB = metrics.getBounds2D(); if (AWTGVTGlyphVector.outlinesPositioned()) { AffineTransform tr = AffineTransform.getTranslateInstance (-glyphPos.getX(), -glyphPos.getY()); outline = tr.createTransformedShape(outline); } v = new AWTGlyphGeometryCache.Value(outline, gmB); //System.out.println("put "+font.awtFont+" "+c); glyphCache.put(c, v); } return v; }
/** * Returns the geometry of the specified character. This method also put * the in cache the geometry associated to the specified character if * needed. */ public static AWTGlyphGeometryCache.Value getGlyphGeometry(AWTGVTFont font, char c, GlyphVector gv, int glyphIndex, Point2D glyphPos) { AWTGlyphGeometryCache glyphCache = (AWTGlyphGeometryCache)fontCache.get(font.awtFont); AWTGlyphGeometryCache.Value v = glyphCache.get(c); if (v == null) { Shape outline = gv.getGlyphOutline(glyphIndex); GlyphMetrics metrics = gv.getGlyphMetrics(glyphIndex); Rectangle2D gmB = metrics.getBounds2D(); if (AWTGVTGlyphVector.outlinesPositioned()) { AffineTransform tr = AffineTransform.getTranslateInstance (-glyphPos.getX(), -glyphPos.getY()); outline = tr.createTransformedShape(outline); } v = new AWTGlyphGeometryCache.Value(outline, gmB); //System.out.println("put "+font.awtFont+" "+c); glyphCache.put(c, v); } return v; }
/** * Returns the geometry of the specified character. This method also put * the in cache the geometry associated to the specified character if * needed. */ public static AWTGlyphGeometryCache.Value getGlyphGeometry(AWTGVTFont font, char c, GlyphVector gv, int glyphIndex, Point2D glyphPos) { AWTGlyphGeometryCache glyphCache = (AWTGlyphGeometryCache)fontCache.get(font.awtFont); AWTGlyphGeometryCache.Value v = glyphCache.get(c); if (v == null) { Shape outline = gv.getGlyphOutline(glyphIndex); GlyphMetrics metrics = gv.getGlyphMetrics(glyphIndex); Rectangle2D gmB = metrics.getBounds2D(); if (AWTGVTGlyphVector.outlinesPositioned()) { AffineTransform tr = AffineTransform.getTranslateInstance (-glyphPos.getX(), -glyphPos.getY()); outline = tr.createTransformedShape(outline); } v = new AWTGlyphGeometryCache.Value(outline, gmB); //System.out.println("put "+font.awtFont+" "+c); glyphCache.put(c, v); } return v; }