Registry / RepositoryTypeScriptRustPython
Rollpie
ReadmeFiles
Versions
Info
Download
0.2.3555.5 KB2026-10-160.2.2572.8 KB2026-10-150.2.1580.5 KB2026-10-150.2.0579.9 KB2026-09-150.1.1576.6 KB2026-09-12
Version
0.2.3
Copyright
Rollpie, Irohabook
Publisher
math
Published
2026-10-16
Size
555.5 KB
Downloads
26
Checksum
c6c938cc3641f85bee86c9360c2356581a4b1efb11333b9d97b3c5605c8bb71c
Dependencies
None

piece.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use suki::font;
use suki::outline::bounds;

fn main() {
    let loaded = font::load(std::fs::read("font/latinmodern-math.otf").unwrap()).unwrap();
    let units = font::units_per_em(&loaded);
    let brace = font::glyph_of(&loaded, '\u{23de}').unwrap();
    let growth = font::horizontal_growth(&loaded, brace).unwrap();

    println!("variants");

    for variant in &growth.variant {
        show(&loaded, variant.glyph, units, variant.measure);
    }

    println!("parts");

    for part in &growth.part {
        show(&loaded, part.glyph, units, part.full_advance);
    }
}

fn show(loaded: &suki::Font, glyph: u16, units: f64, measure: f64) {
    let drawn = font::outline_of(loaded, glyph);
    let (left, bottom, right, top) = bounds(&drawn);
    println!(
        "  glyph {glyph} length {measure:.3} advance {:.3} ink horizontal {:.3}..{:.3} \
vertical {:.3}..{:.3} line thickness {:.3}",
        font::advance(loaded, glyph),
        left / units,
        right / units,
        bottom / units,
        top / units,
        (top - bottom) / units
    );
}