Wednesday, October 29, 2008

ImageMagick, RMagick, Kerning, and baseline_shift

As I said on Monday, at some point there has to be the first person to blog a useful tidbit in the world of software.

So, for the second time this week, let me be the first.

I've been using ImageMagick--via RMagick--to generate dynamic PNGs on the server.

In general, it's working great, except in one case.

I'm drawing text with custom fonts. The fonts have custom kerning.

ImageMagick seems to handle this fine except when one uses baseline_shift, at which point ImageMagick forgets everything about kerning.

You can fake the baseline shift by using get_type_metrics.

Again, here's hoping this saves someone 20 minutes...or in my case, a few hours.

2 comments:

Jonah said...

Hi I am trying to getting kerning to work in ImageMagick.

How did you get it to work ?

Kevin Moore said...

I haven't played with it much...other than wanting fonts with custom kerning. I stopped using baseline_shift and everything started to work.