6.2.4 Functions

Function: %run-ligature/kerning-program CHARACTER INDEX LIG/KERNS KERNS &aux FONT

Run a ligature/kerning program for CHARACTER.
The program starts at LIG/KERNS[INDEX] and uses the KERNS array. Running the program eventually creates ligatures or kernings for CHARACTER and some other character.

If an invalid index into LIG/KERNS is encountered, signal an INVALID-TABLE-INDEX error. This error is immediately restartable with ABORT-LIG/KERN-PROGRAM.

If an invalid ligature opcode is encountered, signal an INVALID-LIGATURE-OPCODE error. This error is immediately restartable with DISCARD-LIGATURE.

If an invalid index into KERNS is encountered, signal an INVALID-TABLE-INDEX error. This error is immediately restartable with DISCARD-KERNING.

Finally, if an invalid character code is encountered, signal an INVALID-CHARACTER-CODE error. Depending on the context, this error is immediately restartable with DISCARD-LIGATURE or DISCARD-KERNING.

Package

net.didierverna.tfm

Source

file.lisp (file)

Function: %version TYPE MAJOR MINOR STATUS LEVEL NAME
Package

net.didierverna.tfm.setup

Source

version.lisp (file)

Function: apply-ligature LIGATURE STATE &aux NEW-STATE

Apply LIGATURE to STATE and return the new state.
STATE is a list of characters, the first two being subject to LIGATURE.

Package

net.didierverna.tfm

Source

font.lisp (file)

Function: bot INSTANCE
Function: (setf bot) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: char-info-p OBJECT
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: clindent SYMBOL INDENT

Send SYMBOL’s INDENTation information to Emacs.
Emacs will set the ’common-lisp-indent-function property.
If INDENT is a symbol, use its indentation definition. Otherwise, INDENT is considered as an indentation definition.

Package

net.didierverna.tfm.setup

Source

readtable.lisp (file)

Function: code-character CODE FONT &optional ERRORP

Return FONT’s CODE character.
If ERRORP (the default), check that the character exists, or signal an INVALID-CHARACTER-CODE error. Note that a fake boundary character may be retrieved by this function.

Package

net.didierverna.tfm

Source

font.lisp (file)

Writer

(setf code-character) (function)

Function: (setf code-character) CHARACTER FONT

Make FONT’s CHARACTER accessible by its code.

Package

net.didierverna.tfm

Source

font.lisp (file)

Reader

code-character (function)

Function: copy-char-info INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: copy-exten INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: copy-lig/kern INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: decode-char-info WORD

Decode char-info WORD into a new CHAR-INFO instance, and return it.

Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: decode-exten WORD

Decode exten WORD into a new EXTEN instance, and return it.

Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: decode-lig/kern WORD

Decode lig/kern WORD into a new LIG/KERN instance, and return it.

Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: depth-index INSTANCE
Function: (setf depth-index) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: exten-index INSTANCE
Function: (setf exten-index) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: exten-p OBJECT
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: font-extension-recipe EXTEN FONT &aux INITARGS

Make an extension recipe based on EXTEN with FONT’s characters.

Package

net.didierverna.tfm

Source

file.lisp (file)

Function: height-index INSTANCE
Function: (setf height-index) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: i-reader STREAM SUBCHAR ARG

Construct a call to ‘defindent’ by reading an argument list from STREAM. This dispatch macro character function is installed on #i in the NET.DIDIERVERNA.TFM named readtable.

Package

net.didierverna.tfm.setup

Source

readtable.lisp (file)

Function: italic-index INSTANCE
Function: (setf italic-index) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: lig/kern-index INSTANCE
Function: (setf lig/kern-index) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: lig/kern-p OBJECT
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: load-tfm-font LF &key FILE NAME DESIGN-SIZE FREEZE &aux FONT

Parse *STREAM* of declared length LF into a new font, and return it.
- FILE defaults to *STREAM*’s associated file if any.
- NAME defaults to the FILE’s base name, if any.
- If DESIGN-SIZE is provided and not a real greater or equal to 1, signal a type error. Otherwise, override the original design size with it.
- When FREEZE (NIL by default), freeze the font immediately after creation.

If *STREAM* is shorter than expected, signal a FILE-UNDERFLOW error.
If *STREAM* is longer than expected, signal a FILE-OVERFLOW warning.

If the declared header length is less than 2, signal an INVALID-HEADER-LENGTH error.

If BC and EC don’t make sense, signal an INVALID-CHARACTER-RANGE error.

If the widths, heights, depths, italic corrections, or extens tables lengths are not within the expected range, signal an INVALID-TABLE-LENGTH error.

Finally, if the declared sections lengths don’t add up to the declared file length, signal an INVALID-SECTION-LENGTHS error.

Package

net.didierverna.tfm

Source

file.lisp (file)

Function: make-char-info &key (WIDTH-INDEX WIDTH-INDEX) (HEIGHT-INDEX HEIGHT-INDEX) (DEPTH-INDEX DEPTH-INDEX) (ITALIC-INDEX ITALIC-INDEX) (LIG/KERN-INDEX LIG/KERN-INDEX) (NEXT-CHAR NEXT-CHAR) (EXTEN-INDEX EXTEN-INDEX)
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: make-character-metrics CODE FONT WIDTH HEIGHT DEPTH ITALIC-CORRECTION

Make a new CHARACTER-METRICS instance, and return it.
Initialize the character’s CODE, FONT, WIDTH, HEIGHT, DEPTH, and ITALIC-CORRECTION appropriately. The two remaining slots (NEXT-CHARACTER and EXTENSION-RECIPE) will be initialized later if needed, when all character metrics instances are created.

Package

net.didierverna.tfm

Source

character.lisp (file)

Function: make-exten &key (TOP TOP) (MID MID) (BOT BOT) (REP REP)
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: make-extension-recipe REPEATED-CHARACTER &rest INITARGS &key TOP-CHARACTER MIDDLE-CHARACTER BOTTOM-CHARACTER

Make a new EXTENSION-RECIPE with REPEATED-CHARACTER and return it. The recipe may also have a TOP-, MIDDLE-, and BOTTOM-CHARACTER.

Package

net.didierverna.tfm

Source

character.lisp (file)

Function: make-font NAME &rest INITARGS

Make a new NAMEd FONT instance, and return it.
If INITARGS are provided, pass them as-is to MAKE-INSTANCE.

Package

net.didierverna.tfm

Source

font.lisp (file)

Function: make-lig/kern &key (SKIP SKIP) (NEXT NEXT) (OP OP) (REMAINDER REMAINDER)
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: make-ligature COMPOSITE DELETE-BEFORE DELETE-AFTER PASS-OVER

Make a new LIGATURE instance, and return it.

Package

net.didierverna.tfm

Source

font.lisp (file)

Function: mid INSTANCE
Function: (setf mid) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: next INSTANCE
Function: (setf next) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: next-char INSTANCE
Function: (setf next-char) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: op INSTANCE
Function: (setf op) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: parse-character-information NC NW NH ND NI NL NK NE FONT

Parse the 8 character information tables from *STREAM* into FONT.
NC (EC - BC + 1), NW, NH, ND, NI, NL, NK, and NE are the declared lengths of the 8 tables, that is, the char infos, widths, heights, depths, italic corrections, lig/kern instructions, kerns, and extens respectively.

If a char info structure with a width index of 0 is not completely zero’ed out, signal an INVALID-CHAR-INFO error. This error is immediately restartable with SET-TO-ZERO.

If the first entry in the widths, heights, depths, or italic corrections table is not 0, signal an INVALID-TABLE-START error. This error is immediately restartable with SET-TO-ZERO.

If an index into the widths, heights, depths, or italic corrections tables is invalid, signal an INVALID-TABLE-INDEX error. This error is immediately restartable with SET-TO-ZERO.

If a lig/kern program is found for a boundary character, but there is no such character in the font, signal a NO-BOUNDARY-CHARACTER error. This error is immediately restartable with ABORT-LIG/KERN-PROGRAM.

If an index into the extens table is invalid, signal an INVALID-TABLE-INDEX error. This error is immediately restartable with DISCARD-EXTENSION-RECIPE.

