[magick-users] Re: Use ImageMagick to document font

Anthony Thyssen anthony at griffith.edu.au
Sun Dec 3 21:28:31 CST 2006


T on  wrote...
| On Fri, 01 Dec 2006 10:58:31 +1000, Anthony Thyssen wrote:
| 
| > If you read a font file as a image. IM will generate a standard 'font
| > description' image...
| > 
| >    convert arial.ttf   arial_index.jpg
| 
| hmm... one problem, I notice that not all number characters are shown.
| Only 0~6 are in the description image, 7~9 have been cut out. I tried 2
| fonts, both are the same. 
| 
| Are number characters 7~9 intentionally left out? What else basic ascii
| chars are left out?
| 
| thanks
| 
I wrote a script as I had described, and processed the output
of the whole latin unicode character range.

Charcaters I had problems with...
   controls         0x00 to 0x20
   space            proportional fonts produce a very large space!
   single quote     does not wrap in shell single quotes
   at symbol        IM treats a first '@' symbol in a string as special.
   Code 0xA0        I think IM treats this meta-@ like an '@' symbol

The Script is in..
  http://www.cit.gu.edu.au/~anthony/graphics/imagick6/scripts/text2img_fixed

try... (using the graphics_utf script also in same directory)

    graphics_utf 0020 0080 | text2img_fixed -l 60  output.gif

which is basically what you were trying to achieve :-)

Replace output.gif with  x:   for a on screen display.
Could take some time as lots of commands are being processed.

Line length is fixed to 70 unicode characters.

But while working, is not complete, as I would like to do further
charcater processing...

  * bounding box, baseline coloring.

  * The character trimming should probably preserve lable height.
    as charcater symbol baselines are not preserved.
    that is a quote and comma are output centered in the character cell.

  * Merging of multiple 'converts' commands into a single larger
    (and faster) command.   Or full conversion to PerlMagick.

  * better handling of 'space' and 'missing' charcaters in fonts.
    (EG;  0xA0  in Arial is a missing character)
    See bug note below...


IM BUG.....
The -trim becomes a no-op when used for a blank 'space' label
(probably should produce a 'null:' error image instead).


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
                All computers wait at the same speed.
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list