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

pick.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
use suki::font;
use suki::layout::Content;
use suki::node::Style;
use suki::{layout, parse};

fn main() {
    let loaded = font::load(std::fs::read("font/latinmodern-math.otf").unwrap()).unwrap();
    let mut body = String::from("a");

    for step in 0..6 {
        if step > 0 {
            body.push_str("+a");
        }

        let source = format!(r"\overbrace{{{body}}}");
        let node = parse(&source).unwrap();
        let placed = layout::layout(&node, &loaded, 1.0, Style::Auto, true);
        let Content::Group(row) = &placed.content else {continue};
        let Content::Group(parts) = &row[0].layout.content else {continue};
        let inside = &parts[0].layout;
        let mark = &parts[1].layout;
        let shape = match &mark.content {
            Content::Glyph {glyph, ..} => format!("glyph {glyph}"),
            Content::Group(pieces) => format!("parts {}", pieces.len()),
            Content::Rule => "rule".to_string(),
        };
        println!(
            "content width {:.3}  accent {shape}  width {:.3}  height {:.3}  depth {:.3}",
            inside.width, mark.width, mark.height, mark.depth
        );
    }
}