mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-26 01:11:25 +01:00
[harfruzz] Implement user features
This commit is contained in:
1 parent
d185d1c861
commit
5c7992bea6
1 file changed
+24
-3
+24
-3
@@ -96,8 +96,8 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs(
|
||||
font_data: *const c_void,
|
||||
font: *mut hb_font_t,
|
||||
buffer: *mut hb_buffer_t,
|
||||
_features: *const hb_feature_t,
|
||||
_num_features: u32,
|
||||
features: *const hb_feature_t,
|
||||
num_features: u32,
|
||||
) -> hb_bool_t {
|
||||
let font_data = font_data as *const HBHarfRuzzFontData;
|
||||
|
||||
@@ -165,7 +165,28 @@ pub unsafe extern "C" fn _hb_harfruzz_shape_rs(
|
||||
|
||||
let face = &(*font_data).face.as_ref().unwrap();
|
||||
|
||||
let glyphs = harfruzz::shape(face, &[], hr_buffer);
|
||||
let features = if features.is_null() {
|
||||
Vec::new()
|
||||
} else {
|
||||
let features = std::slice::from_raw_parts(features, num_features as usize);
|
||||
features
|
||||
.iter()
|
||||
.map(|f| {
|
||||
let tag = f.tag;
|
||||
let value = f.value;
|
||||
let start = f.start;
|
||||
let end = f.end;
|
||||
harfruzz::Feature {
|
||||
tag: Tag::from_u32(tag),
|
||||
value,
|
||||
start,
|
||||
end,
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
|
||||
let glyphs = harfruzz::shape(face, &features, hr_buffer);
|
||||
|
||||
let count = glyphs.len();
|
||||
hb_buffer_set_content_type(
|
||||
|
||||
Reference in new issue
Block a user