{
ENFN->font_text_props_info_create(ENDT,
fi, str + pos, &it->text_props,
- o->bidi_par_props, it->text_pos, len);
+ o->bidi_par_props, it->text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE);
ENFN->font_string_size_get(ENDT,
o->font,
{
c->ENFN->font_text_props_info_create(c->ENDT,
cur_fi, str, &ti->text_props, c->par->bidi_props,
- ti->parent.text_pos, run_len);
+ ti->parent.text_pos, run_len, EVAS_TEXT_PROPS_MODE_SHAPE);
}
str += run_len;
script_len -= run_len;
c->ENFN->font_text_props_info_create(c->ENDT,
cur_fi, _ellip_str, &ellip_ti->text_props,
- c->par->bidi_props, ellip_ti->parent.text_pos, len);
+ c->par->bidi_props, ellip_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE);
}
_text_item_update_sizes(c, ellip_ti);
}
static void
-_evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Int *fi)
+_evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Int *fi, Evas_Text_Props_Mode mode)
{
/* Create hb_font if not previously created */
if (!fi->ft.hb_font)
_evas_common_font_ot_font_funcs_get(), fi, NULL);
}
- hb_shape(fi->ft.hb_font, buffer, NULL, 0);
+ if (mode == EVAS_TEXT_PROPS_MODE_SHAPE)
+ {
+ hb_shape(fi->ft.hb_font, buffer, NULL, 0);
+ }
+ else
+ {
+ const char *shaper_list[] = { "fallback", NULL };
+ hb_shape_full(fi->ft.hb_font, buffer, NULL, 0, shaper_list);
+ }
}
EAPI Eina_Bool
evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
- Evas_Text_Props *props, int len)
+ Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode)
{
RGBA_Font_Int *fi;
hb_buffer_t *buffer;
/* 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);
+ _evas_common_font_ot_shape(buffer, fi, mode);
props->len = hb_buffer_get_length(buffer);
props->info->ot = calloc(props->len,
EAPI Eina_Bool
evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
- Evas_Text_Props *props, int len);
+ Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode);
#endif
PROPS_CHANGE(item1);
}
-EAPI Eina_Bool
-evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
- Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
- size_t par_pos, int len)
-{
- RGBA_Font_Int *fi = (RGBA_Font_Int *) _fi;
-
- if (text_props->info)
- {
- evas_common_text_props_content_unref(text_props);
- }
- if (len == 0)
- {
- text_props->info = NULL;
- text_props->start = text_props->len = text_props->text_offset = 0;
- }
- text_props->info = calloc(1, sizeof(Evas_Text_Props_Info));
-
- text_props->font_instance = fi;
-
- evas_common_font_int_reload(fi);
- if (fi->src->current_size != fi->size)
- {
- evas_common_font_source_reload(fi->src);
- FTLOCK();
- FT_Activate_Size(fi->ft.size);
- FTUNLOCK();
- fi->src->current_size = fi->size;
- }
-
- text_props->changed = EINA_TRUE;
-
#ifdef OT_SUPPORT
+static inline void
+_content_create_ot(RGBA_Font_Int *fi, const Eina_Unicode *text,
+ Evas_Text_Props *text_props, int len, Evas_Text_Props_Mode mode)
+{
size_t char_index;
Evas_Font_Glyph_Info *gl_itr;
Evas_Coord pen_x = 0, adjust_x = 0;
- (void) par_props;
- (void) par_pos;
- evas_common_font_ot_populate_text_props(text, text_props, len);
+ evas_common_font_ot_populate_text_props(text, text_props, len, mode);
gl_itr = text_props->info->glyph;
for (char_index = 0 ; char_index < text_props->len ; char_index++)
fi = text_props->font_instance;
gl_itr++;
}
-#else
+}
+#endif
+
+static inline void
+_content_create_regular(RGBA_Font_Int *fi, const Eina_Unicode *text,
+ Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
+ size_t par_pos, int len, Evas_Text_Props_Mode mode)
+{
/* We are walking the string in visual ordering */
Evas_Font_Glyph_Info *gl_itr;
Eina_Bool use_kerning;
int adv_d, i;
#if !defined(OT_SUPPORT) && defined(BIDI_SUPPORT)
Eina_Unicode *base_str = NULL;
- if (text_props->bidi.dir == EVAS_BIDI_DIRECTION_RTL)
+ if (mode == EVAS_TEXT_PROPS_MODE_SHAPE)
{
- text = base_str = eina_unicode_strndup(text, len);
- evas_bidi_shape_string(base_str, par_props, par_pos, len);
+ if (text_props->bidi.dir == EVAS_BIDI_DIRECTION_RTL)
+ {
+ text = base_str = eina_unicode_strndup(text, len);
+ evas_bidi_shape_string(base_str, par_props, par_pos, len);
+ }
}
#else
+ (void) mode;
(void) par_props;
(void) par_pos;
#endif
if (base_str)
free(base_str);
# endif
+}
+
+EAPI Eina_Bool
+evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
+ Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
+ size_t par_pos, int len, Evas_Text_Props_Mode mode)
+{
+ RGBA_Font_Int *fi = (RGBA_Font_Int *) _fi;
+
+ if (text_props->info)
+ {
+ evas_common_text_props_content_unref(text_props);
+ }
+ if (len == 0)
+ {
+ text_props->info = NULL;
+ text_props->start = text_props->len = text_props->text_offset = 0;
+ }
+ text_props->info = calloc(1, sizeof(Evas_Text_Props_Info));
+
+ text_props->font_instance = fi;
+
+ evas_common_font_int_reload(fi);
+ if (fi->src->current_size != fi->size)
+ {
+ evas_common_font_source_reload(fi->src);
+ FTLOCK();
+ FT_Activate_Size(fi->ft.size);
+ FTUNLOCK();
+ fi->src->current_size = fi->size;
+ }
+
+ text_props->changed = EINA_TRUE;
+
+#ifdef OT_SUPPORT
+ (void) par_props;
+ (void) par_pos;
+ _content_create_ot(fi, text, text_props, len, mode);
+#else
+ _content_create_regular(fi, text, text_props, par_props, par_pos, len, mode);
#endif
text_props->text_len = len;
Evas_Coord pen_after;
};
+typedef enum
+{
+ EVAS_TEXT_PROPS_MODE_NONE = 0,
+ EVAS_TEXT_PROPS_MODE_SHAPE
+} Evas_Text_Props_Mode;
+
void
evas_common_text_props_bidi_set(Evas_Text_Props *props,
EAPI Eina_Bool
evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
- size_t par_pos, int len);
+ size_t par_pos, int len, Evas_Text_Props_Mode mode);
void
evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst,
void (*image_content_hint_set) (void *data, void *surface, int hint);
int (*image_content_hint_get) (void *data, void *surface);
int (*font_pen_coords_get) (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch);
- Eina_Bool (*font_text_props_info_create) (void *data __UNUSED__, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *intl_props, const Evas_BiDi_Paragraph_Props *par_props, size_t pos, size_t len);
+ Eina_Bool (*font_text_props_info_create) (void *data __UNUSED__, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *intl_props, const Evas_BiDi_Paragraph_Props *par_props, size_t pos, size_t len, Evas_Text_Props_Mode mode);
int (*font_right_inset_get) (void *data, Evas_Font_Set *font, const Evas_Text_Props *text_props);
#if 0 // filtering disabled
}
static Eina_Bool
-eng_font_text_props_info_create(void *data __UNUSED__, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t par_pos, size_t len)
+eng_font_text_props_info_create(void *data __UNUSED__, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t par_pos, size_t len, Evas_Text_Props_Mode mode)
{
return evas_common_text_props_content_create((RGBA_Font_Int *) fi, text,
- text_props, par_props, par_pos, len);
+ text_props, par_props, par_pos, len, mode);
}
static int