diff options
author | Kenneth Russel <[email protected]> | 2007-11-03 01:21:36 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2007-11-03 01:21:36 +0000 |
commit | c0b8718464be2b46c9bfeb9f22bd081a82ad5587 (patch) | |
tree | 680505ee896e0ecce61cb5fefe16cdae4d8f2ee8 /src/classes/com/sun | |
parent | 12461ad95b421694706e39ff15eba3bf15e9790b (diff) |
Added RenderDelegate.getBounds(GlyphVector, FontRenderContext) and
delegated to it in glyph-by-glyph renderer in order to support
advanced RenderDelegates.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1424 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun')
-rwxr-xr-x | src/classes/com/sun/opengl/util/j2d/TextRenderer.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java index 78b193fb7..d11d928a9 100755 --- a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java +++ b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java @@ -1047,6 +1047,11 @@ public class TextRenderer { public Rectangle2D getBounds(CharSequence str, Font font, FontRenderContext frc); + /** Computes the bounds of the given GlyphVector, already + assumed to have been created for a particular Font, + relative to the origin. */ + public Rectangle2D getBounds(GlyphVector gv, FontRenderContext frc); + /** Render the passed character sequence at the designated location using the supplied Graphics2D instance. The surrounding region will already have been cleared to the RGB @@ -1361,16 +1366,17 @@ public class TextRenderer { public Rectangle2D getBounds(CharSequence str, Font font, FontRenderContext frc) { - GlyphVector gv = font.createGlyphVector(frc, - new MapCharSequenceToGlyphVector(str)); - - return gv.getPixelBounds(frc, 0, 0); + return getBounds(font.createGlyphVector(frc, + new MapCharSequenceToGlyphVector(str)), + frc); } public Rectangle2D getBounds(String str, Font font, FontRenderContext frc) { - GlyphVector gv = font.createGlyphVector(frc, str); + return getBounds(font.createGlyphVector(frc, str), frc); + } + public Rectangle2D getBounds(GlyphVector gv, FontRenderContext frc) { return gv.getPixelBounds(frc, 0, 0); } @@ -1618,7 +1624,7 @@ public class TextRenderer { advances[glyphID] = advance; glyphsToUpload.prepGlyphForUpload(unicodeID, glyphID, - gv.getVisualBounds(), i, gv); + renderDelegate.getBounds(gv, fontRenderContext), i, gv); totalAdvanceUploaded += advance; } else { |