|
Packit Service |
50ad14 |
/* psf.h */
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/*
|
|
Packit Service |
50ad14 |
* Format of a psf font file:
|
|
Packit Service |
50ad14 |
*
|
|
Packit Service |
50ad14 |
* 1. The header
|
|
Packit Service |
50ad14 |
* 2. The font
|
|
Packit Service |
50ad14 |
* 3. Unicode information
|
|
Packit Service |
50ad14 |
*/
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/*
|
|
Packit Service |
50ad14 |
* Format of the Unicode information:
|
|
Packit Service |
50ad14 |
*
|
|
Packit Service |
50ad14 |
* For each font position <uc>*<seq>*<term>
|
|
Packit Service |
50ad14 |
* where <uc> is a 2-byte little endian Unicode value,
|
|
Packit Service |
50ad14 |
* <seq> = <ss><uc><uc>*, <ss> = psf1 ? 0xFFFE : 0xFE,
|
|
Packit Service |
50ad14 |
* <term> = psf1 ? 0xFFFF : 0xFF.
|
|
Packit Service |
50ad14 |
* and * denotes zero or more occurrences of the preceding item.
|
|
Packit Service |
50ad14 |
*
|
|
Packit Service |
50ad14 |
* Semantics:
|
|
Packit Service |
50ad14 |
* The leading <uc>* part gives Unicode symbols that are all
|
|
Packit Service |
50ad14 |
* represented by this font position. The following sequences
|
|
Packit Service |
50ad14 |
* are sequences of Unicode symbols - probably a symbol
|
|
Packit Service |
50ad14 |
* together with combining accents - also represented by
|
|
Packit Service |
50ad14 |
* this font position.
|
|
Packit Service |
50ad14 |
*
|
|
Packit Service |
50ad14 |
* Example:
|
|
Packit Service |
50ad14 |
* At the font position for a capital A-ring glyph, we
|
|
Packit Service |
50ad14 |
* may have:
|
|
Packit Service |
50ad14 |
* 00C5,212B,FFFE,0041,030A,FFFF
|
|
Packit Service |
50ad14 |
* Some font positions may be described by sequences only,
|
|
Packit Service |
50ad14 |
* namely when there is no precomposed Unicode value for the glyph.
|
|
Packit Service |
50ad14 |
*/
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#ifndef _PSF_H
|
|
Packit Service |
50ad14 |
#define _PSF_H
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#define PSF1_MAGIC0 0x36
|
|
Packit Service |
50ad14 |
#define PSF1_MAGIC1 0x04
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#define PSF1_MODE512 0x01
|
|
Packit Service |
50ad14 |
#define PSF1_MODEHASTAB 0x02
|
|
Packit Service |
50ad14 |
#define PSF1_MODEHASSEQ 0x04
|
|
Packit Service |
50ad14 |
#define PSF1_MAXMODE 0x05
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#define PSF1_SEPARATOR 0xFFFF
|
|
Packit Service |
50ad14 |
#define PSF1_STARTSEQ 0xFFFE
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
struct psf1_header {
|
|
Packit Service |
50ad14 |
unsigned char magic[2]; /* Magic number */
|
|
Packit Service |
50ad14 |
unsigned char mode; /* PSF font mode */
|
|
Packit Service |
50ad14 |
unsigned char charsize; /* Character size */
|
|
Packit Service |
50ad14 |
};
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/*
|
|
Packit Service |
50ad14 |
* Format and semantics of psf2 version 0 are as psf (with PSF_MAXMODE == 5).
|
|
Packit Service |
50ad14 |
* However, this allows one to specify the length.
|
|
Packit Service |
50ad14 |
* It turns out to be very useful to be able to work with fonts
|
|
Packit Service |
50ad14 |
* with a few symbols or even only one (like the Euro), and
|
|
Packit Service |
50ad14 |
* with very large fonts (like several thousand Unicode symbols
|
|
Packit Service |
50ad14 |
* done in the same style).
|
|
Packit Service |
50ad14 |
* Following hpa's suggestion, psf2 uses UTF-8 rather than UCS-2,
|
|
Packit Service |
50ad14 |
* and has 32-bit magic 0x864ab572.
|
|
Packit Service |
50ad14 |
* The integers here are little endian 4-byte integers.
|
|
Packit Service |
50ad14 |
*/
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#define PSF2_MAGIC0 0x72
|
|
Packit Service |
50ad14 |
#define PSF2_MAGIC1 0xb5
|
|
Packit Service |
50ad14 |
#define PSF2_MAGIC2 0x4a
|
|
Packit Service |
50ad14 |
#define PSF2_MAGIC3 0x86
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
struct psf2_header {
|
|
Packit Service |
50ad14 |
unsigned char magic[4];
|
|
Packit Service |
50ad14 |
unsigned int version;
|
|
Packit Service |
50ad14 |
unsigned int headersize; /* offset of bitmaps in file */
|
|
Packit Service |
50ad14 |
unsigned int flags;
|
|
Packit Service |
50ad14 |
unsigned int length; /* number of glyphs */
|
|
Packit Service |
50ad14 |
unsigned int charsize; /* number of bytes for each character */
|
|
Packit Service |
50ad14 |
unsigned int height, width; /* max dimensions of glyphs */
|
|
Packit Service |
50ad14 |
/* charsize = height * ((width + 7) / 8) */
|
|
Packit Service |
50ad14 |
};
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/* bits used in flags */
|
|
Packit Service |
50ad14 |
#define PSF2_HAS_UNICODE_TABLE 0x01
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/* max version recognized so far */
|
|
Packit Service |
50ad14 |
#define PSF2_MAXVERSION 0
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/* UTF8 separators */
|
|
Packit Service |
50ad14 |
#define PSF2_SEPARATOR 0xFF
|
|
Packit Service |
50ad14 |
#define PSF2_STARTSEQ 0xFE
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#define PSF1_MAGIC_OK(x) ((x)[0] == PSF1_MAGIC0 && (x)[1] == PSF1_MAGIC1)
|
|
Packit Service |
50ad14 |
#define PSF2_MAGIC_OK(x) ((x)[0] == PSF2_MAGIC0 && (x)[1] == PSF2_MAGIC1 && (x)[2] == PSF2_MAGIC2 && (x)[3] == PSF2_MAGIC3)
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#endif /* _PSF_H */
|