Results 1 to 3 of 3
  1. #1
    nguyenq is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default 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.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,455
    Rep Power
    20

    Default Re: Bounding box for each character

    java.awt.font.TextLayout#getBounds()

    db

  3. #3
    nguyenq is offline Member
    Join Date
    Sep 2011
    Posts
    2
    Rep Power
    0

    Default 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 03:44 AM.

Similar Threads

  1. Replies: 10
    Last Post: 05-20-2010, 01:47 AM
  2. java bounding box
    By beechy34 in forum Java Applets
    Replies: 1
    Last Post: 01-05-2010, 01:50 AM
  3. Read from a certain character to a certain character
    By blackstormattack in forum New To Java
    Replies: 0
    Last Post: 03-16-2009, 12:36 PM
  4. reading text character by character
    By bugger in forum New To Java
    Replies: 2
    Last Post: 11-09-2007, 09:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •