Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By galaxyrise

Thread: LineBreakMeasurer for irregular shapes? Incorporating images into a Font?

  1. #1
    galaxyrise is offline Member
    Join Date
    Mar 2012
    Posts
    3
    Rep Power
    0

    Question LineBreakMeasurer for irregular shapes? Incorporating images into a Font?

    Hello,

    I have two Font/Text-related questions:

    [1] I have a program that does a lot of auto-resizing and wrapping of text, and I would like to include images that are treated like text characters by the code (e.g. imagine loading smiley-face png and then having FontMetrics and LineBreakMeasurer treat that image as a character). Is this within the realm of possibility? If so, any advice on how to add an image-character to an existing font would be much appreciated.

    [2] I often use LineBreakMeasurer to wrap text in a rectangular box. I'm wondering if anyone knows of any libraries or has any ideas as to how one would extend this concept to irregular shapes (e.g. wrap text within a hexagon).

    Thanks for your time!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,368
    Blog Entries
    7
    Rep Power
    20

    Default Re: LineBreakMeasurer for irregular shapes? Incorporating images into a Font?

    There are a few smilies in the MS Windings font; does that help?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    galaxyrise is offline Member
    Join Date
    Mar 2012
    Posts
    3
    Rep Power
    0

    Default Re: LineBreakMeasurer for irregular shapes? Incorporating images into a Font?

    Quote Originally Posted by JosAH View Post
    There are a few smilies in the MS Windings font; does that help?

    kind regards,

    Jos
    Afraid not... I chose smileys as an easy-to-visualize example, but the implementation I'm envisioning would have to have flexibility to use any image. Basically I'm hoping to leverage all of the existing FontMetrics and LineBreakMeasurer functionality while including icons (like emoticons) in my text, rather than having to code all of that logic from scratch.

  4. #4
    galaxyrise is offline Member
    Join Date
    Mar 2012
    Posts
    3
    Rep Power
    0

    Default Re: LineBreakMeasurer for irregular shapes? Incorporating images into a Font?

    Quote Originally Posted by galaxyrise View Post
    Afraid not... I chose smileys as an easy-to-visualize example, but the implementation I'm envisioning would have to have flexibility to use any image. Basically I'm hoping to leverage all of the existing FontMetrics and LineBreakMeasurer functionality while including icons (like emoticons) in my text, rather than having to code all of that logic from scratch.
    To answer my own question for any other googler who finds this... icons can be added with ease to an AttributedString using TextAttribute.CHAR_REPLACEMENT and an ImageGraphicAttribute.
    DarrylBurke likes this.

Similar Threads

  1. Replies: 1
    Last Post: 12-19-2010, 04:46 AM
  2. Replies: 0
    Last Post: 08-18-2010, 10:31 AM
  3. Incorporating Methods into my program
    By Moltisanti in forum New To Java
    Replies: 16
    Last Post: 10-12-2009, 06:48 AM
  4. Replies: 5
    Last Post: 04-25-2009, 08:00 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
  •