Skip to content

Commit

Permalink
Stop using unstable 'unique' feature
Browse files Browse the repository at this point in the history
The `Unique` wrapper was only needed to provide the `Sync` trait.
  • Loading branch information
mbrubeck committed Sep 20, 2017
1 parent f31c8e6 commit 2795e5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion components/gfx/lib.rs
Expand Up @@ -7,7 +7,6 @@
#![feature(box_syntax)]
#![feature(cfg_target_feature)]
#![feature(range_contains)]
#![feature(unique)]

#![deny(unsafe_code)]

Expand Down
12 changes: 8 additions & 4 deletions components/gfx/text/shaping/harfbuzz.rs
Expand Up @@ -164,7 +164,7 @@ impl Shaper {
Shaper::float_to_fixed(pt_size) as c_int);

// configure static function callbacks.
hb_font_set_funcs(hb_font, HB_FONT_FUNCS.as_ptr(), font as *mut Font as *mut c_void, None);
hb_font_set_funcs(hb_font, HB_FONT_FUNCS.0, font as *mut Font as *mut c_void, None);

Shaper {
hb_face: hb_face,
Expand Down Expand Up @@ -411,17 +411,21 @@ impl Shaper {
}
}

// Callbacks from Harfbuzz when font map and glyph advance lookup needed.
/// Callbacks from Harfbuzz when font map and glyph advance lookup needed.
struct FontFuncs(*mut hb_font_funcs_t);

unsafe impl Sync for FontFuncs {}

lazy_static! {
static ref HB_FONT_FUNCS: ptr::Unique<hb_font_funcs_t> = unsafe {
static ref HB_FONT_FUNCS: FontFuncs = unsafe {
let hb_funcs = hb_font_funcs_create();
hb_font_funcs_set_glyph_func(hb_funcs, Some(glyph_func), ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_advance_func(
hb_funcs, Some(glyph_h_advance_func), ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_kerning_func(
hb_funcs, Some(glyph_h_kerning_func), ptr::null_mut(), None);

ptr::Unique::new_unchecked(hb_funcs)
FontFuncs(hb_funcs)
};
}

Expand Down

0 comments on commit 2795e5f

Please sign in to comment.