shape_probe/
shape_probe.rs1use fmd_font::{
3 Font,
4 shaping::{Direction, ShapeOptions},
5};
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let args: Vec<_> = std::env::args().collect();
8 let f = Font::parse(std::fs::read(&args[1])?)?;
9 let arabic = args[2] == "arab";
10 let options = ShapeOptions {
11 script: if arabic { *b"arab" } else { *b"latn" },
12 direction: if arabic {
13 Direction::RightToLeft
14 } else {
15 Direction::LeftToRight
16 },
17 ..ShapeOptions::default()
18 };
19 let run = f.shape(&args[3], &options)?;
20 for g in run.glyphs {
21 println!(
22 "{} {} {} {} {} {} {}",
23 g.glyph_id,
24 g.cluster.start,
25 g.cluster.end,
26 g.x_advance,
27 g.y_advance,
28 g.x_offset,
29 g.y_offset
30 );
31 }
32 Ok(())
33}