提交 6358ff45 编写于 作者: B Behdad Esfahbod

Add hb_ft_face_create_cached

上级 2027f74b
......@@ -178,6 +178,22 @@ hb_ft_face_create (FT_Face ft_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_ft_font_create (FT_Face ft_face,
......
......@@ -43,6 +43,9 @@ hb_face_t *
hb_ft_face_create (FT_Face ft_face,
hb_destroy_func_t destroy);
hb_face_t *
hb_ft_face_create_cached (FT_Face ft_face);
hb_font_t *
hb_ft_font_create (FT_Face ft_face,
hb_destroy_func_t destroy);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册