tinyimg 1.0.0
Lightweight image manipulation library for Cloudflare Workers
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 glyf_size
uint32_t glyphs
uint32_t hmetrics
uint32_t units_per_em
uint8_t long_loca
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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.


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