The LispBM TTF font extensions are based on the libschrift library
The LispBM TrueType font support works in two phases. The first phase is called prepare and it prerenders selected glyphs into a custom binary format that we feel are more suitable for small embedded systems. This prerendering can be done offline and then only the binary blob be uploaded to the embedded system or it can be used on-demand if there is resources and a need for that.
The binary format starts with a preamble
Following the preamble a number of different tables will be stored. Each table starts with a string (zero terminated) indicating what kind of table it is. Following the table string is 4 byte size field. This is common to all tables:
The different kinds of tables that can occur after the preamble are:
Line metrics
Kerning table
kern_table_row:
kern_pair:
Glyph table
glyph:
ttf-prepare initializes font and prerenders glyphs. The
result of ttf-prepare is a binary blob conaining all the
information needed to print text using the prepared glyphs The form of a
ttf-prepare expression is:
(ttf-prepare font-data scale img-format utf8-str).
Note that only characters mentioned in the utf-string
will be usable.
| Example | Result |
|
|
Note try to not put duplicate characters in the utf8-str. Duplicate characters use extra memory temporarily which could be a problem if you are already low on mem.
ttf-text draws text on an image from the display library. The form of an
ttf-text expression is
(ttf-text img pos-x pos-y colors font-blob utf8-str opt-dir opt-linespacing).
ttf-prepare.up and down.| Example | Result |
|
|
| Example | Image | Result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Obtain line-height from a prepared font object.
| Example | Result |
|
|
Obtain the ascender metrics from a prepared font object.
| Example | Result |
|
|
Obtain the descender metrics from a prepared font object.
| Example | Result |
|
|
Obtain the line-gap metrics from a prepared font object.
| Example | Result |
|
|
Obtain the dimensions of a glyph from a prepared font object.
| Example | Result |
|
|
Obtain the dimensions of a string of text rendered using a prepared font object.
| Example | Result |
|
|
| Example | Result |
|
|
| Example | Image | Result |
|
|
|
This document was generated by LispBM version 0.34.2