diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 6af4e065e..aa73e7ba0 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -325,6 +325,11 @@ hb_ft_face_create_cached (FT_Face ft_face) return hb_face_reference ((hb_face_t *) ft_face->generic.data); } +void +_do_nothing (void) +{ +} + hb_font_t * hb_ft_font_create (FT_Face ft_face, @@ -338,7 +343,7 @@ hb_ft_font_create (FT_Face ft_face, hb_face_destroy (face); hb_font_set_funcs (font, _hb_ft_get_font_funcs (), - ft_face, NULL); + ft_face, (hb_destroy_func_t) _do_nothing); hb_font_set_scale (font, ((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM) >> 16, ((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM) >> 16); @@ -413,3 +418,11 @@ hb_ft_font_set_funcs (hb_font_t *font) ft_face, (hb_destroy_func_t) FT_Done_Face); } + +FT_Face +hb_ft_font_get_face (hb_font_t *font) +{ + if (font->destroy == (hb_destroy_func_t) FT_Done_Face || + font->destroy == (hb_destroy_func_t) _do_nothing) + return (FT_Face) font->user_data; +} diff --git a/src/hb-ft.h b/src/hb-ft.h index f575d2e1f..c1772ac15 100644 --- a/src/hb-ft.h +++ b/src/hb-ft.h @@ -55,6 +55,8 @@ hb_ft_font_create (FT_Face ft_face, void hb_ft_font_set_funcs (hb_font_t *font); +FT_Face +hb_ft_font_get_face (hb_font_t *font); HB_END_DECLS