Page 1 of 1
Multi colored text.. font metrics?
Posted: 2006-03-23T17:10:40-07:00
by dognose
Hi,
I'm trying to add multicolored text (ie. each letter a different color) to an image, I'm using the command line tools.
How would I do this?
I'd Image I'd have to draw out each letter of the text indivually, but how do I get the spacing to do that properly, programmatically?
Posted: 2006-03-23T18:00:16-07:00
by anthony
For different colors and styles the only way is to draw each letter (or word) seperatally, then append them together as appropriate. If you are using the same font and font size, straight append should work perfectly fine. If you chnage fonts, pointsizes, or change stroke widths, or do other effects to the letters then direct appending will nolonger work.
Basically IM is NOT as Wordprocessor, it is a Image processor. Though it can (with difficulty) get simular results.
For examples of this type of handling see...
Creating Lines of Mixed Font Styles
http://www.cit.gu.edu.au/~anthony/graph ... font_lines
Posted: 2006-03-24T11:17:57-07:00
by dognose
Posted: 2006-03-26T22:19:56-07:00
by anthony
If this is typical of what you are attempting, you could try recoloring the color gradient in a specific reagion. the offset and size of the region could be determined by finding the text lengths.
Basically what this shows is that the bounding box of the font has the stroke width extra space added to the bounds.
Hmm do you have the font and commands you used for the above?
Mail it to me so I can show this as a problem on the IM examples web pages.
Mail as I am dissappearing for the whole of april overseas. (Austrialia to Europen via Korea)
Posted: 2006-03-28T23:21:41-07:00
by dognose
Well, I'm not sure if the region painting would work... some letters may overlap in strange ways... and, if I could get the dimentions of the letters, I could draw them seperately.
how would I properly get the dimensions of the letters? Is there another program outside of IM command line tools?
Posted: 2006-03-29T00:45:32-07:00
by anthony
If you are using an API you can get the bounds of a string directly.
This includes the outside bounds and the 'movement of the cursor'
which is what you are needing.