Colored vowels?

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
xartle
Posts: 2
Joined: 2011-04-28T09:18:44-07:00
Authentication code: 8675308

Colored vowels?

Post by xartle »

Hi all,

This is a fairly random sounding request, but I need to find a way to color consonants and vowels differently in an annotation line. I'm writing a perl script to generate memory cards for a preschool and they want to color code the vowels for all of their materials.

Does anyone have any idea how I can accomplish that? I can't for the life of me figure out how to do it in a reasonable way with a standard font. So far the only way I've been able to come up with was to create two strings from the source text and then use a mono-spaced font with two different annotate lines. Of course, they don't like the font. So my next thought was to generate 48 images (one for both cases and every letter) and then do a bunch of math to put every letter in the right place. It just seems like there should be an easier way so I thought I would ask the experts.

Thanks!
xartle
Posts: 2
Joined: 2011-04-28T09:18:44-07:00
Authentication code: 8675308

Re: Colored vowels?

Post by xartle »

It took ignoring the problem for a bit, but I did come up with a simple solution. I took the font file I wanted then used fontforge to save two different copies of the font, one with all consonants and the other with all vowels. Then I could annotate the same location with the same text in both fonts and end up with different colors. This works great for my situation. I doubt this will be a common problem, but I thought I'd post my work around in case it could help someone save a day or two.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Colored vowels?

Post by anthony »

Now that is a very nice solution! Thanks for sharing.

However if the font is already drawn, then you would somehow need to either pattern match, do full OCR (Optical Character Reconition), or use the DjVu method of sub-image sub-division with selections of what sub-images needs to be modified.

That last I would find the most interesting (if I had time to spend on it), but DjVu does not make it easy to create djvu files (copyright program to generate) or decode existing djvu files (though they do publish the format, but its at a very low level).

However doing it as you draw it, by dividing the font into two is a very simple solution.

This is typically why you can find some fonts with a separate 'solid' and 'outline' versions.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply