IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

TrueType Fonts in Debian mini-HOWTO

Search Howtos :Match :
Next Previous Contents

4. Printing (ghostscript)

Starting with version 4, ghostscript has supported TrueType fonts as a compile-time option. Two Debian packages provide ghostscript:

  • main/binary-*/text/gs_*.deb is DFSG-compliant version 5.10,
  • non-free/binary-*/gs-aladdin_*.deb is non-DFSG-compliant version 5.50.
Both versions support TrueType fonts.

4.1 Configuring Ghostscript to use TrueType fonts

If you have a working xfstt server, it is easy to configure ghostscript to use TrueType fonts. We simply execute the following command:


# xfstt --gslist --sync >> /etc/gs.Fontmap

In practice, I've found it beneficial to make several small changes to the font definitions generated by xfstt. First, if a font name does not contain any spaces, I change the name to the usual notation. If a font name does contain spaces, I replace all spaces with dashes and the original name is added as an alias to the new name.

Finally, I prepend TTF- (or MS-) to all font names to minimize problems caused by a TrueType font having an identical name to an preexisting font.

Thus


(Arial)               (/usr/share/fonts/truetype/arial.ttf)   ;
(Arial Bold Italic)   (/usr/share/fonts/truetype/arialbi.ttf) ;

becomes


/MS-Arial             (/usr/share/fonts/truetype/arial.ttf)   ;
/MS-Arial-Bold-Italic (/usr/share/fonts/truetype/arialbi.ttf) ;
(Arial Bold Italic)   /MS-Arial-Bold-Italic                   ;
/Arial                /MS-Arial                               ;

The aliases ensure that ghostscript and xfstt can still specify the same font by a common name.

Much more significantly, with the change in the font names it's possible to instruct ghostscript to use TrueType fonts instead of the standard fonts. The documentation claims that this is also possible with parenthetical notation, but I could not get it to work.

For instance, we can instruct ghostscript to replace Helvetica fonts with Microsoft's free Arial fonts by appending the following lines to the /etc/gs.Fontmap file:


/Helvetica               /MS-Arial              ;
/Helvetica-Oblique       /MS-Arial-Italic       ;
/Helvetica-Bold          /MS-Arial-Bold         ;
/Helvetica-BoldOblique   /MS-Arial-Bold-Italic  ;

Similar aliases can be defined for the other standard fonts. These aliases would be most useful on samba printers serving Windows clients.

4.2 Printing TrueType font specimens

The best way to verify that ghostscript is properly configured to use TrueType fonts is to print font specimen pages. Assuming that you're running ghostscript 5.50 and that it is your default print queue, you can print all TrueType fonts with the following command:


# xfstt --gslist --sync | printfont

where printfont is the following shell script


#!/bin/sh

set -e
IFS= ')'

while read fontname rest
do
    cat << EOM | lpr
%!PS
(/usr/lib/ghostscript/5.50/prfont.ps) run
$fontname) DoFont
EOM
done

If you wish to print only a few fonts, the following script will be easier to use:


#!/bin/sh

set -e
while read -p "Font name, or ^D to exit: " fontname
do
    cat << EOM | lpr
%!PS
(/usr/lib/ghostscript/5.50/prfont.ps) run
$fontname DoFont
EOM
done


Next Previous Contents
Search Howtos :Match :
Glade 3.5.5
User interface builder for GTK+ and Gnome
Evolution 2.25.4
GNOME mailer, calendar, contact manager and communications tool
GEdit 2.25.4
Small but powerful text editor
Mutt 1.5.19
Small but very powerful text-based mail client.
Galculator 1.3.2
GTK 2 based scientific calculator
BlueFish 1.3.1
GTK HTML editor
Samba 3.3.0rc2
Provides file and print services to SMB/CIFS clients
Anjuta 2.25.4
Integrated Development Environment
FreeBSD 7.1
Advanced BSD UNIX operating system
Enlightenment 0.16.8.15
Nice-looking Window manager for X
Free IT Magazines, White Papers, eBooks, and more !
Dr. Dobb's Journal

Dr. Dobb's Journal enables programmers to write the most efficient and sophisticated programs and help in daily programming quandaries.

The 7 Things that IT Security Professionals MUST KNOW!

Gain key insight into security problem and find the safest means to protect your technological assets.

Database Trends and Applications

Provides timely coverage of the technology, intelligence and insight needed to plan, implement and manage information-rich projects.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info