Page 1 of 1
Help with font images
Posted: 2007-01-09T14:37:39-07:00
by sequoia
I'm trying to create images of individual font characters. The images must have a fixed height, and a variable width to match the character. Using label: appears to be the right way to do this, but some font characters get clipped on the right side while other fonts do not.
Code: Select all
convert -background lightblue -fill blue -font Times-New-Roman -size x100 label:A A1.jpg
convert -background lightblue -fill blue -font Comic-Sans-ML -size x100 label:A A2.jpg
I am new to ImageMagick and appreciate any help or advice.
Posted: 2007-01-09T15:00:57-07:00
by magick
The problem you posted is a bug. It is fixed in ImageMagick 6.3.1-7 Beta. It will be released within a week or two.
Posted: 2007-01-09T15:06:11-07:00
by sequoia
Wonderful! I will keep a watch for that new version.
Thanks.
Posted: 2007-01-11T22:09:55-07:00
by anthony
the new label update is demonstrated in IM examples...
Label Image Bounds
http://www.cit.gu.edu.au/~anthony/graph ... xt/#bounds
Aside. Thanks to cristy for the fast bug fix for bounding boxes that was introduced with this, and to also expand BOTH right and LEFT bounds of the lable if nessary.
The 'H' letter of LokiCola font is particaulrly bad as you can see in the later section...
Bounding Box Overflows..
http://www.cit.gu.edu.au/~anthony/graph ... /#overflow
Posted: 2007-01-12T09:18:16-07:00
by sequoia
Quite impressive! I tried it on some of my "tough" fonts and it worked great. Thanks for the speedy and informative reply.
Posted: 2007-01-12T11:17:50-07:00
by sequoia
Using ImageMagick 6.3.1 01/11/07 Q16, some characters show a little extra like the one below using
Helsinki
Code: Select all
convert.exe -background lightblue -fill blue size x100 -border 20x0 -font Helsinki -label:J J.jpg
Posted: 2007-01-15T22:19:55-07:00
by anthony
Haven't seen this effect before.
It may be that you are seeing strange effects due to not difining your image BEFORE making further operations. Try...
Code: Select all
convert.exe -background lightblue -fill blue -font Helsinki -size x100 label:J -border 20x0 J.jpg
All the options before
label: are settings for the label. The
-border is a seperate operator that needs an image to work with, so should be after the
label:
Also try
-border 20x5 how did that differ?
Posted: 2007-01-15T22:37:19-07:00
by anthony
I downloaded the font and tring it our on the latest 3.2.0-0 beta and had no problems.
Posted: 2007-01-15T23:38:05-07:00
by sequoia
Agreed, the problem is not there with the latest 6.3.2 beta. Thanks!
Another question please, is there a way to generate an image for a single space character (0x20 or 0xA0)? I can't figure out how to get just a space other than simply creating a blank image. The problem with that is the width is then up to me and not based on the font definition. Thanks for any help.
Posted: 2007-01-16T00:15:06-07:00
by anthony
I see what you mean you get a very thin space!
that seems to be due to the way label is now adjusting its size. Didn't use to be like that.
The problem is that is the bounding box size for space! Most word processes use a base space size that is specified by the font itself, and then adjusts that size according to justification settings. IM doesn't have that luxury.
Basically a space is infinately thin unless the situation specifies otherwise.
however I beleve the typical space size is the bounding box size for 'n'.
whcih is also use for a interword 'dash'.
As such try..
Code: Select all
convert.exe -background lightblue -fill lightblue -font Helsinki -size x100 label:- -border 20x0 space.jpg
note I set the fill color to the background color!!!
You can also try -annotating the space but then you need to specify the point size rather than bounding box height! Note pointsize is the line separate distance of a font. You can still have a small or large font at the same pointsize, however pointsize is the more normal way of specifything a font.
Code: Select all
convert -size 120x120 xc:white -gravity center -box lightblue -fill blue -font helsinki.ttf -pointsize 80 -annotate 0 ' ' x:
Note -bix specifies a a color for the texts bounding box, which is what word processes use to fit characetrs together. The drawn characters themselves do not nessarilly fit inside that bounding box... though often does, and seems to be the case for the Helsinki font.
That font by the way is incomplete -- no tilde ('~'), or '@', only uppercase, etc... Any specific reason you are using it? What are you planing to do with it?
Posted: 2007-01-16T00:33:01-07:00
by sequoia
Thanks for that info. I'll try your suggestions shortly. This particular font is jsut one of several that I'm looking at using. It was referenced because it showed the "extra stuff" with 6.3.1 01/11/07.
The application is to print rotated characters in HTML. The characters to be printed are not known until the page is generated, and there is no scripting available to create an image for character strings, so each character must be an individual image. I'm automating the creation of the individual character files.
Posted: 2007-01-16T19:31:54-07:00
by anthony
Yuck. that is really a bad situation.