From 353f65f55dedc3c00fc44712990ad37c416e6b6f Mon Sep 17 00:00:00 2001 From: Chad Brokaw Date: Sun, 28 Jul 2024 15:00:00 -0400 Subject: [PATCH] Use font_types::Tag Replace `ttf_parser::Tag` with `font_types::Tag` throughout the code. --- scripts/gen-tag-table.py | 6 +- src/hb/aat_layout.rs | 2 +- src/hb/aat_map.rs | 2 +- src/hb/common.rs | 41 +- src/hb/face.rs | 3 +- src/hb/fonta/ot/mod.rs | 11 +- src/hb/mod.rs | 2 +- src/hb/ot_layout.rs | 97 - src/hb/ot_map.rs | 9 +- src/hb/ot_shape.rs | 76 +- src/hb/ot_shaper.rs | 10 +- src/hb/ot_shaper_arabic.rs | 38 +- src/hb/ot_shaper_hangul.rs | 14 +- src/hb/ot_shaper_hebrew.rs | 2 +- src/hb/ot_shaper_indic.rs | 52 +- src/hb/ot_shaper_khmer.rs | 26 +- src/hb/ot_shaper_myanmar.rs | 20 +- src/hb/ot_shaper_use.rs | 46 +- src/hb/tag.rs | 70 +- src/hb/tag_table.rs | 3616 +++++++++++++++++------------------ src/hb/text_parser.rs | 2 +- 21 files changed, 2032 insertions(+), 2113 deletions(-) diff --git a/scripts/gen-tag-table.py b/scripts/gen-tag-table.py index c4040ee..af1e117 100755 --- a/scripts/gen-tag-table.py +++ b/scripts/gen-tag-table.py @@ -869,7 +869,7 @@ def rank_delta(bcp_47, ot): print('// WARNING: this file was generated by ../scripts/gen-tag-table.py') print() -print('use ttf_parser::Tag;') +print('use skrifa::raw::types::Tag;') print() print('pub struct LangTag {') print(' pub language: &\'static str,') @@ -882,8 +882,8 @@ def rank_delta(bcp_47, ot): def hb_tag(tag): if tag == DEFAULT_LANGUAGE_SYSTEM: - return 'Tag(0)\t ' - return 'Tag::from_bytes(b\"%s%s%s%s\")' % tuple(('%-4s' % tag)[:4]) + return 'Tag::new(&[0; 4])\t ' + return 'Tag::new(b\"%s%s%s%s\")' % tuple(('%-4s' % tag)[:4]) def hb_tag2(tag): diff --git a/src/hb/aat_layout.rs b/src/hb/aat_layout.rs index 8dacf01..f661289 100644 --- a/src/hb/aat_layout.rs +++ b/src/hb/aat_layout.rs @@ -393,7 +393,7 @@ impl hb_aat_feature_mapping_t { selector_to_disable: u8, ) -> Self { hb_aat_feature_mapping_t { - ot_feature_tag: hb_tag_t::from_bytes(ot_feature_tag), + ot_feature_tag: hb_tag_t::new(ot_feature_tag), aat_feature_type, selector_to_enable, selector_to_disable, diff --git a/src/hb/aat_map.rs b/src/hb/aat_map.rs index 494006b..a0ab5e8 100644 --- a/src/hb/aat_map.rs +++ b/src/hb/aat_map.rs @@ -98,7 +98,7 @@ impl hb_aat_map_builder_t { pub fn add_feature(&mut self, face: &hb_font_t, feature: &Feature) -> Option<()> { let feat = face.tables().feat?; - if feature.tag == hb_tag_t::from_bytes(b"aalt") { + if feature.tag == hb_tag_t::new(b"aalt") { let exposes_feature = feat .names .find(HB_AAT_LAYOUT_FEATURE_TYPE_CHARACTER_ALTERNATIVES as u16) diff --git a/src/hb/common.rs b/src/hb/common.rs index 43b8c5e..cc673e6 100644 --- a/src/hb/common.rs +++ b/src/hb/common.rs @@ -1,7 +1,7 @@ use alloc::string::String; use core::ops::{Bound, RangeBounds}; -use ttf_parser::Tag; +use skrifa::raw::types::Tag; use super::text_parser::TextParser; @@ -215,7 +215,7 @@ pub struct Script(pub(crate) Tag); impl Script { #[inline] pub(crate) const fn from_bytes(bytes: &[u8; 4]) -> Self { - Script(Tag::from_bytes(bytes)) + Script(Tag::new(bytes)) } /// Converts an ISO 15924 script tag to a corresponding `Script`. @@ -225,9 +225,9 @@ impl Script { } // Be lenient, adjust case (one capital letter followed by three small letters). - let tag = Tag((tag.as_u32() & 0xDFDFDFDF) | 0x00202020); + let tag = Tag::from_u32((tag.as_u32() & 0xDFDFDFDF) | 0x00202020); - match &tag.to_bytes() { + match &tag.to_be_bytes() { // These graduated from the 'Q' private-area codes, but // the old code is still aliased by Unicode, and the Qaai // one in use by ICU. @@ -628,7 +628,7 @@ mod tests_features { fn $name() { assert_eq!( Feature::from_str($text).unwrap(), - Feature::new(Tag::from_bytes($tag), $value, $range) + Feature::new(Tag::new($tag), $value, $range) ); } }; @@ -703,6 +703,9 @@ impl core::str::FromStr for Variation { } pub trait TagExt { + fn from_bytes_lossy(bytes: &[u8]) -> Self; + fn as_u32(self) -> u32; + fn is_null(self) -> bool; fn default_script() -> Self; fn default_language() -> Self; #[cfg(test)] @@ -711,22 +714,38 @@ pub trait TagExt { } impl TagExt for Tag { + fn from_bytes_lossy(bytes: &[u8]) -> Self { + let mut array = [b' '; 4]; + for (src, dest) in bytes.iter().zip(&mut array) { + *dest = *src; + } + Tag::new(&array) + } + + fn as_u32(self) -> u32 { + u32::from_be_bytes(self.to_be_bytes()) + } + + fn is_null(self) -> bool { + self.to_be_bytes() == [0, 0, 0, 0] + } + #[inline] fn default_script() -> Self { - Tag::from_bytes(b"DFLT") + Tag::new(b"DFLT") } #[inline] fn default_language() -> Self { - Tag::from_bytes(b"dflt") + Tag::new(b"dflt") } /// Converts tag to lowercase. #[cfg(test)] #[inline] fn to_lowercase(&self) -> Self { - let b = self.to_bytes(); - Tag::from_bytes(&[ + let b = self.to_be_bytes(); + Tag::new(&[ b[0].to_ascii_lowercase(), b[1].to_ascii_lowercase(), b[2].to_ascii_lowercase(), @@ -737,8 +756,8 @@ impl TagExt for Tag { /// Converts tag to uppercase. #[inline] fn to_uppercase(&self) -> Self { - let b = self.to_bytes(); - Tag::from_bytes(&[ + let b = self.to_be_bytes(); + Tag::new(&[ b[0].to_ascii_uppercase(), b[1].to_ascii_uppercase(), b[2].to_ascii_uppercase(), diff --git a/src/hb/face.rs b/src/hb/face.rs index 80b3b5f..4be11d6 100644 --- a/src/hb/face.rs +++ b/src/hb/face.rs @@ -8,6 +8,7 @@ use ttf_parser::{GlyphId, RgbaColor}; use super::buffer::GlyphPropsFlags; use super::fonta; +use super::common::TagExt; use super::ot_layout::TableIndex; use crate::Variation; @@ -81,7 +82,7 @@ impl<'a> hb_font_t<'a> { /// Sets font variations. pub fn set_variations(&mut self, variations: &[Variation]) { for variation in variations { - self.ttfp_face.set_variation(variation.tag, variation.value); + self.ttfp_face.set_variation(ttf_parser::Tag(variation.tag.as_u32()), variation.value); } self.font.set_coords(self.ttfp_face.variation_coordinates()); } diff --git a/src/hb/fonta/ot/mod.rs b/src/hb/fonta/ot/mod.rs index 963a7c5..72b0eab 100644 --- a/src/hb/fonta/ot/mod.rs +++ b/src/hb/fonta/ot/mod.rs @@ -168,10 +168,6 @@ pub enum LayoutTable<'a> { Gpos(Gpos<'a>), } -fn conv_tag(tag: hb_tag_t) -> skrifa::raw::types::Tag { - skrifa::raw::types::Tag::from_u32(tag.0) -} - impl<'a> LayoutTable<'a> { fn script_list(&self) -> Option> { match self { @@ -199,7 +195,6 @@ impl<'a> LayoutTable<'a> { fn script_index(&self, tag: hb_tag_t) -> Option { let list = self.script_list()?; - let tag = conv_tag(tag); list.script_records() .binary_search_by_key(&tag, |rec| rec.script_tag()) .map(|index| index as u16) @@ -214,7 +209,6 @@ impl<'a> LayoutTable<'a> { fn langsys_index(&self, script_index: u16, tag: hb_tag_t) -> Option { let script = self.script(script_index)?; - let tag = conv_tag(tag); script .lang_sys_records() .binary_search_by_key(&tag, |rec| rec.lang_sys_tag()) @@ -241,7 +235,7 @@ impl<'a> LayoutTable<'a> { fn feature_tag(&self, index: u16) -> Option { let list = self.feature_list()?; let record = list.feature_records().get(index as usize)?; - Some(hb_tag_t(u32::from_be_bytes(record.feature_tag().to_raw()))) + Some(record.feature_tag()) } pub(crate) fn feature_variation_index(&self, coords: &[F2Dot14]) -> Option { @@ -310,7 +304,6 @@ impl<'a> LayoutTable<'a> { pub(crate) fn feature_index(&self, tag: hb_tag_t) -> Option { let list = self.feature_list()?; - let tag = conv_tag(tag); for (index, feature) in list.feature_records().iter().enumerate() { if feature.feature_tag() == tag { return Some(index as u16); @@ -351,7 +344,7 @@ impl crate::hb::ot_layout::LayoutTableExt for LayoutTable<'_> { hb_tag_t::default_language(), // try with 'latn'; some old fonts put their features there even though // they're really trying to support Thai, for example :( - hb_tag_t::from_bytes(b"latn"), + hb_tag_t::new(b"latn"), ] { if let Some(index) = self.script_index(tag) { return Some((false, index, tag)); diff --git a/src/hb/mod.rs b/src/hb/mod.rs index 4c199c7..f34481c 100644 --- a/src/hb/mod.rs +++ b/src/hb/mod.rs @@ -58,7 +58,7 @@ mod text_parser; mod unicode; mod unicode_norm; -use ttf_parser::Tag as hb_tag_t; +use skrifa::raw::types::Tag as hb_tag_t; use self::buffer::hb_glyph_info_t; use self::face::hb_font_t; diff --git a/src/hb/ot_layout.rs b/src/hb/ot_layout.rs index 649181c..f609dec 100644 --- a/src/hb/ot_layout.rs +++ b/src/hb/ot_layout.rs @@ -125,103 +125,6 @@ pub trait LayoutTableExt { ) -> Option; } -impl LayoutTableExt for ttf_parser::opentype_layout::LayoutTable<'_> { - // hb_ot_layout_table_select_script - /// Returns true + index and tag of the first found script tag in the given GSUB or GPOS table - /// or false + index and tag if falling back to a default script. - fn select_script(&self, script_tags: &[hb_tag_t]) -> Option<(bool, ScriptIndex, hb_tag_t)> { - for &tag in script_tags { - if let Some(index) = self.scripts.index(tag) { - return Some((true, index, tag)); - } - } - - for &tag in &[ - // try finding 'DFLT' - hb_tag_t::default_script(), - // try with 'dflt'; MS site has had typos and many fonts use it now :( - hb_tag_t::default_language(), - // try with 'latn'; some old fonts put their features there even though - // they're really trying to support Thai, for example :( - hb_tag_t::from_bytes(b"latn"), - ] { - if let Some(index) = self.scripts.index(tag) { - return Some((false, index, tag)); - } - } - - None - } - - // hb_ot_layout_script_select_language - /// Returns the index of the first found language tag in the given GSUB or GPOS table, - /// underneath the specified script index. - fn select_script_language( - &self, - script_index: ScriptIndex, - lang_tags: &[hb_tag_t], - ) -> Option { - let script = self.scripts.get(script_index)?; - - for &tag in lang_tags { - if let Some(index) = script.languages.index(tag) { - return Some(index); - } - } - - // try finding 'dflt' - if let Some(index) = script.languages.index(hb_tag_t::default_language()) { - return Some(index); - } - - None - } - - // hb_ot_layout_language_get_required_feature - /// Returns the index and tag of a required feature in the given GSUB or GPOS table, - /// underneath the specified script and language. - fn get_required_language_feature( - &self, - script_index: ScriptIndex, - lang_index: Option, - ) -> Option<(FeatureIndex, hb_tag_t)> { - let script = self.scripts.get(script_index)?; - let sys = match lang_index { - Some(index) => script.languages.get(index)?, - None => script.default_language?, - }; - let idx = sys.required_feature?; - let tag = self.features.get(idx)?.tag; - Some((idx, tag)) - } - - // hb_ot_layout_language_find_feature - /// Returns the index of a given feature tag in the given GSUB or GPOS table, - /// underneath the specified script and language. - fn find_language_feature( - &self, - script_index: ScriptIndex, - lang_index: Option, - feature_tag: hb_tag_t, - ) -> Option { - let script = self.scripts.get(script_index)?; - let sys = match lang_index { - Some(index) => script.languages.get(index)?, - None => script.default_language?, - }; - - for i in 0..sys.feature_indices.len() { - if let Some(index) = sys.feature_indices.get(i) { - if self.features.get(index).map(|v| v.tag) == Some(feature_tag) { - return Some(index); - } - } - } - - None - } -} - /// Called before substitution lookups are performed, to ensure that glyph /// class and other properties are set on the glyphs in the buffer. pub fn hb_ot_layout_substitute_start(face: &hb_font_t, buffer: &mut hb_buffer_t) { diff --git a/src/hb/ot_map.rs b/src/hb/ot_map.rs index 0e9d3a9..4024972 100644 --- a/src/hb/ot_map.rs +++ b/src/hb/ot_map.rs @@ -3,13 +3,16 @@ use core::cmp::Ordering; use core::ops::Range; use ttf_parser::FromData; -use ttf_parser::opentype_layout::{ - FeatureIndex, LanguageIndex, LookupIndex, ScriptIndex, VariationIndex, -}; +pub type FeatureIndex = u16; +pub type LanguageIndex = u16; +pub type LookupIndex = u16; +pub type ScriptIndex = u16; +pub type VariationIndex = u32; use super::buffer::{glyph_flag, hb_buffer_t}; use super::ot_layout::{LayoutTableExt, TableIndex}; use super::ot_shape_plan::hb_ot_shape_plan_t; +use super::common::TagExt; use super::{hb_font_t, hb_mask_t, hb_tag_t, tag, Language, Script}; pub struct hb_ot_map_t { diff --git a/src/hb/ot_shape.rs b/src/hb/ot_shape.rs index ae67dcf..85ec196 100644 --- a/src/hb/ot_shape.rs +++ b/src/hb/ot_shape.rs @@ -73,23 +73,23 @@ impl<'a> hb_ot_shape_planner_t<'a> { pub fn collect_features(&mut self, user_features: &[Feature]) { const COMMON_FEATURES: &[(hb_tag_t, hb_ot_map_feature_flags_t)] = &[ - (hb_tag_t::from_bytes(b"abvm"), F_GLOBAL), - (hb_tag_t::from_bytes(b"blwm"), F_GLOBAL), - (hb_tag_t::from_bytes(b"ccmp"), F_GLOBAL), - (hb_tag_t::from_bytes(b"locl"), F_GLOBAL), - (hb_tag_t::from_bytes(b"mark"), F_GLOBAL_MANUAL_JOINERS), - (hb_tag_t::from_bytes(b"mkmk"), F_GLOBAL_MANUAL_JOINERS), - (hb_tag_t::from_bytes(b"rlig"), F_GLOBAL), + (hb_tag_t::new(b"abvm"), F_GLOBAL), + (hb_tag_t::new(b"blwm"), F_GLOBAL), + (hb_tag_t::new(b"ccmp"), F_GLOBAL), + (hb_tag_t::new(b"locl"), F_GLOBAL), + (hb_tag_t::new(b"mark"), F_GLOBAL_MANUAL_JOINERS), + (hb_tag_t::new(b"mkmk"), F_GLOBAL_MANUAL_JOINERS), + (hb_tag_t::new(b"rlig"), F_GLOBAL), ]; const HORIZONTAL_FEATURES: &[(hb_tag_t, hb_ot_map_feature_flags_t)] = &[ - (hb_tag_t::from_bytes(b"calt"), F_GLOBAL), - (hb_tag_t::from_bytes(b"clig"), F_GLOBAL), - (hb_tag_t::from_bytes(b"curs"), F_GLOBAL), - (hb_tag_t::from_bytes(b"dist"), F_GLOBAL), - (hb_tag_t::from_bytes(b"kern"), F_GLOBAL_HAS_FALLBACK), - (hb_tag_t::from_bytes(b"liga"), F_GLOBAL), - (hb_tag_t::from_bytes(b"rclt"), F_GLOBAL), + (hb_tag_t::new(b"calt"), F_GLOBAL), + (hb_tag_t::new(b"clig"), F_GLOBAL), + (hb_tag_t::new(b"curs"), F_GLOBAL), + (hb_tag_t::new(b"dist"), F_GLOBAL), + (hb_tag_t::new(b"kern"), F_GLOBAL_HAS_FALLBACK), + (hb_tag_t::new(b"liga"), F_GLOBAL), + (hb_tag_t::new(b"rclt"), F_GLOBAL), ]; let empty = F_NONE; @@ -97,36 +97,36 @@ impl<'a> hb_ot_shape_planner_t<'a> { self.ot_map.is_simple = true; self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"rvrn"), empty, 1); + .enable_feature(hb_tag_t::new(b"rvrn"), empty, 1); self.ot_map.add_gsub_pause(None); match self.direction { Direction::LeftToRight => { self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"ltra"), empty, 1); + .enable_feature(hb_tag_t::new(b"ltra"), empty, 1); self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"ltrm"), empty, 1); + .enable_feature(hb_tag_t::new(b"ltrm"), empty, 1); } Direction::RightToLeft => { self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"rtla"), empty, 1); + .enable_feature(hb_tag_t::new(b"rtla"), empty, 1); self.ot_map - .add_feature(hb_tag_t::from_bytes(b"rtlm"), empty, 1); + .add_feature(hb_tag_t::new(b"rtlm"), empty, 1); } _ => {} } // Automatic fractions. self.ot_map - .add_feature(hb_tag_t::from_bytes(b"frac"), empty, 1); + .add_feature(hb_tag_t::new(b"frac"), empty, 1); self.ot_map - .add_feature(hb_tag_t::from_bytes(b"numr"), empty, 1); + .add_feature(hb_tag_t::new(b"numr"), empty, 1); self.ot_map - .add_feature(hb_tag_t::from_bytes(b"dnom"), empty, 1); + .add_feature(hb_tag_t::new(b"dnom"), empty, 1); // Random! self.ot_map.enable_feature( - hb_tag_t::from_bytes(b"rand"), + hb_tag_t::new(b"rand"), F_RANDOM, hb_ot_map_t::MAX_VALUE, ); @@ -135,12 +135,12 @@ impl<'a> hb_ot_shape_planner_t<'a> { // AAT 'trak' table using features. // https://github.com/harfbuzz/harfbuzz/issues/1303 self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"trak"), F_HAS_FALLBACK, 1); + .enable_feature(hb_tag_t::new(b"trak"), F_HAS_FALLBACK, 1); self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"Harf"), empty, 1); // Considered required. + .enable_feature(hb_tag_t::new(b"Harf"), empty, 1); // Considered required. self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"HARF"), empty, 1); // Considered discretionary. + .enable_feature(hb_tag_t::new(b"HARF"), empty, 1); // Considered discretionary. if let Some(func) = self.shaper.collect_features { self.ot_map.is_simple = false; @@ -148,9 +148,9 @@ impl<'a> hb_ot_shape_planner_t<'a> { } self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"Buzz"), empty, 1); // Considered required. + .enable_feature(hb_tag_t::new(b"Buzz"), empty, 1); // Considered required. self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"BUZZ"), empty, 1); // Considered discretionary. + .enable_feature(hb_tag_t::new(b"BUZZ"), empty, 1); // Considered discretionary. for &(tag, flags) in COMMON_FEATURES { self.ot_map.add_feature(tag, flags, 1); @@ -170,7 +170,7 @@ impl<'a> hb_ot_shape_planner_t<'a> { // See various bugs referenced from: // https://github.com/harfbuzz/harfbuzz/issues/63 self.ot_map - .enable_feature(hb_tag_t::from_bytes(b"vert"), F_GLOBAL_SEARCH, 1); + .enable_feature(hb_tag_t::new(b"vert"), F_GLOBAL_SEARCH, 1); } if user_features.len() != 0 { @@ -190,23 +190,23 @@ impl<'a> hb_ot_shape_planner_t<'a> { pub fn compile(mut self, user_features: &[Feature]) -> hb_ot_shape_plan_t { let ot_map = self.ot_map.compile(); - let frac_mask = ot_map.get_1_mask(hb_tag_t::from_bytes(b"frac")); - let numr_mask = ot_map.get_1_mask(hb_tag_t::from_bytes(b"numr")); - let dnom_mask = ot_map.get_1_mask(hb_tag_t::from_bytes(b"dnom")); + let frac_mask = ot_map.get_1_mask(hb_tag_t::new(b"frac")); + let numr_mask = ot_map.get_1_mask(hb_tag_t::new(b"numr")); + let dnom_mask = ot_map.get_1_mask(hb_tag_t::new(b"dnom")); let has_frac = frac_mask != 0 || (numr_mask != 0 && dnom_mask != 0); - let rtlm_mask = ot_map.get_1_mask(hb_tag_t::from_bytes(b"rtlm")); - let has_vert = ot_map.get_1_mask(hb_tag_t::from_bytes(b"vert")) != 0; + let rtlm_mask = ot_map.get_1_mask(hb_tag_t::new(b"rtlm")); + let has_vert = ot_map.get_1_mask(hb_tag_t::new(b"vert")) != 0; let horizontal = self.direction.is_horizontal(); let kern_tag = if horizontal { - hb_tag_t::from_bytes(b"kern") + hb_tag_t::new(b"kern") } else { - hb_tag_t::from_bytes(b"vkrn") + hb_tag_t::new(b"vkrn") }; let kern_mask = ot_map.get_mask(kern_tag).0; let requested_kerning = kern_mask != 0; - let trak_mask = ot_map.get_mask(hb_tag_t::from_bytes(b"trak")).0; + let trak_mask = ot_map.get_mask(hb_tag_t::new(b"trak")).0; let requested_tracking = trak_mask != 0; let has_gpos_kern = ot_map @@ -251,7 +251,7 @@ impl<'a> hb_ot_shape_planner_t<'a> { && !apply_kerx && (!apply_kern || !hb_ot_layout_has_machine_kerning(self.face)); - let has_gpos_mark = ot_map.get_1_mask(hb_tag_t::from_bytes(b"mark")) != 0; + let has_gpos_mark = ot_map.get_1_mask(hb_tag_t::new(b"mark")) != 0; let mut adjust_mark_positioning_when_zeroing = !apply_gpos && !apply_kerx diff --git a/src/hb/ot_shaper.rs b/src/hb/ot_shaper.rs index 4eda4a5..33b62a4 100644 --- a/src/hb/ot_shaper.rs +++ b/src/hb/ot_shaper.rs @@ -177,9 +177,9 @@ pub fn hb_ot_shape_complex_categorize( // // If it's indy3 tag, send to USE. if gsub_script == Some(hb_tag_t::default_script()) || - gsub_script == Some(hb_tag_t::from_bytes(b"latn")) { + gsub_script == Some(hb_tag_t::new(b"latn")) { &DEFAULT_SHAPER - } else if gsub_script.map_or(false, |tag| tag.to_bytes()[3] == b'3') { + } else if gsub_script.map_or(false, |tag| tag.to_be_bytes()[3] == b'3') { &crate::hb::ot_shaper_use::UNIVERSAL_SHAPER } else { &crate::hb::ot_shaper_indic::INDIC_SHAPER @@ -197,8 +197,8 @@ pub fn hb_ot_shape_complex_categorize( // shaper. That's tag used from before Myanmar shaping spec // was developed. The shaping spec uses 'mym2' tag. if gsub_script == Some(hb_tag_t::default_script()) || - gsub_script == Some(hb_tag_t::from_bytes(b"latn")) || - gsub_script == Some(hb_tag_t::from_bytes(b"mymr")) + gsub_script == Some(hb_tag_t::new(b"latn")) || + gsub_script == Some(hb_tag_t::new(b"mymr")) { &DEFAULT_SHAPER } else { @@ -331,7 +331,7 @@ pub fn hb_ot_shape_complex_categorize( // Note that for some simple scripts, there may not be *any* // GSUB/GPOS needed, so there may be no scripts found! if gsub_script == Some(hb_tag_t::default_script()) || - gsub_script == Some(hb_tag_t::from_bytes(b"latn")) { + gsub_script == Some(hb_tag_t::new(b"latn")) { &DEFAULT_SHAPER } else { &crate::hb::ot_shaper_use::UNIVERSAL_SHAPER diff --git a/src/hb/ot_shaper_arabic.rs b/src/hb/ot_shaper_arabic.rs index 4e126fa..b6ecab9 100644 --- a/src/hb/ot_shaper_arabic.rs +++ b/src/hb/ot_shaper_arabic.rs @@ -68,17 +68,17 @@ fn get_joining_type(u: char, gc: hb_unicode_general_category_t) -> hb_arabic_joi } fn feature_is_syriac(tag: hb_tag_t) -> bool { - matches!(tag.to_bytes()[3], b'2' | b'3') + matches!(tag.to_be_bytes()[3], b'2' | b'3') } const ARABIC_FEATURES: &[hb_tag_t] = &[ - hb_tag_t::from_bytes(b"isol"), - hb_tag_t::from_bytes(b"fina"), - hb_tag_t::from_bytes(b"fin2"), - hb_tag_t::from_bytes(b"fin3"), - hb_tag_t::from_bytes(b"medi"), - hb_tag_t::from_bytes(b"med2"), - hb_tag_t::from_bytes(b"init"), + hb_tag_t::new(b"isol"), + hb_tag_t::new(b"fina"), + hb_tag_t::new(b"fin2"), + hb_tag_t::new(b"fin3"), + hb_tag_t::new(b"medi"), + hb_tag_t::new(b"med2"), + hb_tag_t::new(b"init"), ]; mod arabic_action_t { @@ -204,15 +204,15 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"stch"), F_NONE, 1); + .enable_feature(hb_tag_t::new(b"stch"), F_NONE, 1); planner.ot_map.add_gsub_pause(Some(record_stch)); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"ccmp"), F_MANUAL_ZWJ, 1); + .enable_feature(hb_tag_t::new(b"ccmp"), F_MANUAL_ZWJ, 1); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"locl"), F_MANUAL_ZWJ, 1); + .enable_feature(hb_tag_t::new(b"locl"), F_MANUAL_ZWJ, 1); planner.ot_map.add_gsub_pause(None); @@ -230,7 +230,7 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { // the main ligating features as MANUAL_ZWJ. planner.ot_map.enable_feature( - hb_tag_t::from_bytes(b"rlig"), + hb_tag_t::new(b"rlig"), F_MANUAL_ZWJ | F_HAS_FALLBACK, 1, ); @@ -243,21 +243,21 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { // See 98460779bae19e4d64d29461ff154b3527bf8420 planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"calt"), F_MANUAL_ZWJ, 1); + .enable_feature(hb_tag_t::new(b"calt"), F_MANUAL_ZWJ, 1); /* https://github.com/harfbuzz/harfbuzz/issues/1573 */ - if !planner.ot_map.has_feature(hb_tag_t::from_bytes(b"rclt")) { + if !planner.ot_map.has_feature(hb_tag_t::new(b"rclt")) { planner.ot_map.add_gsub_pause(None); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"rclt"), F_MANUAL_ZWJ, 1); + .enable_feature(hb_tag_t::new(b"rclt"), F_MANUAL_ZWJ, 1); } planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"liga"), F_MANUAL_ZWJ, 1); + .enable_feature(hb_tag_t::new(b"liga"), F_MANUAL_ZWJ, 1); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"clig"), F_MANUAL_ZWJ, 1); + .enable_feature(hb_tag_t::new(b"clig"), F_MANUAL_ZWJ, 1); // The spec includes 'cswh'. Earlier versions of Windows // used to enable this by default, but testing suggests @@ -271,7 +271,7 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { // planner.ot_map.enable_feature(feature::CONTEXTUAL_SWASH, F_MANUAL_ZWJ, 1); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"mset"), F_MANUAL_ZWJ, 1); + .enable_feature(hb_tag_t::new(b"mset"), F_MANUAL_ZWJ, 1); } pub struct arabic_shape_plan_t { @@ -284,7 +284,7 @@ pub struct arabic_shape_plan_t { } pub fn data_create_arabic(plan: &hb_ot_shape_plan_t) -> arabic_shape_plan_t { - let has_stch = plan.ot_map.get_1_mask(hb_tag_t::from_bytes(b"stch")) != 0; + let has_stch = plan.ot_map.get_1_mask(hb_tag_t::new(b"stch")) != 0; let mut mask_array = [0; ARABIC_FEATURES.len() + 1]; for i in 0..ARABIC_FEATURES.len() { diff --git a/src/hb/ot_shaper_hangul.rs b/src/hb/ot_shaper_hangul.rs index e6243cb..65a1830 100644 --- a/src/hb/ot_shaper_hangul.rs +++ b/src/hb/ot_shaper_hangul.rs @@ -26,13 +26,13 @@ impl hb_glyph_info_t { fn collect_features_hangul(planner: &mut hb_ot_shape_planner_t) { planner .ot_map - .add_feature(hb_tag_t::from_bytes(b"ljmo"), F_NONE, 1); + .add_feature(hb_tag_t::new(b"ljmo"), F_NONE, 1); planner .ot_map - .add_feature(hb_tag_t::from_bytes(b"vjmo"), F_NONE, 1); + .add_feature(hb_tag_t::new(b"vjmo"), F_NONE, 1); planner .ot_map - .add_feature(hb_tag_t::from_bytes(b"tjmo"), F_NONE, 1); + .add_feature(hb_tag_t::new(b"tjmo"), F_NONE, 1); } fn override_features_hangul(planner: &mut hb_ot_shape_planner_t) { @@ -41,7 +41,7 @@ fn override_features_hangul(planner: &mut hb_ot_shape_planner_t) { // in calt, which is not desirable. planner .ot_map - .disable_feature(hb_tag_t::from_bytes(b"calt")); + .disable_feature(hb_tag_t::new(b"calt")); } struct hangul_shape_plan_t { @@ -52,9 +52,9 @@ fn data_create_hangul(map: &hb_ot_map_t) -> hangul_shape_plan_t { hangul_shape_plan_t { mask_array: [ 0, - map.get_1_mask(hb_tag_t::from_bytes(b"ljmo")), - map.get_1_mask(hb_tag_t::from_bytes(b"vjmo")), - map.get_1_mask(hb_tag_t::from_bytes(b"tjmo")), + map.get_1_mask(hb_tag_t::new(b"ljmo")), + map.get_1_mask(hb_tag_t::new(b"vjmo")), + map.get_1_mask(hb_tag_t::new(b"tjmo")), ], } } diff --git a/src/hb/ot_shaper_hebrew.rs b/src/hb/ot_shaper_hebrew.rs index 0b4376e..8cdc92d 100644 --- a/src/hb/ot_shaper_hebrew.rs +++ b/src/hb/ot_shaper_hebrew.rs @@ -17,7 +17,7 @@ pub const HEBREW_SHAPER: hb_ot_shaper_t = hb_ot_shaper_t { decompose: None, compose: Some(compose), setup_masks: None, - gpos_tag: Some(hb_tag_t::from_bytes(b"hebr")), + gpos_tag: Some(hb_tag_t::new(b"hebr")), reorder_marks: Some(reorder_marks_hebrew), zero_width_marks: HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, fallback_position: true, diff --git a/src/hb/ot_shaper_indic.rs b/src/hb/ot_shaper_indic.rs index a4c4bfb..a9e283a 100644 --- a/src/hb/ot_shaper_indic.rs +++ b/src/hb/ot_shaper_indic.rs @@ -121,47 +121,47 @@ const INDIC_FEATURES: &[(hb_tag_t, hb_ot_map_feature_flags_t)] = &[ // These features are applied in order, one at a time, after initial_reordering, // constrained to the syllable. ( - hb_tag_t::from_bytes(b"nukt"), + hb_tag_t::new(b"nukt"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"akhn"), + hb_tag_t::new(b"akhn"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"rphf"), + hb_tag_t::new(b"rphf"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"rkrf"), + hb_tag_t::new(b"rkrf"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"pref"), + hb_tag_t::new(b"pref"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"blwf"), + hb_tag_t::new(b"blwf"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"abvf"), + hb_tag_t::new(b"abvf"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"half"), + hb_tag_t::new(b"half"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"pstf"), + hb_tag_t::new(b"pstf"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"vatu"), + hb_tag_t::new(b"vatu"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"cjct"), + hb_tag_t::new(b"cjct"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), // Other features. @@ -170,27 +170,27 @@ const INDIC_FEATURES: &[(hb_tag_t, hb_ot_map_feature_flags_t)] = &[ // Default Bengali font in Windows for example has intermixed // lookups for init,pres,abvs,blws features. ( - hb_tag_t::from_bytes(b"init"), + hb_tag_t::new(b"init"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"pres"), + hb_tag_t::new(b"pres"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"abvs"), + hb_tag_t::new(b"abvs"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"blws"), + hb_tag_t::new(b"blws"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"psts"), + hb_tag_t::new(b"psts"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"haln"), + hb_tag_t::new(b"haln"), F_GLOBAL_MANUAL_JOINERS | F_PER_SYLLABLE, ), ]; @@ -462,7 +462,7 @@ impl IndicShapePlan { && plan .ot_map .chosen_script(TableIndex::GSUB) - .map_or(true, |tag| tag.to_bytes()[3] != b'2'); + .map_or(true, |tag| tag.to_be_bytes()[3] != b'2'); // Use zero-context would_substitute() matching for new-spec of the main // Indic scripts, and scripts with one spec only, but not for old-specs. @@ -497,27 +497,27 @@ impl IndicShapePlan { // virama_glyph, rphf: IndicWouldSubstituteFeature::new( &plan.ot_map, - hb_tag_t::from_bytes(b"rphf"), + hb_tag_t::new(b"rphf"), zero_context, ), pref: IndicWouldSubstituteFeature::new( &plan.ot_map, - hb_tag_t::from_bytes(b"pref"), + hb_tag_t::new(b"pref"), zero_context, ), blwf: IndicWouldSubstituteFeature::new( &plan.ot_map, - hb_tag_t::from_bytes(b"blwf"), + hb_tag_t::new(b"blwf"), zero_context, ), pstf: IndicWouldSubstituteFeature::new( &plan.ot_map, - hb_tag_t::from_bytes(b"pstf"), + hb_tag_t::new(b"pstf"), zero_context, ), vatu: IndicWouldSubstituteFeature::new( &plan.ot_map, - hb_tag_t::from_bytes(b"vatu"), + hb_tag_t::new(b"vatu"), zero_context, ), mask_array, @@ -602,12 +602,12 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"locl"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"locl"), F_PER_SYLLABLE, 1); // The Indic specs do not require ccmp, but we apply it here since if // there is a use of it, it's typically at the beginning. planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"ccmp"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"ccmp"), F_PER_SYLLABLE, 1); planner.ot_map.add_gsub_pause(Some(initial_reordering)); @@ -626,7 +626,7 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { fn override_features(planner: &mut hb_ot_shape_planner_t) { planner .ot_map - .disable_feature(hb_tag_t::from_bytes(b"liga")); + .disable_feature(hb_tag_t::new(b"liga")); planner.ot_map.add_gsub_pause(Some(syllabic_clear_var)); // Don't need syllables anymore. } diff --git a/src/hb/ot_shaper_khmer.rs b/src/hb/ot_shaper_khmer.rs index d1d32a1..3029e91 100644 --- a/src/hb/ot_shaper_khmer.rs +++ b/src/hb/ot_shaper_khmer.rs @@ -31,31 +31,31 @@ const KHMER_FEATURES: &[(hb_tag_t, hb_ot_map_feature_flags_t)] = &[ // These features are applied all at once, before reordering, constrained // to the syllable. ( - hb_tag_t::from_bytes(b"pref"), + hb_tag_t::new(b"pref"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"blwf"), + hb_tag_t::new(b"blwf"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"abvf"), + hb_tag_t::new(b"abvf"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"pstf"), + hb_tag_t::new(b"pstf"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), ( - hb_tag_t::from_bytes(b"cfar"), + hb_tag_t::new(b"cfar"), F_MANUAL_JOINERS | F_PER_SYLLABLE, ), // Other features. // These features are applied all at once after clearing syllables. - (hb_tag_t::from_bytes(b"pres"), F_GLOBAL_MANUAL_JOINERS), - (hb_tag_t::from_bytes(b"abvs"), F_GLOBAL_MANUAL_JOINERS), - (hb_tag_t::from_bytes(b"blws"), F_GLOBAL_MANUAL_JOINERS), - (hb_tag_t::from_bytes(b"psts"), F_GLOBAL_MANUAL_JOINERS), + (hb_tag_t::new(b"pres"), F_GLOBAL_MANUAL_JOINERS), + (hb_tag_t::new(b"abvs"), F_GLOBAL_MANUAL_JOINERS), + (hb_tag_t::new(b"blws"), F_GLOBAL_MANUAL_JOINERS), + (hb_tag_t::new(b"psts"), F_GLOBAL_MANUAL_JOINERS), ]; // Must be in the same order as the KHMER_FEATURES array. @@ -111,10 +111,10 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { // https://github.com/harfbuzz/harfbuzz/issues/974 planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"locl"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"locl"), F_PER_SYLLABLE, 1); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"ccmp"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"ccmp"), F_PER_SYLLABLE, 1); for feature in KHMER_FEATURES.iter().take(5) { planner.ot_map.add_feature(feature.0, feature.1, 1); @@ -277,11 +277,11 @@ fn override_features(planner: &mut hb_ot_shape_planner_t) { // typographical correctness.", hence in overrides... planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"clig"), F_NONE, 1); + .enable_feature(hb_tag_t::new(b"clig"), F_NONE, 1); planner .ot_map - .disable_feature(hb_tag_t::from_bytes(b"liga")); + .disable_feature(hb_tag_t::new(b"liga")); } fn decompose(_: &hb_ot_shape_normalize_context_t, ab: char) -> Option<(char, char)> { diff --git a/src/hb/ot_shaper_myanmar.rs b/src/hb/ot_shaper_myanmar.rs index 749f6d2..56cee60 100644 --- a/src/hb/ot_shaper_myanmar.rs +++ b/src/hb/ot_shaper_myanmar.rs @@ -47,16 +47,16 @@ const MYANMAR_FEATURES: &[hb_tag_t] = &[ // Basic features. // These features are applied in order, one at a time, after reordering, // constrained to the syllable. - hb_tag_t::from_bytes(b"rphf"), - hb_tag_t::from_bytes(b"pref"), - hb_tag_t::from_bytes(b"blwf"), - hb_tag_t::from_bytes(b"pstf"), + hb_tag_t::new(b"rphf"), + hb_tag_t::new(b"pref"), + hb_tag_t::new(b"blwf"), + hb_tag_t::new(b"pstf"), // Other features. // These features are applied all at once after clearing syllables. - hb_tag_t::from_bytes(b"pres"), - hb_tag_t::from_bytes(b"abvs"), - hb_tag_t::from_bytes(b"blws"), - hb_tag_t::from_bytes(b"psts"), + hb_tag_t::new(b"pres"), + hb_tag_t::new(b"abvs"), + hb_tag_t::new(b"blws"), + hb_tag_t::new(b"psts"), ]; impl hb_glyph_info_t { @@ -74,12 +74,12 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"locl"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"locl"), F_PER_SYLLABLE, 1); // The Indic specs do not require ccmp, but we apply it here since if // there is a use of it, it's typically at the beginning. planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"ccmp"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"ccmp"), F_PER_SYLLABLE, 1); planner.ot_map.add_gsub_pause(Some(reorder_myanmar)); diff --git a/src/hb/ot_shaper_use.rs b/src/hb/ot_shaper_use.rs index 203f227..4c11be0 100644 --- a/src/hb/ot_shaper_use.rs +++ b/src/hb/ot_shaper_use.rs @@ -106,20 +106,20 @@ pub mod category { // These features are applied all at once, before reordering, // constrained to the syllable. const BASIC_FEATURES: &[hb_tag_t] = &[ - hb_tag_t::from_bytes(b"rkrf"), - hb_tag_t::from_bytes(b"abvf"), - hb_tag_t::from_bytes(b"blwf"), - hb_tag_t::from_bytes(b"half"), - hb_tag_t::from_bytes(b"pstf"), - hb_tag_t::from_bytes(b"vatu"), - hb_tag_t::from_bytes(b"cjct"), + hb_tag_t::new(b"rkrf"), + hb_tag_t::new(b"abvf"), + hb_tag_t::new(b"blwf"), + hb_tag_t::new(b"half"), + hb_tag_t::new(b"pstf"), + hb_tag_t::new(b"vatu"), + hb_tag_t::new(b"cjct"), ]; const TOPOGRAPHICAL_FEATURES: &[hb_tag_t] = &[ - hb_tag_t::from_bytes(b"isol"), - hb_tag_t::from_bytes(b"init"), - hb_tag_t::from_bytes(b"medi"), - hb_tag_t::from_bytes(b"fina"), + hb_tag_t::new(b"isol"), + hb_tag_t::new(b"init"), + hb_tag_t::new(b"medi"), + hb_tag_t::new(b"fina"), ]; // Same order as use_topographical_features. @@ -133,11 +133,11 @@ enum JoiningForm { // These features are applied all at once, after reordering and clearing syllables. const OTHER_FEATURES: &[hb_tag_t] = &[ - hb_tag_t::from_bytes(b"abvs"), - hb_tag_t::from_bytes(b"blws"), - hb_tag_t::from_bytes(b"haln"), - hb_tag_t::from_bytes(b"pres"), - hb_tag_t::from_bytes(b"psts"), + hb_tag_t::new(b"abvs"), + hb_tag_t::new(b"blws"), + hb_tag_t::new(b"haln"), + hb_tag_t::new(b"pres"), + hb_tag_t::new(b"psts"), ]; impl hb_glyph_info_t { @@ -171,7 +171,7 @@ impl UniversalShapePlan { } UniversalShapePlan { - rphf_mask: plan.ot_map.get_1_mask(hb_tag_t::from_bytes(b"rphf")), + rphf_mask: plan.ot_map.get_1_mask(hb_tag_t::new(b"rphf")), arabic_plan, } } @@ -184,15 +184,15 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { // Default glyph pre-processing group planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"locl"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"locl"), F_PER_SYLLABLE, 1); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"ccmp"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"ccmp"), F_PER_SYLLABLE, 1); planner .ot_map - .enable_feature(hb_tag_t::from_bytes(b"nukt"), F_PER_SYLLABLE, 1); + .enable_feature(hb_tag_t::new(b"nukt"), F_PER_SYLLABLE, 1); planner.ot_map.enable_feature( - hb_tag_t::from_bytes(b"akhn"), + hb_tag_t::new(b"akhn"), F_MANUAL_ZWJ | F_PER_SYLLABLE, 1, ); @@ -202,7 +202,7 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { .ot_map .add_gsub_pause(Some(crate::hb::ot_layout::_hb_clear_substitution_flags)); planner.ot_map.add_feature( - hb_tag_t::from_bytes(b"rphf"), + hb_tag_t::new(b"rphf"), F_MANUAL_ZWJ | F_PER_SYLLABLE, 1, ); @@ -211,7 +211,7 @@ fn collect_features(planner: &mut hb_ot_shape_planner_t) { .ot_map .add_gsub_pause(Some(crate::hb::ot_layout::_hb_clear_substitution_flags)); planner.ot_map.enable_feature( - hb_tag_t::from_bytes(b"pref"), + hb_tag_t::new(b"pref"), F_MANUAL_ZWJ | F_PER_SYLLABLE, 1, ); diff --git a/src/hb/tag.rs b/src/hb/tag.rs index 24a2f5f..855abfd 100644 --- a/src/hb/tag.rs +++ b/src/hb/tag.rs @@ -123,7 +123,7 @@ fn parse_private_use_subtag( // Some bits magic from HarfBuzz... if tag.as_u32() & 0xDFDFDFDF == hb_tag_t::default_script().as_u32() { - tag = hb_tag_t(tag.as_u32() ^ !0xDFDFDFDF); + tag = hb_tag_t::from_u32(tag.as_u32() ^ !0xDFDFDFDF); } tags.push(tag); @@ -201,10 +201,10 @@ fn all_tags_from_script(script: Option