O'Reilly logo

Fonts & Encodings by Yannis Haralambous

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A.4. The Unix World

A.4.1. The PSF Format of Linux

The acronym PSF stands for "PC Screen Font". This font format is peculiar to Linux and is used only for monospaced fonts meant for on-screen display. It was defined in 1989 by Peter Arvin for his DOS font editor, fontedit. Later adopted by Linus Torvalds for Linux, it was supplemented with Unicode tables in 1994 and, finally, was updated in version 2 of 1999.

Version 1 of the PSF format is of a childlike simplicity. It begins with a 4-byte heading, in which the first 2 bytes are fixed (0x3604), the third contains three flags (does the font contain 256 or 512 glyphs? does it have a Unicode table? does this table contain character sequences?[3-4]), and the fourth contains the height of the glyphs in pixels. Next come the bitmap images of all the glyphs, described in the following manner: the width being fixed at 8 pixels (one byte), each glyph is described row by row, and thus needs as many bytes as there are pixels in its height.

[3-4] By Unicode character sequences, we mean a Unicode character followed by at least one combining character.

The heading in Version 2 of the PSF format is slightly longer (32 bytes, or even more), since this version considerably extends the preceding one: the number of glyphs is arbitrary (encoded as 4 bytes), and the height and width of the glyphs are configurable. Here is this heading (made up of eight 4-byte numbers):

  • A fixed value (0x72b54a86)

  • The version (0x00)

  • The size of the heading (to allow for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required