mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-13 08:42:59 +00:00
[fontations] Remove get_glyph_h_advance()
This commit is contained in:
parent
1390da5d12
commit
e801e484f1
1 changed files with 3 additions and 35 deletions
|
@ -22,27 +22,6 @@ extern "C" fn _hb_fontations_data_destroy(ptr: *mut c_void) {
|
|||
// TODO
|
||||
}
|
||||
|
||||
extern "C" fn _hb_fontations_get_glyph_h_advance(
|
||||
font: *mut hb_font_t,
|
||||
font_data: *mut ::std::os::raw::c_void,
|
||||
glyph: hb_codepoint_t,
|
||||
_user_data: *mut ::std::os::raw::c_void,
|
||||
) -> hb_position_t {
|
||||
let data = unsafe {
|
||||
assert!(!font_data.is_null());
|
||||
&*(font_data as *const FontationsData)
|
||||
};
|
||||
let mut x_scale : i32 = 0;
|
||||
let mut y_scale : i32 = 0;
|
||||
unsafe { hb_font_get_scale(font, &mut x_scale, &mut y_scale); };
|
||||
let font_ref = &data.font_ref;
|
||||
let size = Size::new(x_scale as f32);
|
||||
let glyph_id = GlyphId::new(glyph);
|
||||
let location = Location::default();
|
||||
let glyph_metrics = font_ref.glyph_metrics(size, &location);
|
||||
let advance = glyph_metrics.advance_width(glyph_id).unwrap_or_default();
|
||||
advance as hb_position_t
|
||||
}
|
||||
extern "C" fn _hb_fontations_get_glyph_h_advances(
|
||||
font: *mut hb_font_t,
|
||||
font_data: *mut ::std::os::raw::c_void,
|
||||
|
@ -62,12 +41,12 @@ extern "C" fn _hb_fontations_get_glyph_h_advances(
|
|||
unsafe { hb_font_get_scale(font, &mut x_scale, &mut y_scale); };
|
||||
let font_ref = &data.font_ref;
|
||||
let size = Size::new(x_scale as f32);
|
||||
let location = Location::default();
|
||||
let location = Location::default(); // TODO
|
||||
let glyph_metrics = font_ref.glyph_metrics(size, &location);
|
||||
|
||||
for i in 0..count {
|
||||
let glyph = unsafe { *first_glyph.offset((i * glyph_stride) as isize) };
|
||||
let glyph_id = GlyphId::new(glyph);
|
||||
let glyph_metrics = font_ref.glyph_metrics(size, &location);
|
||||
let advance = glyph_metrics.advance_width(glyph_id).unwrap_or_default();
|
||||
unsafe { *first_advance.offset((i * advance_stride) as isize) = advance as hb_position_t; }
|
||||
}
|
||||
|
@ -77,18 +56,7 @@ fn _hb_fontations_font_funcs_create() -> *mut hb_font_funcs_t {
|
|||
let ffuncs = unsafe { hb_font_funcs_create() };
|
||||
|
||||
unsafe {
|
||||
hb_font_funcs_set_glyph_h_advance_func(
|
||||
ffuncs,
|
||||
Some(_hb_fontations_get_glyph_h_advance),
|
||||
null_mut(),
|
||||
None
|
||||
);
|
||||
hb_font_funcs_set_glyph_h_advances_func(
|
||||
ffuncs,
|
||||
Some(_hb_fontations_get_glyph_h_advances),
|
||||
null_mut(),
|
||||
None
|
||||
);
|
||||
hb_font_funcs_set_glyph_h_advances_func(ffuncs, Some(_hb_fontations_get_glyph_h_advances), null_mut(), None);
|
||||
}
|
||||
|
||||
ffuncs
|
||||
|
|
Loading…
Add table
Reference in a new issue