Registry / RepositoryTypeScriptRustPython
Rollpie
ReadmeFiles
Versions
Info
Download
0.2.0579.9 KB2026-09-150.1.1576.6 KB2026-09-12
Version
0.1.1
Copyright
Rollpie, Irohabook
Publisher
math
Published
2026-09-12
Size
576.6 KB
Downloads
4
Checksum
8e0181e42f4abdc9f91c1ff48b058761bf1940be8d2d4747e5e74bd3014f4322
Dependencies
None

probe.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
37
38
39
40
41
42
use suki::font::{self};
use suki::{Mode, Shape};

fn main() {
    for path in std::env::args().skip(1) {
        println!("=== {path}");

        let data = match std::fs::read(&path) {
            Ok(data) => data,
            Err(reason) => {
                println!("  読めません: {reason}");
                continue;
            }
        };
        let font = match font::load(data) {
            Ok(font) => font,
            Err(reason) => {
                println!("  読み込めません: {reason}");
                continue;
            }
        };
        println!("  書体 {} / MATH {}", font::family(&font), font::has_math(&font));

        for character in ['x', '\u{1d465}', '2', '(', '\u{221a}'] {
            match font::glyph_of(&font, character) {
                Some(glyph) => {
                    let drawn = font::outline_of(&font, glyph);
                    println!(
                        "  {character:?} -> 字形 {glyph} 線 {} 幅 {:.3}",
                        drawn.segment.len(),
                        font::advance(&font, glyph)
                    );
                }
                None => println!("  {character:?} -> 字形なし"),
            }
        }

        let svg = suki::render_svg("x+2", &font, Mode::Display, Shape::Outline).unwrap();
        println!("  path {} 個 / use {} 個 / text {} 個",
            svg.matches("<path").count(), svg.matches("<use").count(), svg.matches("<text").count());
    }
}