Simplify mainline Harfbuzz-using code
* src/ftfont.c (ft_face_destroy): Omit unnecessary cast. (hb_ft_font_create_referenced) [!HAVE_HB_FT_FONT_CREATE_REFERENCED]: New function. (ftfont_get_hb_font): Use it.
This commit is contained in:
parent
981b3d292a
commit
a7214683be
1 changed files with 12 additions and 13 deletions
25
src/ftfont.c
25
src/ftfont.c
|
@ -478,28 +478,27 @@ ftfont_get_otf (struct ftfont_info *ftfont_info)
|
|||
|
||||
#ifdef HAVE_HARFBUZZ
|
||||
|
||||
#ifndef HAVE_HB_FT_FONT_CREATE_REFERENCED
|
||||
# ifndef HAVE_HB_FT_FONT_CREATE_REFERENCED
|
||||
static void
|
||||
ft_face_destroy (void *data)
|
||||
{
|
||||
FT_Done_Face ((FT_Face) data);
|
||||
FT_Done_Face (data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static hb_font_t *
|
||||
hb_ft_font_create_referenced (FT_Face face)
|
||||
{
|
||||
FT_Reference_Face (face);
|
||||
return hb_ft_font_create (face, ft_face_destroy);
|
||||
}
|
||||
# endif
|
||||
|
||||
static hb_font_t *
|
||||
ftfont_get_hb_font (struct ftfont_info *ftfont_info)
|
||||
{
|
||||
if (! ftfont_info->hb_font)
|
||||
{
|
||||
hb_font_t *hb_font;
|
||||
#ifdef HAVE_HB_FT_FONT_CREATE_REFERENCED
|
||||
hb_font = hb_ft_font_create_referenced (ftfont_info->ft_size->face);
|
||||
#else
|
||||
FT_Reference_Face (ftfont_info->ft_size->face);
|
||||
hb_font = hb_ft_font_create (ftfont_info->ft_size->face, ft_face_destroy);
|
||||
#endif
|
||||
ftfont_info->hb_font = hb_font;
|
||||
}
|
||||
ftfont_info->hb_font
|
||||
= hb_ft_font_create_referenced (ftfont_info->ft_size->face);
|
||||
return ftfont_info->hb_font;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue