Skip to main content

cluster_widths

Function cluster_widths 

Source
pub fn cluster_widths(
    glyphs: &[ShapedGlyph],
    num_chars: usize,
    units_per_em: u16,
    font_size: f64,
    letter_spacing: f64,
) -> Vec<f64>
Expand description

Compute per-cluster widths from shaped glyphs.

Returns a Vec where index i is the width contributed by the glyph(s) whose cluster value is i. This accounts for ligatures (one glyph for multiple chars) and decomposition (multiple glyphs for one char).

num_chars is the total number of characters in the input text.