From 2feef16cdeba069a11f76eb070a8d78f4a211cb6 Mon Sep 17 00:00:00 2001 From: tasn Date: Sun, 30 Jan 2011 10:37:05 +0000 Subject: [PATCH] Evas font engine: Fixed a couple of issues: 1. Fixed double-kerning with the DEFAULT walker. 2. Removed unused var with the OT walker. 3. Fixed a bit of the documentation in the walkers. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@56459 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/engines/common/evas_font_default_walk.x | 44 ++++++++++--------------- src/lib/engines/common/evas_font_ot_walk.x | 31 +++++------------ 2 files changed, 26 insertions(+), 49 deletions(-) diff --git a/src/lib/engines/common/evas_font_default_walk.x b/src/lib/engines/common/evas_font_default_walk.x index bd63255..1d1402b 100644 --- a/src/lib/engines/common/evas_font_default_walk.x +++ b/src/lib/engines/common/evas_font_default_walk.x @@ -5,9 +5,9 @@ /** * @def EVAS_FONT_UPDATE_KERN() * @internal - * This macro updates pen_x and kern according to kerning. + * This macro updates kern according to kerning. * This macro assumes the following variables exist: - * intl_props, char_index, adv, fi, kern, pen_x + * intl_props, char_index, fi, kern, index, prev_index */ #ifdef BIDI_SUPPORT #define EVAS_FONT_UPDATE_KERN(is_visual) \ @@ -20,13 +20,13 @@ if (intl_props && (intl_props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) && \ visible && !is_visual) \ { \ - if (evas_common_font_query_kerning(fi, index, prev_index, &kern)) \ - pen_x += kern; \ + if (!evas_common_font_query_kerning(fi, index, prev_index, &kern)) \ + kern = 0; \ } \ else \ { \ - if (evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ - pen_x += kern; \ + if (!evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ + kern = 0; \ } \ } \ while (0) @@ -35,8 +35,8 @@ do \ { \ (void) is_visual; \ - if (evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ - pen_x += kern; \ + if (!evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ + kern = 0; \ } \ while (0) #endif @@ -44,19 +44,14 @@ /** * @def EVAS_FONT_WALK_DEFAULT_TEXT_VISUAL_START * @internal - * This runs through the variable text while updating char_index, - * which is the current index in the text. This macro exposes (inside - * the loop) the following vars: - * adv - advancement - * _gl - the current unicode code point - * bear_x, bear_y, width - info about the bitmap - * pen_x, pen_y - (also available outside of the loop, but updated here) - * fg - the font glyph. - * index, prev_index - font indexes. + * This runs through the text in visual order while updating char_index, + * which is the current index in the text. * Does not end with a ; + * Take a look at EVAS_FONT_WALK_DEFAULT_X_OFF and the like. * @see EVAS_FONT_WALK_DEFAULT_TEXT_INIT * @see EVAS_FONT_WALK_DEFAULT_TEXT_WORK * @see EVAS_FONT_WALK_DEFAULT_TEXT_END + * @see EVAS_FONT_WALK_DEFAULT_TEXT_LOGICAL_START */ #define EVAS_FONT_WALK_DEFAULT_TEXT_VISUAL_START() \ do \ @@ -87,23 +82,18 @@ int _gl, kern; \ _gl = *text; \ if (_gl == 0) break; + /** * @def EVAS_FONT_WALK_DEFAULT_TEXT_LOGICAL_START * @internal - * FIXME: update - * This runs through the variable text while updating char_index, - * which is the current index in the text. This macro exposes (inside - * the loop) the following vars: - * adv - advancement - * _gl - the current unicode code point - * bear_x, bear_y, width - info about the bitmap - * pen_x, pen_y - (also available outside of the loop, but updated here) - * fg - the font glyph. - * index, prev_index - font indexes. + * This runs through the text in logical order while updating char_index, + * which is the current index in the text. * Does not end with a ; + * Take a look at EVAS_FONT_WALK_DEFAULT_X_OFF and the like. * @see EVAS_FONT_WALK_DEFAULT_TEXT_INIT * @see EVAS_FONT_WALK_DEFAULT_TEXT_WORK * @see EVAS_FONT_WALK_DEFAULT_TEXT_END + * @see EVAS_FONT_WALK_DEFAULT_TEXT_VISUAL_START */ #define EVAS_FONT_WALK_DEFAULT_TEXT_LOGICAL_START() \ do \ diff --git a/src/lib/engines/common/evas_font_ot_walk.x b/src/lib/engines/common/evas_font_ot_walk.x index d848e89..282dc3f 100644 --- a/src/lib/engines/common/evas_font_ot_walk.x +++ b/src/lib/engines/common/evas_font_ot_walk.x @@ -8,19 +8,14 @@ /** * @def EVAS_FONT_WALK_OT_TEXT_VISUAL_START * @internal - * This runs through the variable text while updating char_index, - * which is the current index in the text. This macro exposes (inside - * the loop) the following vars: - * adv - advancement - * gl - the current unicode code point - * bear_x, bear_y, width - info about the bitmap - * pen_x, pen_y - (also available outside of the loop, but updated here) - * fg - the font glyph. - * index, prev_index - font indexes. + * This runs through the text in visual order while updating char_index, + * which is the current index in the text. * Does not end with a ; + * Take a look at EVAS_FONT_WALK_OT_X_OFF and the like. * @see EVAS_FONT_WALK_OT_TEXT_INIT * @see EVAS_FONT_WALK_OT_TEXT_WORK * @see EVAS_FONT_WALK_OT_TEXT_END + * @see EVAS_FONT_WALK_OT_TEXT_LOGICAL_START */ #define EVAS_FONT_WALK_OT_TEXT_VISUAL_START() \ do \ @@ -34,24 +29,18 @@ { \ FT_UInt index; \ RGBA_Font_Glyph *fg; \ - int kern; \ + /** * @def EVAS_FONT_WALK_OT_TEXT_LOGICAL_START * @internal - * FIXME: not up to date - * This runs through the variable text while updating char_index, - * which is the current index in the text. This macro exposes (inside - * the loop) the following vars: - * adv - advancement - * gl - the current unicode code point - * bear_x, bear_y, width - info about the bitmap - * pen_x, pen_y - (also available outside of the loop, but updated here) - * fg - the font glyph. - * index, prev_index - font indexes. + * This runs through the text in logical order while updating char_index, + * which is the current index in the text. * Does not end with a ; + * Take a look at EVAS_FONT_WALK_OT_X_OFF and the like. * @see EVAS_FONT_WALK_OT_TEXT_INIT * @see EVAS_FONT_WALK_OT_TEXT_WORK * @see EVAS_FONT_WALK_OT_TEXT_END + * @see EVAS_FONT_WALK_OT_TEXT_VISUAL_START */ #define EVAS_FONT_WALK_OT_TEXT_LOGICAL_START() \ do \ @@ -77,7 +66,6 @@ { \ FT_UInt index; \ RGBA_Font_Glyph *fg; \ - int kern; \ /*FIXME: doc */ #define EVAS_FONT_WALK_OT_X_OFF \ @@ -130,7 +118,6 @@ LKU(fi->ft_mutex); \ continue; \ } \ - kern = 0; \ if (EVAS_FONT_CHARACTER_IS_INVISIBLE(text[EVAS_FONT_WALK_OT_POS])) \ { \ visible = 0; \ -- 2.7.4