From c0b8718464be2b46c9bfeb9f22bd081a82ad5587 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 3 Nov 2007 01:21:36 +0000 Subject: 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 --- src/classes/com/sun/opengl/util/j2d/TextRenderer.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/classes') 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 { -- cgit v1.2.3