Skip to main content

Crate ravenrs_text

Crate ravenrs_text 

Source
Expand description

Text shaping and layout for RavenRS.

TextSystem owns Parley’s font database and scratch space. It ships with Inter (SIL Open Font License 1.1, see fonts/Inter-LICENSE.txt) embedded, because browsers expose no system fonts to WebAssembly; the same bytes are used on the desktop so text looks identical everywhere. System fonts are not loaded.

Layout happens in logical pixels. The renderer rasterizes glyphs at the device scale factor, so text stays sharp on HiDPI screens without re-shaping.

Structs§

ShapedGlyph
One glyph of a TextLayout, as reported by TextLayout::glyphs.
TextAttrs
Visual attributes of a piece of text.
TextLayout
Shaped text, ready to be broken into lines at any width and drawn.
TextLine
One line of a broken TextLayout, as reported by TextLayout::lines.
TextStats
Work a TextSystem has done since it was created.
TextSystem
Font database plus reusable layout scratch space. Create one per app.

Constants§

DEFAULT_FAMILY
The family name of the embedded default font.
ICON_FAMILY
The family name of the embedded icon font.
MONO_FAMILY
The family name of the embedded monospaced font, with the mono feature. It is also what the generic monospace family resolves to.

Functions§

builtin_font
A built-in font by its builtin_font_number, for drawing shaped glyphs back.
builtin_font_number
Which built-in font these bytes are, as a number that does not change between runs: what a recording stores instead of the font itself.
fold
Folds a character to what searches compare: lowercase, without accents, so “regiao” finds “Região”. Folding can change how many characters there are.
inter_font
The embedded Inter font file, regular or semibold, for documents that embed the font they were measured with.