Add hb_ft_face_create_cached
This commit is contained in:
parent
2027f74b28
commit
6358ff45ae
16
src/hb-ft.c
16
src/hb-ft.c
|
@ -178,6 +178,22 @@ hb_ft_face_create (FT_Face ft_face,
|
||||||
return face;
|
return face;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hb_face_t *
|
||||||
|
hb_ft_face_create_cached (FT_Face ft_face)
|
||||||
|
{
|
||||||
|
/* TODO: Not thread-safe */
|
||||||
|
if (HB_LIKELY (ft_face->generic.data && ft_face->generic.finalizer == (FT_Generic_Finalizer) hb_face_destroy))
|
||||||
|
return ft_face->generic.data;
|
||||||
|
|
||||||
|
if (ft_face->generic.finalizer)
|
||||||
|
ft_face->generic.finalizer (ft_face->generic.data);
|
||||||
|
|
||||||
|
ft_face->generic.data = hb_ft_face_create (ft_face, NULL);
|
||||||
|
ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_face_destroy;
|
||||||
|
|
||||||
|
return ft_face->generic.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
hb_font_t *
|
hb_font_t *
|
||||||
hb_ft_font_create (FT_Face ft_face,
|
hb_ft_font_create (FT_Face ft_face,
|
||||||
|
|
|
@ -43,6 +43,9 @@ hb_face_t *
|
||||||
hb_ft_face_create (FT_Face ft_face,
|
hb_ft_face_create (FT_Face ft_face,
|
||||||
hb_destroy_func_t destroy);
|
hb_destroy_func_t destroy);
|
||||||
|
|
||||||
|
hb_face_t *
|
||||||
|
hb_ft_face_create_cached (FT_Face ft_face);
|
||||||
|
|
||||||
hb_font_t *
|
hb_font_t *
|
||||||
hb_ft_font_create (FT_Face ft_face,
|
hb_ft_font_create (FT_Face ft_face,
|
||||||
hb_destroy_func_t destroy);
|
hb_destroy_func_t destroy);
|
||||||
|
|
Loading…
Reference in New Issue