If a cycle is found in a list of characters of ascending size, signal a CHARACTER-LIST-CYCLE error. This error is immediately restartable with DISCARD-NEXT-CHARACTER.

If a ligature is found to be cyclic, signal a LIGATURE-CYCLE error. This error is immediately restartable with DISCARD-LIGATURE.

Finally, if an invalid character code is encountered, signal an INVALID-CHARACTER-CODE error. Depending on the context, this error is immediately restartable with DISCARD-NEXT-CHARACTER, or DISCARD-EXTENSION-RECIPE.

Package

net.didierverna.tfm

Source

file.lisp (file)

Function: parse-header LENGTH FONT

Parse a header of LENGTH words from *STREAM* into FONT.
If FONT’s design size is less than 1pt, signal an INVALID-DESIGN-SIZE error. This error is immediately restartable with SET-TO-TEN.
However, if FONT’s design size was explicitly overridden, only signal an INVALID-ORIGINAL-DESIGN-SIZE warning.

Package

net.didierverna.tfm

Source

file.lisp (file)

Function: read-fix-word &optional LIMIT

Read a fix word from *STREAM* and return it.
If LIMIT (the default), check that the number lies within ]-16,+16[, or signal a FIX-WORD-OVERFLOW error. This error is immediately restartable with SET-TO-ZERO.

Package

net.didierverna.tfm

Source

util.lisp (file)

Function: read-padded-string PADDING &aux LENGTH STRING

Read a BCPL string out of PADDING bytes from *STREAM*.
The first byte in *STREAM* indicates the actual length of the string. The remaining bytes are ignored.

If the declared string length is too large, signal an INVALID-STRING-LENGTH error. This error is immediately restartable with READ-MAXIMUM-LENGTH or DISCARD-STRING.

If the string is not in BCPL format (it contains parentheses or non plain ASCII characters, signal an INVALID-BCPL-STRING error. This error is immediately restartable with KEEP-STRING, FIX-STRING (replacing parentheses with slashes, and non plain ASCII characters with question marks), or DISCARD-STRING.

Package

net.didierverna.tfm

Source

util.lisp (file)

Function: read-u16 ()

Read an unsigned 16 bits Big Endian integer from *STREAM* and return it. If >= 2^15, signal a U16-OVERFLOW error.

Package

net.didierverna.tfm

Source

util.lisp (file)

Function: read-u32 ()

Read an unsigned 32 bits Big Endian integer from *STREAM*.

Package

net.didierverna.tfm

Source

util.lisp (file)

Function: release-status-number RELEASE-STATUS
Package

net.didierverna.tfm.setup

Source

version.lisp (file)

Function: remainder INSTANCE
Function: (setf remainder) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: rep INSTANCE
Function: (setf rep) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: report STREAM FORMAT-STRING &rest FORMAT-ARGUMENTS

Like FORMAT, but if *STREAM* is bound, report that we’re reading from it.

Package

net.didierverna.tfm

Source

util.lisp (file)

Function: run-ligature/kerning-program CHARACTER INDEX LIG/KERNS KERNS &aux LIG/KERN

Find the real start of a ligature/kerning program and run it.
See %run-ligature/kerning-program for more information.

If INDEX is invalid, signal an INVALID-TABLE-INDEX error. This error is immediately restartable with ABORT-LIG/KERN-PROGRAM.

Package

net.didierverna.tfm

Source

file.lisp (file)

Function: skip INSTANCE
Function: (setf skip) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: table-aref NAME TABLE INDEX

Access NAMEd TABLE at INDEX.
If INDEX is out of bounds, signal an INVALID-TABLE-INDEX error.

Package

net.didierverna.tfm

Source

file.lisp (file)

Function: top INSTANCE
Function: (setf top) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: width-index INSTANCE
Function: (setf width-index) VALUE INSTANCE
Package

net.didierverna.tfm

Source

intermediate.lisp (file)

Function: ~-reader STREAM CHAR

Read a series of ~"string" to be concatenated together.

Package

net.didierverna.tfm.setup

Source

readtable.lisp (file)