From bc4cd305caf005058a5933e0be4bdce378bf80a3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Jun 2026 02:23:26 -0600 Subject: [PATCH] [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 --- src/rust/Cargo.toml | 2 +- src/rust/shape.rs | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index c17555448..b01051557 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -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] diff --git a/src/rust/shape.rs b/src/rust/shape.rs index fa277c739..d9a1f1559 100644 --- a/src/rust/shape.rs +++ b/src/rust/shape.rs @@ -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;