78 lines
13 KiB
Plaintext
78 lines
13 KiB
Plaintext
Medley READ-BDF
|
||
2
|
||
|
||
4
|
||
|
||
1
|
||
|
||
READ-BDF
|
||
1
|
||
|
||
4
|
||
|
||
By: Matt Heffron (heffron@alumni.caltech.edu)
|
||
This document last edited on December 2, 2025.
|
||
INTRODUCTION
|
||
This module defines functions to read BDF format font files, and then to write MEDLEYDISPLAYFONT files containing the glyphs from the source BDF file. In normal use, these font files will have remapped the glyphs from their Unicode encoding to Medley's MCCS encoding. All newly created symbols in this module are in the BDF package.
|
||
FUNCTIONS
|
||
(READ-BDF PATH &KEY :VERBOSE :MCCS-ONLY :EXTERNAL-FORMAT) [Function]
|
||
READ-BDF reads and parses the BDF file specified by PATH. (The parameter PATH is required and it does not default the extension of the filename.) This returns a BDF-FONT structure containg all of the glyphs contained in the file, unless :MCCS-ONLY is non-NIL, in which case it will contain only the glyphs which correspond to valid MCCS characters.
|
||
The :VERBOSE keyword parameter enables display of some summary information about the BDF-FONT structure created.
|
||
The :EXTERNAL-FORMAT specifies the character encoding of the BDF file itself. This can be any value acceptable to use with the CL:OPEN or IL:OPENSTREAM functions. (At least one linux utility writes BDF files as ISO8859/1, so that is the default for this parameter.) If :VERBOSE is non-NIL, then at, its completion, READ-BDF will print the full internal font name, and the values of the Family, Size, Weight, Slant, and Expansion as determined from the parsed BDF file. (Collectively, Weight, Slant, and Expansion comprise the font FACE. See the IRM 27.12, Fonts, for further description.)
|
||
(BUILD-COMPOSITE FONTS &KEY :VERBOSE) [Function]
|
||
BUILD-COMPOSITE builds a single BDF-FONT structure instance from a sequence of BDF fonts. Either BDF-FONT instances, or paths to .bdf files (either as strings or PATHNAME instances).The FONTS parameter should be a LIST. (It may be a single BDF-FONT instance or path, in which case BUILD-COMPOSITE is equivalent to READ-BDF.)
|
||
If (FIRST FONTS) is a BDF-FONT instance, it will be modified. If it designates a file, then a new BDF-FONT instance will be created. If any entry on FONTS is not one of: a BDF-FONT instance, a string, or a PATHNAME instance, an error will be raiseed.
|
||
The :VERBOSE keyword parameter enables display of the progress of the process.
|
||
The building of the composite BDF-FONT proceeds as follows. The initial font is loaded by READ-BDF if necessary. A BITMAP is created by READ-BDF from the initial font and stored in the BDF-FONT structure. This has a bit for every possible MCCS character, and that bit is set if the corresponding character glyph is present in the font. Each subsequent entry on FONTS, in turn, is loaded by READ-BDF if necessary, then each glyph present in that BDF-FONT is checked, using the initial font's BITMAP (above), to see if it is already present in the initial font. If it is not, that glyph is pushed onto the list of glyphs in the initial font and the corresponding bit is set in the BITMAP.
|
||
(WRITE-BDF-TO-MEDLEYDISPLAYFONT-FILE BDFONT DEST-DIR &KEY :FAMILY :SIZE :FACE :ROTATION :DEVICE) [Function]
|
||
WRITE-BDF-TO-MEDLEYDISPLAYFONT-FILE writes one MEDLEYDISPLAYFONT file from BDFONT containing each MCCS character set which contains glyphs mapped into it. BDFONT must be of a BDF-FONT structure. The file will be written into the provided DEST-DIR path. BDFONT and DEST<53><54> |