/** * 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 metrics of the glyph at the specified index into this * GVTGlyphVector. */ public GVTGlyphMetrics getGlyphMetrics(int glyphIndex) { if (glyphMetrics[glyphIndex] != null) return glyphMetrics[glyphIndex]; // -- start glyph cache code -- Point2D glyphPos = defaultGlyphPositions[glyphIndex]; char c = ci.setIndex(ci.getBeginIndex()+glyphIndex); ci.setIndex(ci.getBeginIndex()); AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Rectangle2D gmB = v.getBounds2D(); // -- end glyph cache code -- Rectangle2D bounds = new Rectangle2D.Double (gmB.getX() * scaleFactor, gmB.getY() * scaleFactor, gmB.getWidth() * scaleFactor, gmB.getHeight() * scaleFactor); // defaultGlyphPositions has one more entry than glyphs // the last entry stores the total advance for the // glyphVector. float adv = (float)(defaultGlyphPositions[glyphIndex+1].getX()- defaultGlyphPositions[glyphIndex] .getX()); glyphMetrics[glyphIndex] = new GVTGlyphMetrics ((float)(adv*scaleFactor), (ascent+descent), bounds, GlyphMetrics.STANDARD); return glyphMetrics[glyphIndex]; }
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Shape glyphOutline = v.getOutline();
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Shape glyphOutline = v.getOutline();
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Shape glyphOutline = v.getOutline();
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Rectangle2D glyphBounds = v.getOutlineBounds2D();
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Rectangle2D glyphBounds = v.getOutlineBounds2D();
/** * 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; }
AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Rectangle2D glyphBounds = v.getOutlineBounds2D();
/** * 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 metrics of the glyph at the specified index into this * GVTGlyphVector. */ public GVTGlyphMetrics getGlyphMetrics(int glyphIndex) { if (glyphMetrics[glyphIndex] != null) return glyphMetrics[glyphIndex]; // -- start glyph cache code -- Point2D glyphPos = defaultGlyphPositions[glyphIndex]; char c = ci.setIndex(ci.getBeginIndex()+glyphIndex); ci.setIndex(ci.getBeginIndex()); AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Rectangle2D gmB = v.getBounds2D(); // -- end glyph cache code -- Rectangle2D bounds = new Rectangle2D.Double (gmB.getX() * scaleFactor, gmB.getY() * scaleFactor, gmB.getWidth() * scaleFactor, gmB.getHeight() * scaleFactor); // defaultGlyphPositions has one more entry than glyphs // the last entry stores the total advance for the // glyphVector. float adv = (float)(defaultGlyphPositions[glyphIndex+1].getX()- defaultGlyphPositions[glyphIndex] .getX()); glyphMetrics[glyphIndex] = new GVTGlyphMetrics ((float)(adv*scaleFactor), (ascent+descent), bounds, GlyphMetrics.STANDARD); return glyphMetrics[glyphIndex]; }
/** * Returns the metrics of the glyph at the specified index into this * GVTGlyphVector. */ public GVTGlyphMetrics getGlyphMetrics(int glyphIndex) { if (glyphMetrics[glyphIndex] != null) return glyphMetrics[glyphIndex]; // -- start glyph cache code -- Point2D glyphPos = defaultGlyphPositions[glyphIndex]; char c = ci.setIndex(ci.getBeginIndex()+glyphIndex); ci.setIndex(ci.getBeginIndex()); AWTGlyphGeometryCache.Value v = AWTGVTFont.getGlyphGeometry (gvtFont, c, awtGlyphVector, glyphIndex, glyphPos); Rectangle2D gmB = v.getBounds2D(); // -- end glyph cache code -- Rectangle2D bounds = new Rectangle2D.Double (gmB.getX() * scaleFactor, gmB.getY() * scaleFactor, gmB.getWidth() * scaleFactor, gmB.getHeight() * scaleFactor); // defaultGlyphPositions has one more entry than glyphs // the last entry stores the total advance for the // glyphVector. float adv = (float)(defaultGlyphPositions[glyphIndex+1].getX()- defaultGlyphPositions[glyphIndex] .getX()); glyphMetrics[glyphIndex] = new GVTGlyphMetrics ((float)(adv*scaleFactor), (ascent+descent), bounds, GlyphMetrics.STANDARD); return glyphMetrics[glyphIndex]; }