forked from enlightenment/efl
Evas font: Cache Harfbuzz font structure for fonts we use.
SVN revision: 64136
This commit is contained in:
parent
387bff89fb
commit
4906d50afc
|
@ -6,6 +6,11 @@
|
|||
#include "evas_font_private.h" /* for Frame-Queuing support */
|
||||
#include "evas_font_ot.h"
|
||||
|
||||
#ifdef USE_HARFBUZZ
|
||||
# include <hb.h>
|
||||
# include <hb-ft.h>
|
||||
#endif
|
||||
|
||||
extern FT_Library evas_ft_lib;
|
||||
|
||||
static int font_cache_usage = 0;
|
||||
|
@ -51,6 +56,9 @@ _evas_common_font_source_free(RGBA_Font_Source *fs)
|
|||
{
|
||||
FTLOCK();
|
||||
FT_Done_Face(fs->ft.face);
|
||||
#ifdef USE_HARFBUZZ
|
||||
hb_font_destroy(fs->ft.hb_font);
|
||||
#endif
|
||||
FTUNLOCK();
|
||||
if (fs->name) eina_stringshare_del(fs->name);
|
||||
if (fs->file) eina_stringshare_del(fs->file);
|
||||
|
|
|
@ -245,17 +245,20 @@ _evas_common_font_ot_unicode_funcs_get(void)
|
|||
static void
|
||||
_evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Int *fi)
|
||||
{
|
||||
hb_font_t *hb_font, *hb_ft_font;
|
||||
/* Create hb_font if not previously created */
|
||||
if (!fi->src->ft.hb_font)
|
||||
{
|
||||
hb_font_t *hb_ft_font;
|
||||
|
||||
hb_ft_font = hb_ft_font_create(fi->src->ft.face, NULL);
|
||||
hb_font = hb_font_create_sub_font(hb_ft_font);
|
||||
|
||||
hb_font_set_funcs(hb_font, _evas_common_font_ot_font_funcs_get(), fi, NULL);
|
||||
|
||||
hb_shape(hb_font, buffer, NULL, 0);
|
||||
|
||||
hb_font_destroy(hb_font);
|
||||
fi->src->ft.hb_font = hb_font_create_sub_font(hb_ft_font);
|
||||
hb_font_destroy(hb_ft_font);
|
||||
|
||||
hb_font_set_funcs(fi->src->ft.hb_font,
|
||||
_evas_common_font_ot_font_funcs_get(), fi, NULL);
|
||||
}
|
||||
|
||||
hb_shape(fi->src->ft.hb_font, buffer, NULL, 0);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
|
|
@ -942,6 +942,9 @@ struct _RGBA_Font_Source
|
|||
struct {
|
||||
int orig_upem;
|
||||
FT_Face face;
|
||||
#ifdef USE_HARFBUZZ
|
||||
void *hb_font;
|
||||
#endif
|
||||
} ft;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue