The Unicode HOWTO: Printing

Next Previous Contents

## 5. Printing

Since Postscript itself does not support Unicode fonts, the burden of Unicode support in printing is on the program creating the Postscript document, not on the Postscript renderer.

The existing Postscript fonts I've seen - .pfa/.pfb/.afm/.pfm/.gsf - support only a small range of glyphs and are not Unicode fonts.

## 5.1 Printing using TrueType fonts

Both the uniprint and wprint programs produce good printed output for Unicode plain text. They require a TrueType font; see section "TrueType fonts" above. The Bitstream Cyberbit gives good results.

### uniprint

The "uniprint" program contained in the yudit package can convert a text file to Postscript. For uniprint to find the Cyberbit font, symlink it to `/usr/local/share/yudit/data/cyberbit.ttf`.

### wprint

The "wprint" (WorldPrint) program by Eduardo Trapani http://ttt.esperanto.org.uy/programoj/angle/wprint.html postprocesses Postscript output produced by Netscape Communicator or Mozilla from HTML pages or plain text files.

The output is nearly perfect; only in Cyrillic paragraphs the line breaking is incorrect: the lines are only about half as wide as they should be.

### Comparison

For plain text, uniprint has a better overall layout. On the other hand, only wprint gets Thai output correct.

## 5.2 Printing using fixed-size fonts

Generally, printing using fixed-size fonts does not give an as professional output as using TrueType fonts.

### txtbdf2ps

The txtbdf2ps 0.7 program by Serge Winitzki http://members.linuxstart.com/~winitzki/txtbdf2ps.html converts a plain text file to Postscript, by use of a BDF font. Installation:

> `

>     # install -m 777 txtbdf2ps-dev.txt /usr/local/bin/txtbdf2ps

> `

Example with a proportional font:

> `

>     $ txtbdf2ps -BDF=cyberbit.bdf -UTF-8 -nowrap < input.txt > output.ps

> `

Example with a fixed-width font:

> `

>     $ txtbdf2ps -BDF=unifont.bdf -UTF-8 -nowrap < input.txt > output.ps

> `

Note: txtbdf2ps does not support combining characters and bidi.

## 5.3 The classical approach

Another way to print with TrueType fonts is to convert the TrueType font to a Postscript font using the `ttf2pt1` utility ( http://www.netspace.net.au/~mheath/ttf2pt1/, http://quadrant.netspace.net.au/ttf2pt1/, http://ttf2pt1.sourceforge.net/). Details can be found in Julius Chroboczek's "Printing with TrueType fonts in Unix" writeup, http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/printing.html.

### TeX, Omega

TODO: CJK, metafont, omega, dvips, odvips, utf8-tex-0.1

### DocBook

TODO: db2ps, jadetex

### groff -Tps

"groff -Tps" produces Postscript output. Its Postscript output driver supports only a very limited number of Unicode characters (only what Postscript supports by itself).

## 5.4 No luck with...

### Netscape's "Print..."

As of version 4.72, Netscape Communicator cannot correctly print HTML pages in UTF-8 encoding. You really have to use wprint.

### Mozilla's "Print..."

As of version M16, printing of HTML pages is apparently not implemented.

### html2ps

As of version 1.0b1, the html2ps HTML to Postscript converter does not support UTF-8 encoded HTML pages and has no special treatment of fonts: the generated Postscript uses the standard Postscript fonts.

### a2ps

As of version 4.12, a2ps doesn't support printing UTF-8 encoded text.

### enscript

As of version 1.6.1, enscript doesn't support printing UTF-8 encoded text. By default, it uses only the standard Postscript fonts, but it can also include a custom Postscript font in the output.

Next Previous Contents