Skip to content

struct

GlyphSet

pub struct GlyphSet {
    pub units_per_em: f32,
    pub line_gap: f32,
    pub depth: f32,
    pub bevel: f32,
    pub glyphs: Vec<(char, f32, Mesh)>,
    pub kerning: Vec<(u32, u32, f32)>,
}

Glyphs made ahead of time (weft assets font): metrics, kerning and a mesh per character, at one depth and bevel.

Fields

units_per_em

pub units_per_em: f32

Font units per em.

line_gap

pub line_gap: f32

Extra space between lines, in font units.

depth

pub depth: f32

The extrusion depth the meshes were made with.

bevel

pub bevel: f32

The bevel width the meshes were made with.

glyphs

pub glyphs: Vec<(char, f32, Mesh)>

(character, advance in font units, mesh in ems).

kerning

pub kerning: Vec<(u32, u32, f32)>

(left, right, adjustment in font units), by index into glyphs.

Methods

to_bytes

pub fn to_bytes(&self) -> Vec<u8>

As .wfont bytes: the glyphs as a .wmodel (one node per character) after a small header.

from_bytes

pub fn from_bytes(b: &[u8]) -> Result<GlyphSet, String>

Read a glyph set from a .wfont file's bytes.

Trait implementations