Using the master branch as a dependency and running the example is broken on M2. #36
Open
Description
Hello.
My machine is a MacBook Air M2.
I am on the latest Rust release (1.75.0).
This is my dependencies
section in Cargo.toml
[dependencies]
harfbuzz_rs = { git = "https://github.com/harfbuzz/harfbuzz_rs.git" }
I am using the example code given in the crate. Regardless, this is my code:
use std::error::Error;
use harfbuzz_rs::*;
fn main() -> Result<(), Box<dyn Error>> {
let path =
"/Users/abdulrahmansibahi/Documents/rust/mimiron/mimiron/fonts/YanoneKaffeesatz-Medium.ttf";
let index = 0; //< face index in the font file
let face = Face::from_file(path, index)?;
let font = Font::new(face);
let buffer = UnicodeBuffer::new().add_str("Hello World!");
let output = shape(&font, buffer, &[]);
let positions = output.get_glyph_positions();
let infos = output.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: {:?}. cluster: {:?}. x_advance: {:?}, x_offset: {:?} y_offset: {:?}",
gid, cluster, x_advance, x_offset, y_offset
);
}
Ok(())
}
And this is the error I get :
I asked in the Rust Community Discord server and it apparently works on other, non-Apple, systems. I haven't tried myself as I .. don't have other systems.
This same code works on the Crates.io version.
Edit: This is the last good commit that works for me : 15d1c2a , pre removing the harfbuzz_sys
crate as a dependency.
Metadata
Assignees
Labels
No labels