[magick-users] imagick_type_gen enhancement
T o n g
mlist4suntong at yahoo.com
Tue Jan 6 14:49:03 PST 2009
Hi Anthony,
I found that the imagick_type_gen inconvenient for me to use because I
have been trying to add only several fonts into my system each day for
several days. So I made a small enhancement to it.
I thought I could live with the limitation, but after several days doing
the same thing, I finally can't stand it. Because, each time, I have to
either wait until next day for locate db to be updated, or run the long
long updatedb just to add those several fonts -- most time it were just
only one or two fonts.
Moreover, the script picks up many duplicated fonts that I don't want.
There is no way to remove duplicated or unwanted fonts. I have to
manually edit the generated file each time. Removing those tried fonts
that I don't like gave me the same pain as well.
In conclusion, the imagick_type_gen is
- good to add all fonts within the system to ImageMagick once, but
- not convenient to add just several fonts
- not convenient to add new fonts that is not in locate db yet
- no way to remove duplicated or unwanted fonts
- depends on the external command 'locate'.
My small enhancement is decoupling the generation of font list and font
registration. Now the fonts that imagick_type_gen needs to register is
read from stdin. So it has the convenient to add fonts system wide, or
only a picked sub set.
To dupe the old behavior (with a little enhancement in speed)
slocate -ir '\.\(ttf\|pfb\|afm\)$' | imagick_type_gen
The only fonts that I care is what I put in a central location. In this
case, I don't need to way for locate db to be updated:
find /path/to/my/fonts | imagick_type_gen
The benefits for this is that I can group fonts in different categories
and only need to update the modified ones. Here is my type.xml (under
Debian):
$ tail -4 /usr/lib/ImageMagick-6.3.7/config/type.xml
<typemap>
<include file="type-ghostscript.xml" />
<include file="type-win_en.xml" />
</typemap>
Anthony, I have received tremendous helps from you, and now I consider it
is a chance to give back. If you want, I can send the patch to you, or
post it here... all up to you.
cheers
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
More information about the Magick-users
mailing list