forked from enlightenment/efl
Evas font-engine: cache harfbuzz's face.
SVN revision: 56466
This commit is contained in:
parent
b53ded56ed
commit
4ee6706770
|
@ -4,6 +4,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "evas_font_private.h" /* for Frame-Queuing support */
|
||||
#include "evas_font_ot.h"
|
||||
|
||||
extern FT_Library evas_ft_lib;
|
||||
|
||||
|
@ -164,6 +165,12 @@ evas_common_font_source_unload(RGBA_Font_Source *fs)
|
|||
FTLOCK();
|
||||
FT_Done_Face(fs->ft.face);
|
||||
fs->ft.face = NULL;
|
||||
#ifdef OT_SUPPORT
|
||||
if (evas_common_font_ot_is_enabled())
|
||||
{
|
||||
evas_common_font_ot_unload_face(fs);
|
||||
}
|
||||
#endif
|
||||
FTUNLOCK();
|
||||
}
|
||||
|
||||
|
@ -213,6 +220,12 @@ evas_common_font_source_load_complete(RGBA_Font_Source *fs)
|
|||
fs->ft.face = NULL;
|
||||
return error;
|
||||
}
|
||||
#ifdef OT_SUPPORT
|
||||
if (evas_common_font_ot_is_enabled())
|
||||
{
|
||||
evas_common_font_ot_load_face(fs);
|
||||
}
|
||||
#endif
|
||||
FTUNLOCK();
|
||||
fs->ft.orig_upem = fs->ft.face->units_per_EM;
|
||||
return error;
|
||||
|
|
|
@ -85,18 +85,31 @@ evas_common_font_ot_cluster_size_get(const Evas_Text_Props *props, size_t char_i
|
|||
return (items > 0) ? items : 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_evas_common_font_ot_shape(hb_buffer_t *buffer, FT_Face face)
|
||||
EAPI void
|
||||
evas_common_font_ot_load_face(void *_font)
|
||||
{
|
||||
RGBA_Font_Source *font = (RGBA_Font_Source *) _font;
|
||||
font->hb.face = hb_ft_face_create(font->ft.face, NULL);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_common_font_ot_unload_face(void *_font)
|
||||
{
|
||||
RGBA_Font_Source *font = (RGBA_Font_Source *) _font;
|
||||
if (!font->hb.face) return;
|
||||
hb_face_destroy(font->hb.face);
|
||||
font->hb.face = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Source *src)
|
||||
{
|
||||
hb_face_t *hb_face;
|
||||
hb_font_t *hb_font;
|
||||
|
||||
hb_face = hb_ft_face_create(face, NULL);
|
||||
hb_font = hb_ft_font_create(face, NULL);
|
||||
hb_font = hb_ft_font_create(src->ft.face, NULL);
|
||||
|
||||
hb_shape(hb_font, hb_face, buffer, NULL, 0);
|
||||
hb_shape(hb_font, src->hb.face, buffer, NULL, 0);
|
||||
hb_font_destroy(hb_font);
|
||||
hb_face_destroy(hb_face);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
@ -149,7 +162,7 @@ evas_common_font_ot_populate_text_props(void *_fn, const Eina_Unicode *text,
|
|||
/* FIXME: add run-time conversions if needed, which is very unlikely */
|
||||
hb_buffer_add_utf32(buffer, (const uint32_t *) text, slen, 0, slen);
|
||||
|
||||
_evas_common_font_ot_shape(buffer, fi->src->ft.face);
|
||||
_evas_common_font_ot_shape(buffer, fi->src);
|
||||
|
||||
props->ot_data->len = hb_buffer_get_length(buffer);
|
||||
props->ot_data->items = calloc(props->ot_data->len,
|
||||
|
|
|
@ -62,6 +62,12 @@ evas_common_font_ot_props_ref(Evas_Font_OT_Data *data);
|
|||
EAPI void
|
||||
evas_common_font_ot_props_unref(Evas_Font_OT_Data *data);
|
||||
|
||||
EAPI void
|
||||
evas_common_font_ot_load_face(void *_font);
|
||||
|
||||
EAPI void
|
||||
evas_common_font_ot_unload_face(void *_font);
|
||||
|
||||
#include "evas_text_utils.h"
|
||||
EAPI int
|
||||
evas_common_font_ot_cluster_size_get(const Evas_Text_Props *props, size_t char_index, int orig_len);
|
||||
|
|
|
@ -884,6 +884,8 @@ struct _RGBA_Font_Int
|
|||
unsigned char inuse : 1;
|
||||
};
|
||||
|
||||
#include "../engines/common/evas_font_ot.h"
|
||||
|
||||
struct _RGBA_Font_Source
|
||||
{
|
||||
const char *name;
|
||||
|
@ -896,6 +898,11 @@ struct _RGBA_Font_Source
|
|||
int orig_upem;
|
||||
FT_Face face;
|
||||
} ft;
|
||||
#ifdef OT_SUPPORT
|
||||
struct {
|
||||
void *face;
|
||||
} hb;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _RGBA_Font_Glyph
|
||||
|
|
Loading…
Reference in New Issue