[Plib-cvs] plib/tools/src/afm2txf README,NONE,1.1 afm2txf.pl,NONE,1.1
Brought to you by:
sjbaker
From: Sebastian U. <ud...@us...> - 2002-06-28 15:07:11
|
Update of /cvsroot/plib/plib/tools/src/afm2txf In directory usw-pr-cvs1:/tmp/cvs-serv1116/afm2txf Added Files: README afm2txf.pl Log Message: Added afm2txf script by Andy Ross to the repository --- NEW FILE: README --- It's definitely a tool of the "duct tape and fishing line" variety. :) It expects to find a ghostscript interpreter and ImageMagick's "mogrify" program on the command line, takes a .afm font metrics file as its sole argument, and expects that the font therein is accessible to ghostscript. Basically, it should work out of the box on most linux distributions, and nowhere else without a lot of work. If you have a TrueType font that you want to generate: export GS_FONTPATH=<wherever the font is> ttf2afm yourfont.ttf > whatever.afm font.pl whatever.afm Wait for a while (at 16x downsampling, this takes 1-2 minutes on my Athlon 1800+), and the .txf file will appear in the current directory. It will have the Postscript language name of the font. Andy --- NEW FILE: afm2txf.pl --- #!/usr/bin/perl -w # afm2txf.pl 0.2 # # Generates .txf font textures from Type 1 fonts # Requirements: Ghostscript, ImageMagick # # Usage: # afm2txf.pl whatever.afm # # Changelog: # 0.2 (06/28/2002): Generate fonts with proper padding # 0.1 (06/28/2002): Initial version # # Copyright (C) 2002 Andy Ross use strict; my $METRICS = shift or die; # AFM file [...239 lines suppressed...] return undef if $y < 0; } # Record where in the texture the box ended up $positions{$c} = [$x, $y]; my $vx = $x + $m->[1]*$LINEHGT; my $vy = $y + $m->[2]*$LINEHGT; push @PS, "$vx $vy moveto"; push @PS, "<$id> show"; # Next box... $x += $w + 2*$PADDING/$TEXSIZ; } push @PS, "showpage"; return \@PS; } |