[rust] Use new harfrust GlyphFlags getter (#6011)

* [rust] Reinstate commented-out git branch for harfrust

For development purposes.

* [rust] Use new HarfRust GlyphFlags getter

Faster.

* [rust] Pin to new harfrust 0.8.2
This commit is contained in:
Behdad Esfahbod authored and GitHub committed 2026-06-01 02:23:26 -06:00
1 parent fd707f8151
commit bc4cd305ca
2 files changed
+3 -16

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ rust-version = "1.87.0"
[dependencies]
skrifa = { version = "0.*", optional = true }
read-fonts = "0.39.*"
harfrust = { version = "0.8.*", optional = true }
harfrust = { version = "0.8.2", optional = true }
# harfrust = { git = "https://github.com/harfbuzz/harfrust", optional = true }
[lib]
+2 -15
View File
@@ -392,21 +392,8 @@ pub unsafe extern "C" fn _hb_harfrust_shape_rs(
let pos = &mut *positions.add(i);
info.codepoint = hr_info.glyph_id;
info.cluster = hr_info.cluster;
info.mask = 0;
// Needed as rust-bindgen/clang produce an i32 for the hb_glyph_flags_t_* enum
// on some platforms, e.g. Windows.
#[allow(clippy::unnecessary_cast)]
{
if hr_info.unsafe_to_break() {
info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_UNSAFE_TO_BREAK as u32;
}
if hr_info.unsafe_to_concat() {
info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_UNSAFE_TO_CONCAT as u32;
}
if hr_info.safe_to_insert_tatweel() {
info.mask |= hb_glyph_flags_t_HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL as u32;
}
}
info.mask = hr_info.flags().to_bits(); // Bitwise compatible with HarfBuzz's glyph flags;
// maybe add a setter later.
pos.x_advance = hr_pos.x_advance;
pos.y_advance = hr_pos.y_advance;
pos.x_offset = hr_pos.x_offset;