tinyimg 1.1.1
Lightweight image manipulation library for WebAssembly
Loading...
Searching...
No Matches
TinyFont Struct Reference

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

Detailed Description

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.

Member Data Documentation

◆ ascent

int32_t TinyFont::ascent

Baseline to the top of the ascenders, in font units.

◆ avar

uint32_t TinyFont::avar

Offset of avar, or zero when the axes need no remapping.

◆ axes

uint32_t TinyFont::axes

Axes the face declares, capped at TINYIMG_FONT_MAX_AXES.

◆ bitmap

uint32_t TinyFont::bitmap

Offset of the first glyph bitmap.

◆ cell_height

uint32_t TinyFont::cell_height

Cell height of a bitmap face, in pixels.

◆ cell_width

uint32_t TinyFont::cell_width

Cell width of a bitmap face, in pixels.

◆ cmap

uint32_t TinyFont::cmap

Offset of cmap, or zero when the face has none.

◆ coords

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.

◆ data

const uint8_t* TinyFont::data

The face's bytes, borrowed.

◆ descent

int32_t TinyFont::descent

Baseline down to the bottom of the descenders, positive, in font units.

◆ fvar

uint32_t TinyFont::fvar

Offset of fvar, or zero when the face declares no axes.

◆ glyf

uint32_t TinyFont::glyf

Offset of glyf.

◆ glyf_size

uint32_t TinyFont::glyf_size

Length of glyf, so a bad loca entry cannot read past it.

◆ glyph_bytes

uint32_t TinyFont::glyph_bytes

Bytes one bitmap glyph occupies.

◆ glyphs

uint32_t TinyFont::glyphs

Glyphs the face holds, from maxp.

◆ gpos_kern

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.

◆ gpos_subtables

uint32_t TinyFont::gpos_subtables

How many subtables that lookup holds.

◆ gsub_liga

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.

◆ gsub_subtables

uint32_t TinyFont::gsub_subtables

How many subtables that lookup holds.

◆ gvar

uint32_t TinyFont::gvar

Offset of gvar, or zero when the face carries no outline deltas.

◆ hmetrics

uint32_t TinyFont::hmetrics

Entries in hmtx before the trailing left side bearings.

◆ hmtx

uint32_t TinyFont::hmtx

Offset of hmtx.

◆ index

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.

◆ index_count

uint32_t TinyFont::index_count

How many pairs.

◆ kern

uint32_t TinyFont::kern

Offset of kern, or zero when the face has none.

◆ kind

TinyFontKind TinyFont::kind

Which format the magic bytes identified.

◆ line_gap

int32_t TinyFont::line_gap

Space between the descenders of one line and the ascenders of the next.

◆ loca

uint32_t TinyFont::loca

Offset of loca.

◆ long_loca

uint8_t TinyFont::long_loca

Non-zero when loca entries are 32 bit.

◆ size

size_t TinyFont::size

How many.

◆ units_per_em

uint32_t TinyFont::units_per_em

Font units per em, the divisor that turns a font unit into a pixel.

◆ varied

uint8_t TinyFont::varied

Non-zero when any coordinate is away from the default.


The documentation for this struct was generated from the following file: