Monospaced fonts with IM
Posted: 2010-05-30T00:04:56-07:00
Hi guys -
I'm trying to use IM to render a texture atlas (a constant-width set of tiles, one per printable character) for a old-school RPG game I'm working on. I originally thought I could do something like:
The problem, as I'm discovering, is that no matter what font I specify (I've tried 'fixed', 'Courier', 'Lucida-Console-Normal'), the width of the characters is never consistent. I banged together a little test program to show this:
With some sample output:
The interesting thing about this is how thin characters like 'I' are, well, very thin. But nothing about this looks like a monospaced font to me.
Any suggestions on how to generate the image atlas I'm looking for?
Cheers,
--G
I'm trying to use IM to render a texture atlas (a constant-width set of tiles, one per printable character) for a old-school RPG game I'm working on. I originally thought I could do something like:
Code: Select all
INPUT=" !\"#$%&'()*+,-./01234\n56789:;<=>?@ABCDEFGHI\nJKLMNOPQRSTUVWXYZ[\\\\]^\n_\`abcdefghijklmnopqrs\ntuvwxyz{|}~"
convert -background none -font ${FONT} -pointsize ${POINTSZ} label:"${INPUT}" ${DEST}.png
Code: Select all
for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z; do
convert -format $i': %wx%h' -background none -font fixed -pointsize 20 label:"$i" info:
done
Code: Select all
A: 14x21
B: 13x21
C: 14x21
D: 12x21
E: 12x21
F: 11x21
G: 15x21
H: 12x21
I: 4x21
Any suggestions on how to generate the image atlas I'm looking for?
Cheers,
--G