/** * Returns a tight bounds on the GylphVector including stroking. */ public Rectangle2D getBounds2D(AttributedCharacterIterator aci) { // System.out.println("GlyphVector.getBounds2D Called: " + this); aci.first(); TextPaintInfo tpi = (TextPaintInfo)aci.getAttribute(PAINT_INFO); if ((bounds2D != null) && TextPaintInfo.equivilent(tpi, cacheTPI)) return bounds2D; Rectangle2D b=null; if (tpi.visible) { for (int i = 0; i < getNumGlyphs(); i++) { if (!glyphVisible[i]) continue; Rectangle2D glyphBounds = glyphs[i].getBounds2D(); // System.out.println("GB["+i+"]: " + glyphBounds); if (glyphBounds == null) continue; if (b == null) b=glyphBounds; //else b = glyphBounds.createUnion(b); else b.add( glyphBounds ); } } bounds2D = b; if ( bounds2D == null ){ bounds2D = new Rectangle2D.Float(); } cacheTPI = new TextPaintInfo(tpi); return bounds2D; }
/** * Returns a tight bounds on the GylphVector including stroking. */ public Rectangle2D getBounds2D(AttributedCharacterIterator aci) { // System.out.println("GlyphVector.getBounds2D Called: " + this); aci.first(); TextPaintInfo tpi = (TextPaintInfo)aci.getAttribute(PAINT_INFO); if ((bounds2D != null) && TextPaintInfo.equivilent(tpi, cacheTPI)) return bounds2D; Rectangle2D b=null; if (tpi.visible) { for (int i = 0; i < getNumGlyphs(); i++) { if (!glyphVisible[i]) continue; Rectangle2D glyphBounds = glyphs[i].getBounds2D(); // System.out.println("GB["+i+"]: " + glyphBounds); if (glyphBounds == null) continue; if (b == null) b=glyphBounds; //else b = glyphBounds.createUnion(b); else b.add( glyphBounds ); } } bounds2D = b; if ( bounds2D == null ){ bounds2D = new Rectangle2D.Float(); } cacheTPI = new TextPaintInfo(tpi); return bounds2D; }
/** * Returns a tight bounds on the GylphVector including stroking. */ public Rectangle2D getBounds2D(AttributedCharacterIterator aci) { // System.out.println("GlyphVector.getBounds2D Called: " + this); aci.first(); TextPaintInfo tpi = (TextPaintInfo)aci.getAttribute(PAINT_INFO); if ((bounds2D != null) && TextPaintInfo.equivilent(tpi, cacheTPI)) return bounds2D; Rectangle2D b=null; if (tpi.visible) { for (int i = 0; i < getNumGlyphs(); i++) { if (!glyphVisible[i]) continue; Rectangle2D glyphBounds = glyphs[i].getBounds2D(); // System.out.println("GB["+i+"]: " + glyphBounds); if (glyphBounds == null) continue; if (b == null) b=glyphBounds; //else b = glyphBounds.createUnion(b); else b.add( glyphBounds ); } } bounds2D = b; if ( bounds2D == null ){ bounds2D = new Rectangle2D.Float(); } cacheTPI = new TextPaintInfo(tpi); return bounds2D; }