use harfbuzz_rs::{shape, Face, Font, UnicodeBuffer};
fn main() {
let index = 0;
let path = "testfiles/SourceSansVariable-Roman.ttf";
let face = Face::from_file(path, index).expect("Error reading font file.");
let font = Font::new(face);
let buffer = UnicodeBuffer::new().add_str("Hello World!");
let result = shape(&font, buffer, &[]);
let positions = result.get_glyph_positions();
let infos = result.get_glyph_infos();
for (position, info) in positions.iter().zip(infos) {
let gid = info.codepoint;
let cluster = info.cluster;
let x_advance = position.x_advance;
let x_offset = position.x_offset;
let y_offset = position.y_offset;
println!(
"gid{:0>2?}={:0>2?}@{:>4?},{:?}+{:?}",
gid, cluster, x_advance, x_offset, y_offset
);
}
}