forked from enlightenment/efl
Evas font-engine: Change EVAS_FONT_WALK_TEXT_* functions to advance pen_x at the end of the loop (so a break won't advance it, but a clean finish will) and removed the checking if a diacritic using and advancement hack (that only worked only with specific fonts anyway) so we'll be able to start working with Harfbuzz.
SVN revision: 56437
This commit is contained in:
parent
a089d061b8
commit
6dba792f46
|
@ -87,7 +87,6 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
|
|||
#define EVAS_FONT_WALK_TEXT_INIT() \
|
||||
int pen_x = 0, pen_y = 0; \
|
||||
int char_index; \
|
||||
int last_adv; \
|
||||
FT_UInt prev_index; \
|
||||
FT_Face pface = NULL; \
|
||||
(void) pen_y; /* Sometimes it won't be used */
|
||||
|
@ -115,7 +114,6 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
|
|||
int adv; \
|
||||
int visible; \
|
||||
prev_index = 0; \
|
||||
last_adv = 0; \
|
||||
for (char_index = 0 ; *text ; text++, char_index++) \
|
||||
{ \
|
||||
FT_UInt index; \
|
||||
|
@ -168,17 +166,6 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
|
|||
\
|
||||
pface = fi->src->ft.face; \
|
||||
LKU(fi->ft_mutex); \
|
||||
/* If the current one is not a compositing char, do the */ \
|
||||
/* previous advance and set the current advance as the next */ \
|
||||
/* advance to do. If it's an invisible char (i.e one that shouldn't
|
||||
* be printed anyhow, we want to advance everything as if it's
|
||||
* a visible char. FIXME: use a proper way to detect diacritic
|
||||
* instead. */ \
|
||||
if ((adv > 0) || !visible) \
|
||||
{ \
|
||||
pen_x += last_adv; \
|
||||
last_adv = adv; \
|
||||
} \
|
||||
|
||||
/**
|
||||
* @def EVAS_FONT_WALK_TEXT_END
|
||||
|
@ -189,6 +176,10 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
|
|||
* @see EVAS_FONT_WALK_TEXT_WORK
|
||||
*/
|
||||
#define EVAS_FONT_WALK_TEXT_END() \
|
||||
if (visible) \
|
||||
{ \
|
||||
pen_x += adv; \
|
||||
} \
|
||||
prev_index = index; \
|
||||
} \
|
||||
} \
|
||||
|
|
|
@ -140,6 +140,7 @@ EAPI void
|
|||
evas_common_font_query_size(RGBA_Font *fn, const Eina_Unicode *text, const Evas_BiDi_Props *intl_props __UNUSED__, int *w, int *h)
|
||||
{
|
||||
int keep_width = 0;
|
||||
int prev_pen_x = 0;
|
||||
int use_kerning;
|
||||
RGBA_Font_Int *fi;
|
||||
EVAS_FONT_WALK_TEXT_INIT();
|
||||
|
@ -150,9 +151,11 @@ evas_common_font_query_size(RGBA_Font *fn, const Eina_Unicode *text, const Evas_
|
|||
EVAS_FONT_WALK_TEXT_WORK();
|
||||
/* Keep the width because we'll need it for the last char */
|
||||
keep_width = width + bear_x;
|
||||
/* Keep the previous pen_x, before it's advanced in TEXT_END */
|
||||
prev_pen_x = pen_x;
|
||||
}
|
||||
EVAS_FONT_WALK_TEXT_END();
|
||||
if (w) *w = pen_x + keep_width;
|
||||
if (w) *w = prev_pen_x + keep_width;
|
||||
if (h) *h = evas_common_font_max_ascent_get(fn) + evas_common_font_max_descent_get(fn);
|
||||
evas_common_font_int_use_trim();
|
||||
}
|
||||
|
@ -167,7 +170,6 @@ evas_common_font_query_size(RGBA_Font *fn, const Eina_Unicode *text, const Evas_
|
|||
EAPI void
|
||||
evas_common_font_query_advance(RGBA_Font *fn, const Eina_Unicode *text, const Evas_BiDi_Props *intl_props, int *h_adv, int *v_adv)
|
||||
{
|
||||
int keep_adv = 0;
|
||||
int use_kerning;
|
||||
RGBA_Font_Int *fi;
|
||||
EVAS_FONT_WALK_TEXT_INIT();
|
||||
|
@ -176,14 +178,11 @@ evas_common_font_query_advance(RGBA_Font *fn, const Eina_Unicode *text, const Ev
|
|||
EVAS_FONT_WALK_TEXT_START()
|
||||
{
|
||||
EVAS_FONT_WALK_TEXT_WORK();
|
||||
/* Keep the advancement because we want to also do the last
|
||||
* advancement */
|
||||
keep_adv = adv;
|
||||
}
|
||||
EVAS_FONT_WALK_TEXT_END();
|
||||
|
||||
if (v_adv) *v_adv = evas_common_font_get_line_advance(fn);
|
||||
if (h_adv) *h_adv = pen_x + keep_adv;
|
||||
if (h_adv) *h_adv = pen_x;
|
||||
evas_common_font_int_use_trim();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue