1
0
mirror of synced 2026-01-26 04:12:03 +00:00
Files
Interlisp.medley/lispusers/READ-BDF.TEDIT
Matt Heffron 1491fa91cc READ-BDF add ability to create FONTDESCRIPTOR and write DISPLAYFONT files (#2015)
* Now can create the FONTDESCRIPTOR with all non-empty charsets.
Can write DISPLAYFONTFILE format ("STRIKE") files for the charsets.
Add ability to use mapping of Unicode charcode to unknown XCCS charcode in the private space.

* Create 2nd FONTDESCRIPTOR for unmapped Unicode to XCCS charcodes, organized by charset-like (8-bit splitting of charcode) of Unicode encoding value.

* Added option to create and write files for RAW FONTDESCRIPTOR which does NO mapping from Unicode to XCCS.
All glyphs are at the Unicode encoding positions.
Any glyphs with Unicode encoding > xFFFF are not included in the FONTDESCRIPTOR or DISPLAYFONT files.

* Fix a bug where I assumed glyph names couldn't be parsed as a number; and a little cleanup.
The linux otf2bdf utility uses the hex of encoding value as the name, which can appear to be a FLOAT and overflow (i.e., 3D39). 
Similar parsing problem fixed and corrected an error message.

* Initial documentation file written.
2025-04-14 12:08:10 -07:00

41 lines
6.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Medley READ-BDF
2
4
1
READ-BDF
1
4
By: Matt Heffron (heffron@alumni.caltech.edu)
This document last edited on April 12, 2025.
INTRODUCTION
This module defines functions to read BDF format font files, and then to write DISPLAYFONT files containing the glyphs from the source BDF file. In normal use, these DISPLAYFONT files will have remapped the glyphs from their Unicode encoding to Medley's XCCS encoding. All newly created symbols in this module are in the BDF package.
FUNCTIONS
(BDF:READ-BDF PATH) [Function]
BDF:READ-BDF reads and parses the BDF file specified by PATH. (It is required and does not default the extension of the filename.) This returns a BDF::BDF-FONT structure containg all of the glyphs contained in the file.
(BDF:WRITE-BDF-TO-DISPLAYFONT-FILES BDFONT DEST-DIR &OPTIONAL MAP-UNKNOWN-TO-PRIVATE RAW-UNICODE-MAPPING FAMILY SIZE FACE ROTATION DEVICE) [Function]
BDF:WRITE-BDF-TO-DISPLAYFONT-FILES writes DISPLAYFONT files from BDFONT, for each XCCS character set which contains glyphs mapped into it. BDFONT must be of a BDF::BDF-FONT structure. The files will be written into the corresponding sub-directory of DEST-DIR by character set number. BDFONT and DEST-DIR must be provided.
MAP-UNKNOWN-TO-PRIVATE selects how glyphs (character codes) which are present in the BDF file but do not map into XCCS should be handled. If non-NIL, then those will be mapped into the private range of the XCCS encoding space, and the corresponding DISPLAYFONT files will be written. If MAP-UNKNOWN-TO-PRIVATE is NIL (the default), then they will be written, with their BDF (Unicode) encoding, into a parallel set of DISPLAYFONT files with "-UNMAPPED" appended to the FAMILY part of the file name.
RAW-UNICODE-MAPPING, if non-NIL, overrides the mapping of character codes from the BDF file (Unicode) encoding to XCCS encoding, and just writes the DISPLAYFONT files according to the BDF file encoding for the glyphs. It will prefix the FAMILY part of the file name with "RAW-". This defaults to NIL.
FAMILY SIZE FACE ROTATION DEVICE correspond to the same arguments to IL:FONTCREATE. BDF:WRITE-BDF-TO-DISPLAYFONT-FILES will attempt to get default values from the information in the BDF::BDF-FONT. FAMILY may be a list of values as for IL:FONTCREATE, in which case SIZE FACE ROTATION and DEVICE are taken from the FAMILY list. FAMILY may also be an IL:FONTDESCRIPTOR, again as for IL:FONTCREATE, in this case the values will be used if no values were specified or found in the BDF::BDF-FONT.
NOTES
ÿÿïf ÿThe names of the two entry point functions, READ-BDF and WRITE-BDF-TO-DISPLAYFONT-FILES, are the only symbols exported from the BDF package, all others are internal to that package.
ÿÿïfÿ For BDF files containing a large number of glyphs, BDF:READ-BDF can take quite a while and use a lot of memory. For example, READ-BDF of gnu unifont-16.0.02.bdf with 57086 glyphs, took 72 seconds, and allocated 1.3 million FIXP and 3.3 million ONED-ARRAY.)
(SEQUENCE NIL NIL (0 0 0 0) ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "" "") STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (ALTERNATE NIL NIL (0 0 0 0) ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))))) 1$4È $È4È$È5È$ÈT7äÈ$äÈ1È$1ŠŠ8$1ŠŠ8$JÈ$È PAGEHEADING RUNNINGHEAD MODERN
GACHA
MODERN
MODERN
MODERN
MODERN
 HELVETICA
MODERN
MODERN MODERN
TIMESROMAN$  
  HRULE.GETFN HRULE.GETFN HRULE.GETFN  HRULE.GETFN  HRULE.GETFN /, A 
 8V
'" ! "D
N
 ½ 4"N=  &DATE:iÄqc <0B>xzº