s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
Next
Previous
Contents
5. Making Fonts Available To GhostscriptTo make fonts available to ghostscript, it suffices to tell ghostscript
where the files corresponding to a given font are located. The
file that needs to be edited is
5.1 Type1Adding Type1 fonts is straightforward. Run 5.2 True TypeAdding truetype fonts is a little trickier, because we have to get the
name of the TrueType font. One way (brute force, alas) to do this is using
the ttf2pt1 -A fontname - 2 > /dev/null |grep FontNameThen you add an entry to the ghostscript Fontmap file
in the correct format, eg
some-font (/usr/share/fonts/subdirectory/somefont.pbf);Well, that works fine, but try doing it with 500 or so fonts. This is the kind of thing that calls for a short perlscript: #!/usr/bin/perl # ttfontmap -- generate fontmap file for TrueType fonts my $directory=shift || print STDERR "Usage: ttfontmap {directory}\n"; $directory=~s/\/$//; for my $fontname ( glob ( "$directory/*.ttf" ) ) { open ( R, "sh -c \"ttf2pt1 -A $fontname - 2>/dev/null\" |" ); while ( <R> ) { if ( $_ =~ /^FontName/ ) { s/^FontName\s*//; chomp; print "/" . $_ . " ($fontname);\n" ; } } close R; }You can download this script To set this script up, all you need to do is cut and paste it into
a file called ttfontmap directory > output_filewhere directory is the directory containing the
fonts. You are left with the file output_file which you can append
to your ghostscript fontmap. Note: some will observe that you could
just use
ttfontmap directory >> /usr/share/ghostscript/version/FontmapHowever, I advise against this ( what would happen if you typed ``>'' instead of ``>>'' ? ) 5.3 Using Ghostscript To Preview FontsOnce you've made fonts available to ghostscript, you can preview them.
Do this by running the ghostscript interpreter on the file /Fontname DoFontat the ghostscript font ( where FontName is the ghostscript
name of the font you wish to preview ).
There are several other ways you can invoke gs . For example,
if you want to create a postscript file that you can look at in
a nicer postscript viewer such as gv , you can use
gs -sDEVICE=pswrite -sOutputFile=somefile.ps prfont.psHaving done this, you can also print your output file.
Next Previous Contents |