Page 1 of 1

typemap utilities

Posted: 2008-12-08T09:54:29-07:00
by RetroJ
Hello,

I have a large collection of fonts, so to be able to use them in an organized fashion with imagemagick---only the ones I want at any given time, I wrote two utilities to assist me with managing imagemagick typemap files.

These programs depend on xmlstarlet, as well as a few common perl modules.
  • typemap-list
    http://jjfoerch.com/git/gphx/typemap-list

    This one is really simple. It just lists the names of the fonts defined in the given typemap xml file. Handy for iterating over a particular set of fonts.
  • typemap-generate
    http://jjfoerch.com/git/gphx/typemap-generate

    This one is meant to do the same basic job as imagick-type-gen, but to give the user more control over what fonts to put in the typemap. It can also edit an existing typemap. It uses the perl module Font::TTF::Font to get the font name, so it seems to do a better job of getting the correct name than imagick-type-gen. Could be improved, regarding fonts that contain no english or default name, but the basics are already in place for proper language support. It doesn't support Type1 fonts yet---that's on the to-do list. This program also supports inserting <include> directives into an existing typemap.

    I might as well paste the help text to give everyone an idea of how to use it:

    Code: Select all

    usage:  typemap-generate [options..] [files..]
         where files are .ttf, .xml files or `list:'.  For each ttf file,
         a `type' definition will be added to the output.  For each xml file,
         an `include' specification will be added to the output.  For `list:'
         a list of files will be read from stdin.
    
         options:
          -o, --output FILE   set output to FILE
          -e, --edit          modify output file instead of overwriting it
          -h, --help          display this help
    
I hope people find these programs useful. Patches and constructive feedback are most welcome.