1
0
mirror of synced 2026-05-11 09:40:29 +00:00
Files
Interlisp.medley/library/IMPORTFONTS.TEDIT
2026-05-04 15:43:29 -07:00

60 lines
9.9 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.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Medley IMPORTFONTS
2
4
1
IMPORTFONTS
1
4
By Ron Kaplan
This document was last edited in May 2026.
This package contains functions aimed at systematizing the process of converting font data (bitmaps and metrics) from external and/or legacy sources into Medley font-format files and then working through a sequence of phases to translate external character encodings into MCCS, approximate information for missing characters, and to make the resulting files available to FONTCREATE by deploying them to the appropriate [device]FONTDIRECTORIES. The named phases are:
IMPORT: Read external data into fontdescriptors, one for each family/size/face/rotation, and write them to Medley font files.
MCCS: Read imported files into fontdescriptors, move information about individual characters to their most apprpriate MCCS positions, and write the MCCS-recoded information to new Medley font files.
COMPLETE: Read MCCS files into font descriptors, fill in information about missing characters by copying from other fonts according to the heuristic [device]CHARCOERCION for a given font, and write the completed fonts to other new Medley font files.
FAKE: Presumably only for DISPLAY fonts, read complete files into font descriptors, apply bitmap transformations to simulate otherwise missing Italic, Bold, and Italic-Bold faces from the glyphs of other available faces, and write the faked-face fonts to other new Medley font files.
DEPLOY: Copy the best resulting files to a device-dependent deployment directory, (CAR (FONTDEVICEPROP (FONTPROP font 'DEVICE) 'FONTDIRECTORIES)). For DISPLAY fonts the faked-face files are most likely the best, the completed or MCCS files may be best for other devices.
The files for each phase for each device are stored in a defined subdirectory, currently under {MEDLEY}/internal/fonts/. The subdirectories for the display device are thusÿÿ
ÿ display/imported/ÿÿ
ÿ display/mccs/ÿÿ
ÿ display/completedÿÿ
ÿ display/faked/ÿÿ
ÿThe entry /internal/fonts/** is added to .gitignore so these working subdirectories will not be noticed by git and GITFNS and remain by default on the local machine.
Core functinality
The main function for this package is IMPORTFONTS:
(IMPORTFONTS PHASE FONTSPECS DEVICE FROMDIR TODIR IMPORTFN) [Function]
PHASE is one of the phase-atoms listed above. IMPORTFN is required if PHASE is IMPORT, but otherwise DEVICE defaults to DISPLAY and all of the other arguments have defaults appropriate to the phase. Thus for the MCCS phase of display fonts, FROMDIR defaults to the subdirectory display/imported/ of internal/fonts/ and TODIR defaults to display/mccs/. FROMDIR for the DEPLOY phase defaults to faked/ if it exists, otherwise completed/ or /mccs/.
FONTSPECS may specify one or more target fonts to be processed, with a NIL value defaulting to all of the Medley font files in FROMDIR. The COMPLETE and FAKE phases may process more fonts than are actually specified. This is to take account of the fact that the completion/faking of a specified font may gather information from other fonts, and it is important that those input fonts have been first completed or faked themselves. For the same reason, the DEPLOY phase will copy all of the files for fonts with character sets that are referenced indirectly by one of the specified fonts.
The usual (default) procedure after a collection of display fonts has been imported is to execute the sequenceÿÿ
ÿ (IMPORTFONTS 'MCCS)ÿÿ
ÿ (IMPORTFONTS 'COMPLETE)ÿÿ
ÿ (IMPORTFONTS 'FAKE)ÿÿ
ÿ (IMPORTFONTS 'DEPLOY)ÿÿ
ÿFor the 300 or so legacy display fonts the completion phase is the slowest, taking about 10 minutes on an M2 Mac. The other phases are quite rapid.
IMPORTFONTS automatically creates a dribble file that lists the time and file-size changes for each font and for the collection of all fonts, and it brings up the dribble file in a Tedit window at the end of the phase.
The IMPORT phase is special because the external or legacy data is typically not available in Medley-font format. The functional argument IMPORTFN must be provided to decipher the external format of the source data and to read it into a fontdescriptor. This is a function of two arguments, FONTSPEC and FROMDIR, and it is charged with finding, internalizing, and returning a fontdescriptor with the information for the font designated by FONTSPEC. The parameters for the display are encapsulated in the function IMPORT.DISPLAY:
(IMPORT.DISPLAY FONTSPECS) [Function]
This is defined asÿÿ
ÿ (IMPORTFONTS 'IMPORT FONTSPECS 'DISPLAYÿÿ
ÿ '{MEDLEY}/fonts/displayfonts/ NIL (FUNCTION LEGACYDISPLAYFONT) ÿÿ
ÿwhere the function LEGACYDISPLAYFONT applies the readers for AC and Strike charset files. (At some point the legacy font files should be relocated to a directory or repository that is not included with the released system.)
Examination tools
IMPORTFONTS includes some simple functions for DISPLAY fonts that calls EDITFONT to visualize the character sets for the various phases of display-font construction. IMPORTFONTS currently does not provide viewers for other font devices, but presumably similar tools could be created by using lispusers/FONTSAMPLER instead of EDITFONT.
(PEF PHASES FONTSPEC CHARSET) [Function]
Brings up an EDITFONT window showing the layout of the glyphs in character set CHARSET for font FONTSPEC, for all of the phases in PHASES. CHARSET can be a single character set, a list of character sets, NIL (= 0), or T (= all the character sets of in the Medley font for each of the PHASES).
(AEF FONTSPEC CHARSET CLOSE) [Function]
Calls (PEF '(IMPORT MCCS COMPLET FAKE DEPLOY) CHARSET). Closes previous EDITFONT windows if CLOSE.
For convenience, the functions IEF, MEF, CEF, FEF, and DEF call PEF with PHASES set respectively to IMPORT, MCCS, COMPLETE, FAKE, and DEPLOY.
(EFCLOSE) [Function]
Closes all the currently open EDITFONT windows.
Additional functions:
(IPF PHASE FONTSPEC) [Function]
Returns the PHASE fontdescriptor for FONTSPEC.
(IPFSIZES FONTSPEC) [Function]
Returns a table showing the sizes of the Medleyfont files for the various phases of FONTSPEC.
(SEQUENCE NIL NIL (0 0 0 0) ((PAGE NIL (PAPERSIZE Letter STARTINGPAGE# NIL LANDSCAPE? NIL FOLIOINFO (ARABIC "" "")) (0 0 612 792) ((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È $È4È$È46È$È46È$È1È$1ŠŠ8$1ŠŠ8$JÈ$È PAGEHEADING RUNNINGHEAD/MODERN
(CHARPROPS (COLOR . BLACK))0CLASSIC
(CHARPROPS (COLOR . BLACK))/MODERN
(CHARPROPS (COLOR . BLACK))/MODERN(CHARPROPS (COLOR . BLACK))/MODERN(CHARPROPS (COLOR . BLACK))/MODERN
(CHARPROPS (COLOR . BLACK))/MODERN (CHARPROPS (COLOR . BLACK))3
TIMESROMAN$(CHARPROPS (COLOR . BLACK))


 HRULE.GETFN HRULE.GETFN HRULE.GETFN   HRULE.GETFN HRULE.GETFN+ÓÈú T?¬¨34 )mGW wËnÛS 
  qãO
P Š
.&JD0
 
 
T(((CLEARGET) (TEDIT.LAST.FIND.STRING . "source") (CHARENCODING . MCCS)))PROPS:RDATE:kÂh fºzº