Evas font-engine: Fixed kerning handling and fixed a bug in query_char_coords and in query_pen_coords taking the wrong string into account.

SVN revision: 56444
This commit is contained in:
Tom Hacohen 2011-01-30 10:35:24 +00:00
parent 99a7eff130
commit 01850cf816
3 changed files with 15 additions and 14 deletions

View File

@ -529,7 +529,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
if (EVAS_FONT_CHARACTER_IS_INVISIBLE(gl)) if (EVAS_FONT_CHARACTER_IS_INVISIBLE(gl))
continue; continue;
EVAS_FONT_WALK_TEXT_WORK(); EVAS_FONT_WALK_TEXT_WORK(EINA_TRUE);
if (dc->font_ext.func.gl_new) if (dc->font_ext.func.gl_new)
{ {

View File

@ -44,7 +44,7 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
* intl_props, char_index, adv, fi, kern, pen_x * intl_props, char_index, adv, fi, kern, pen_x
*/ */
#ifdef BIDI_SUPPORT #ifdef BIDI_SUPPORT
#define EVAS_FONT_UPDATE_KERN() \ #define EVAS_FONT_UPDATE_KERN(is_visual) \
do \ do \
{ \ { \
/* if it's rtl, the kerning matching should be reversed, */ \ /* if it's rtl, the kerning matching should be reversed, */ \
@ -52,7 +52,7 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
/* around. There is a slight exception when there are */ \ /* around. There is a slight exception when there are */ \
/* compositing chars involved.*/ \ /* compositing chars involved.*/ \
if (intl_props && (intl_props->dir == EVAS_BIDI_DIRECTION_RTL) && \ if (intl_props && (intl_props->dir == EVAS_BIDI_DIRECTION_RTL) && \
adv > 0) \ visible && !is_visual) \
{ \ { \
if (evas_common_font_query_kerning(fi, index, prev_index, &kern)) \ if (evas_common_font_query_kerning(fi, index, prev_index, &kern)) \
pen_x += kern; \ pen_x += kern; \
@ -65,9 +65,10 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
} \ } \
while (0) while (0)
#else #else
#define EVAS_FONT_UPDATE_KERN() \ #define EVAS_FONT_UPDATE_KERN(is_visual) \
do \ do \
{ \ { \
(void) is_visual; \
if (evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ if (evas_common_font_query_kerning(fi, prev_index, index, &kern)) \
pen_x += kern; \ pen_x += kern; \
} \ } \
@ -131,7 +132,7 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
* @see EVAS_FONT_WALK_TEXT_INIT * @see EVAS_FONT_WALK_TEXT_INIT
* @see EVAS_FONT_WALK_TEXT_END * @see EVAS_FONT_WALK_TEXT_END
*/ */
#define EVAS_FONT_WALK_TEXT_WORK() \ #define EVAS_FONT_WALK_TEXT_WORK(is_visual) \
index = evas_common_font_glyph_search(fn, &fi, gl); \ index = evas_common_font_glyph_search(fn, &fi, gl); \
LKL(fi->ft_mutex); \ LKL(fi->ft_mutex); \
fg = evas_common_font_int_cache_glyph_get(fi, index); \ fg = evas_common_font_int_cache_glyph_get(fi, index); \
@ -160,7 +161,7 @@ void evas_common_font_int_reload(RGBA_Font_Int *fi);
if ((use_kerning) && (prev_index) && (index) && \ if ((use_kerning) && (prev_index) && (index) && \
(pface == fi->src->ft.face)) \ (pface == fi->src->ft.face)) \
{ \ { \
EVAS_FONT_UPDATE_KERN(); \ EVAS_FONT_UPDATE_KERN(is_visual); \
} \ } \
\ \
pface = fi->src->ft.face; \ pface = fi->src->ft.face; \

View File

@ -148,7 +148,7 @@ evas_common_font_query_size(RGBA_Font *fn, const Eina_Unicode *text, const Evas_
EVAS_FONT_WALK_TEXT_START() EVAS_FONT_WALK_TEXT_START()
{ {
EVAS_FONT_WALK_TEXT_WORK(); EVAS_FONT_WALK_TEXT_WORK(EINA_FALSE);
/* Keep the width because we'll need it for the last char */ /* Keep the width because we'll need it for the last char */
keep_width = width + bear_x; keep_width = width + bear_x;
/* Keep the previous pen_x, before it's advanced in TEXT_END */ /* Keep the previous pen_x, before it's advanced in TEXT_END */
@ -181,7 +181,7 @@ evas_common_font_query_advance(RGBA_Font *fn, const Eina_Unicode *text, const Ev
EVAS_FONT_WALK_TEXT_START() EVAS_FONT_WALK_TEXT_START()
{ {
EVAS_FONT_WALK_TEXT_WORK(); EVAS_FONT_WALK_TEXT_WORK(EINA_FALSE);
} }
EVAS_FONT_WALK_TEXT_END(); EVAS_FONT_WALK_TEXT_END();
@ -256,7 +256,7 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const Eina_Unicode *in_text, c
else else
#endif #endif
{ {
evas_common_font_query_advance(fn, text, intl_props, cx, ch); evas_common_font_query_advance(fn, in_text, intl_props, cx, ch);
} }
if (cy) *cy = 0; if (cy) *cy = 0;
if (cw) *cw = 0; if (cw) *cw = 0;
@ -268,7 +268,7 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const Eina_Unicode *in_text, c
{ {
int chr_x, chr_y, chr_w; int chr_x, chr_y, chr_w;
EVAS_FONT_WALK_TEXT_WORK(); EVAS_FONT_WALK_TEXT_WORK(EINA_TRUE);
chr_x = (pen_x) + bear_x; chr_x = (pen_x) + bear_x;
chr_y = (pen_y) + bear_y; chr_y = (pen_y) + bear_y;
@ -362,7 +362,7 @@ evas_common_font_query_pen_coords(RGBA_Font *fn, const Eina_Unicode *in_text, co
else else
#endif #endif
{ {
evas_common_font_query_advance(fn, text, intl_props, cpen_x, ch); evas_common_font_query_advance(fn, in_text, intl_props, cpen_x, ch);
} }
if (cy) *cy = 0; if (cy) *cy = 0;
if (cadv) *cadv = 0; if (cadv) *cadv = 0;
@ -372,7 +372,7 @@ evas_common_font_query_pen_coords(RGBA_Font *fn, const Eina_Unicode *in_text, co
EVAS_FONT_WALK_TEXT_START() EVAS_FONT_WALK_TEXT_START()
{ {
EVAS_FONT_WALK_TEXT_WORK(); EVAS_FONT_WALK_TEXT_WORK(EINA_TRUE);
/* we need to see if the char at the visual position is the char wanted */ /* we need to see if the char at the visual position is the char wanted */
if (char_index == position) if (char_index == position)
{ {
@ -444,7 +444,7 @@ evas_common_font_query_char_at_coords(RGBA_Font *fn, const Eina_Unicode *in_text
{ {
int chr_x, chr_w; int chr_x, chr_w;
EVAS_FONT_WALK_TEXT_WORK(); EVAS_FONT_WALK_TEXT_WORK(EINA_TRUE);
chr_x = (pen_x) + bear_x; chr_x = (pen_x) + bear_x;
chr_w = width; chr_w = width;
@ -502,7 +502,7 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Eina_Unicode *in_text
desc = evas_common_font_max_descent_get(fn); desc = evas_common_font_max_descent_get(fn);
EVAS_FONT_WALK_TEXT_START() EVAS_FONT_WALK_TEXT_START()
{ {
EVAS_FONT_WALK_TEXT_WORK(); EVAS_FONT_WALK_TEXT_WORK(EINA_FALSE);
if ((x >= pen_x) && (x <= (pen_x + adv)) && if ((x >= pen_x) && (x <= (pen_x + adv)) &&
(y >= -asc) && (y <= desc)) (y >= -asc) && (y <= desc))