Results 1 to 3 of 3
Thread: Bounding box for each character
- 09-11-2011, 03:34 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Bounding box for each character
I'd like to extend the Java Tutorial's Drawing Multiple Lines of Text example to draw the tight bounding boxes for each character. I searched through the Java doc but was not able to find which API is responsible for determining a character's bounds and origin so that I could pass to the Graphics.drawRect method to draw the boxes. Can anyone help?
Thanks.
- 09-11-2011, 05:16 AM #2
Re: Bounding box for each character
java.awt.font.TextLayout#getBounds()
db
- 09-11-2011, 05:24 AM #3
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
Re: Bounding box for each character
That gives the bounding box for the entire line. I'm looking for the coordinates and origin of each individual character in that line.
Update: Seems that class GlyphVector's getGlyphVisualBounds and getGlyphPosition methods have what I need.
Thanks.Last edited by nguyenq; 09-19-2011 at 02:44 AM.
Similar Threads
-
How do I find two dimensional points in a minimum bounding rectangle?
By Hollywood in forum New To JavaReplies: 10Last Post: 05-20-2010, 12:47 AM -
java bounding box
By beechy34 in forum Java AppletsReplies: 1Last Post: 01-05-2010, 12:50 AM -
Read from a certain character to a certain character
By blackstormattack in forum New To JavaReplies: 0Last Post: 03-16-2009, 11:36 AM -
reading text character by character
By bugger in forum New To JavaReplies: 2Last Post: 11-09-2007, 08:54 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks