4 * Format of a psf font file:
8 * 3. Unicode information
12 * Format of the Unicode information:
14 * For each font position <uc>*<seq>*<term>
15 * where <uc> is a 2-byte little endian Unicode value,
16 * <seq> = <ss><uc><uc>*, <ss> = psf1 ? 0xFFFE : 0xFE,
17 * <term> = psf1 ? 0xFFFF : 0xFF.
18 * and * denotes zero or more occurrences of the preceding item.
21 * The leading <uc>* part gives Unicode symbols that are all
22 * represented by this font position. The following sequences
23 * are sequences of Unicode symbols - probably a symbol
24 * together with combining accents - also represented by
28 * At the font position for a capital A-ring glyph, we
30 * 00C5,212B,FFFE,0041,030A,FFFF
31 * Some font positions may be described by sequences only,
32 * namely when there is no precomposed Unicode value for the glyph.
39 #define PSF1_MAGIC0 0x36
40 #define PSF1_MAGIC1 0x04
42 #define PSF1_MODE512 0x01
43 #define PSF1_MODEHASTAB 0x02
44 #define PSF1_MODEHASSEQ 0x04
45 #define PSF1_MAXMODE 0x05
47 #define PSF1_SEPARATOR 0xFFFF
48 #define PSF1_STARTSEQ 0xFFFE
51 unsigned char magic[2]; /* Magic number */
52 unsigned char mode; /* PSF font mode */
53 unsigned char charsize; /* Character size */
57 * Format and semantics of psf2 version 0 are as psf (with PSF_MAXMODE == 5).
58 * However, this allows one to specify the length.
59 * It turns out to be very useful to be able to work with fonts
60 * with a few symbols or even only one (like the Euro), and
61 * with very large fonts (like several thousand Unicode symbols
62 * done in the same style).
63 * Following hpa's suggestion, psf2 uses UTF-8 rather than UCS-2,
64 * and has 32-bit magic 0x864ab572.
65 * The integers here are little endian 4-byte integers.
68 #define PSF2_MAGIC0 0x72
69 #define PSF2_MAGIC1 0xb5
70 #define PSF2_MAGIC2 0x4a
71 #define PSF2_MAGIC3 0x86
74 unsigned char magic[4];
76 unsigned int headersize; /* offset of bitmaps in file */
78 unsigned int length; /* number of glyphs */
79 unsigned int charsize; /* number of bytes for each character */
80 unsigned int height, width; /* max dimensions of glyphs */
81 /* charsize = height * ((width + 7) / 8) */
84 /* bits used in flags */
85 #define PSF2_HAS_UNICODE_TABLE 0x01
87 /* max version recognized so far */
88 #define PSF2_MAXVERSION 0
91 #define PSF2_SEPARATOR 0xFF
92 #define PSF2_STARTSEQ 0xFE
95 #define PSF1_MAGIC_OK(x) ((x)[0]==PSF1_MAGIC0 && (x)[1]==PSF1_MAGIC1)
96 #define PSF2_MAGIC_OK(x) ((x)[0]==PSF2_MAGIC0 && (x)[1]==PSF2_MAGIC1 \
97 && (x)[2]==PSF2_MAGIC2 && (x)[3]==PSF2_MAGIC3)