Skip to content

trait

Glyphs

pub trait Glyphs { … }

What text layout needs from a font. Units are font units; meshes are in ems (one em = units_per_em), front face towards +z.

Required methods

units_per_em

fn units_per_em(&self) -> f32

How many font units make an em.

line_gap

fn line_gap(&self) -> f32

Distance between baselines, in font units.

glyph

fn glyph(&self, c: char) -> Option<u32>

The glyph for c, if the font has one.

advance

fn advance(&self, glyph: u32) -> f32

How far glyph moves the pen, in font units.

kern

fn kern(&self, left: u32, right: u32) -> f32

The kerning between left and right, in font units.

glyph_mesh

fn glyph_mesh(&self, glyph: u32, depth: f32, bevel: f32, curve: f32) -> Option<Mesh>

The glyph's mesh, in ems: flat (depth 0) or extruded, centred on z = 0.

Implementors