Skip to main content

glyph_width

Function glyph_width 

Source
pub fn glyph_width(font: Font, size: f32, ch: char) -> f32
Expand description

Width of a single glyph in font at size points. For Base14 faces this is one AFM lookup; for embedded faces it shapes the single character. Used by the paragraph engine for character-wise hyphenation of oversized words.

ยงExamples

use mos_fonts::{Base14Font, Font, glyph_width};

assert_eq!(glyph_width(Font::Base14(Base14Font::Helvetica), 10.0, 'A'), 6.67);