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!
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
Re: LineBreakMeasurer for irregular shapes? Incorporating images into a Font?
Quote:
Originally Posted by
JosAH
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.
Re: LineBreakMeasurer for irregular shapes? Incorporating images into a Font?
Quote:
Originally Posted by
galaxyrise
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.