![]() |
tinyimg 1.1.1
Lightweight image manipulation library for WebAssembly
|
A loaded face. More...
#include <text.h>
Public Attributes | |
| const uint8_t * | data |
| size_t | size |
| TinyFontKind | kind |
| uint32_t | cmap |
| uint32_t | glyf |
| uint32_t | loca |
| uint32_t | hmtx |
| uint32_t | kern |
| uint32_t | gpos_kern |
| Offset of the GPOS kern feature's pair lookup, or zero. | |
| uint32_t | gpos_subtables |
| uint32_t | gsub_liga |
| Offset of the GSUB liga feature's ligature lookup, or zero. | |
| uint32_t | gsub_subtables |
| uint32_t | glyf_size |
| uint32_t | glyphs |
| uint32_t | hmetrics |
| uint32_t | units_per_em |
| uint8_t | long_loca |
| uint32_t | fvar |
| uint32_t | gvar |
| uint32_t | avar |
| uint32_t | axes |
| float | coords [TINYIMG_FONT_MAX_AXES] |
| Where the face is set, one normalized coordinate per axis. | |
| uint8_t | varied |
| int32_t | ascent |
| int32_t | descent |
| int32_t | line_gap |
| uint32_t | cell_width |
| uint32_t | cell_height |
| uint32_t | glyph_bytes |
| uint32_t | bitmap |
| uint32_t * | index |
| Codepoint and offset pairs for a BDF face, owned. | |
| uint32_t | index_count |
A loaded face.
Keep one on the stack. It borrows the bytes it was loaded from rather than copying them, so a font stays valid only as long as those bytes do: a blob lives until tiny_blob_free, and bytes handed to tiny_font_load_bytes live as long as the caller keeps them.
The fields are read by the drawing code and by nothing else; a host reads a face through tiny_font_metrics rather than out of this structure, so the layout is not part of the ABI.
| int32_t TinyFont::ascent |
Baseline to the top of the ascenders, in font units.
| uint32_t TinyFont::avar |
Offset of avar, or zero when the axes need no remapping.
| uint32_t TinyFont::axes |
Axes the face declares, capped at TINYIMG_FONT_MAX_AXES.
| uint32_t TinyFont::bitmap |
Offset of the first glyph bitmap.
| uint32_t TinyFont::cell_height |
Cell height of a bitmap face, in pixels.
| uint32_t TinyFont::cell_width |
Cell width of a bitmap face, in pixels.
| uint32_t TinyFont::cmap |
Offset of cmap, or zero when the face has none.
| float TinyFont::coords[TINYIMG_FONT_MAX_AXES] |
Where the face is set, one normalized coordinate per axis.
-1 to 1, which is the space gvar regions are expressed in, rather than the axis' own units. Set through tiny_font_set_axis.
| const uint8_t* TinyFont::data |
The face's bytes, borrowed.
| int32_t TinyFont::descent |
Baseline down to the bottom of the descenders, positive, in font units.
| uint32_t TinyFont::fvar |
Offset of fvar, or zero when the face declares no axes.
| uint32_t TinyFont::glyf |
Offset of glyf.
| uint32_t TinyFont::glyph_bytes |
Bytes one bitmap glyph occupies.
| uint32_t TinyFont::glyphs |
Glyphs the face holds, from maxp.
| uint32_t TinyFont::gpos_kern |
Offset of the GPOS kern feature's pair lookup, or zero.
Resolved at load rather than searched per pair: the walk from GPOS to a lookup goes through the script list, the language system and the feature list, and none of that changes between glyphs. What is left is the part that does depend on the pair.
Modern faces ship this and no kern table at all, so a face that looked unkerned through the legacy table alone usually is not.
| uint32_t TinyFont::gpos_subtables |
How many subtables that lookup holds.
| uint32_t TinyFont::gsub_liga |
Offset of the GSUB liga feature's ligature lookup, or zero.
Resolved at load for the same reason the GPOS one is: the walk to it does not depend on the glyphs.
| uint32_t TinyFont::gsub_subtables |
How many subtables that lookup holds.
| uint32_t TinyFont::gvar |
Offset of gvar, or zero when the face carries no outline deltas.
| uint32_t TinyFont::hmetrics |
Entries in hmtx before the trailing left side bearings.
| uint32_t TinyFont::hmtx |
Offset of hmtx.
| uint32_t* TinyFont::index |
Codepoint and offset pairs for a BDF face, owned.
BDF is a text format with no index of its own, so one is built at load and released by tiny_font_free. The other two formats leave this NULL, which is why calling tiny_font_free is harmless rather than required for them.
| uint32_t TinyFont::index_count |
How many pairs.
| uint32_t TinyFont::kern |
Offset of kern, or zero when the face has none.
| TinyFontKind TinyFont::kind |
Which format the magic bytes identified.
| int32_t TinyFont::line_gap |
Space between the descenders of one line and the ascenders of the next.
| uint32_t TinyFont::loca |
Offset of loca.
| uint8_t TinyFont::long_loca |
Non-zero when loca entries are 32 bit.
| size_t TinyFont::size |
How many.
| uint32_t TinyFont::units_per_em |
Font units per em, the divisor that turns a font unit into a pixel.
| uint8_t TinyFont::varied |
Non-zero when any coordinate is away from the default.