1. Font Format (.f)
- Posted by Cox Family <cox.family at SK.SYMPATICO.CA> Jan 26, 1999
- 356 views
Dear Euphorians, Would anyone here happen to have any information about the file format used for the .f fonts in Jiri Babor's (excellent) 'font.e' library? I've been hoping to try to make my own fonts for this, but can't seem to find the information needed. Does anyone have any info? Thanks in advance. Chris Cox cox.family at sk.sympatico.ca
2. Re: Font Format (.f)
- Posted by Jiri Babor <J.Babor at GNS.CRI.NZ> Jan 27, 1999
- 358 views
Chris Cox wrote: >Would anyone here happen to have any information >about the file format used for the .f fonts in Jiri Babor's >(excellent) 'font.e' library? I've been hoping to try to >make my own fonts for this, but can't seem to find the >information needed. It's actually quite simple and you can find it at the beginning of the font.e include. I quote: -- font file format -- byte 1: ascii code of the first char -- byte 2: ascii code of the last char -- byte 3: width in bytes -- byte 4: height in pixels -- byte 5: version unused -- byte 6: baseline height -- next block of bytes: actual char widths -- next block of bytes: simple char bitmaps, left-to-right, top-to-bottom In other words, each file has its own six byte header. The header is followed by a list of *actual* widths, in *pixels*, a separate byte for each character. Only one *contiguous* (solid, no gaps) block of characters can be saved in the file. Individual characters are stored as bitmaps of *fixed* dimensions: the width (in bytes) given in byte 3 and the total (nominal) height (in pixel rows) in byte 4. So, for example, if we have a (common) set starting with the space character (ascii 32) to ascii 127, the width of the fattest character 13 pixels, and the nominal font height is 16 pixels, the header would be something like this: byte 1: 32 byte 2: 127 byte 3: 2 -- 2 bytes (=16 bits) required for 13 pixels byte 4: 16 byte 5: 4 -- current version, unused byte 6: 12 -- height of chars *without* descenders This would be followed by 96 (127-32+1) width bytes and that, in turn, by 96 32 (2*16) byte blocks (bitmaps). Caution: bitmap bytes store pixels in reverse order to that obtained by int_to_bits() function! So instead of using int_to_bits() and reverse() pair, fetch my own one line conversion from font.e - it's much faster anyway. jiri