From: Enlightenment S. <no-...@en...> - 2011-01-30 10:38:14
|
Log: Evas font-ot: moved typedef to a better location (doesn't change anything but ease of understanding). Author: tasn Date: 2011-01-30 02:38:08 -0800 (Sun, 30 Jan 2011) New Revision: 56469 Trac: http://trac.enlightenment.org/e/changeset/56469 Modified: trunk/evas/src/lib/engines/common/evas_font_ot.h Modified: trunk/evas/src/lib/engines/common/evas_font_ot.h =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot.h 2011-01-30 10:38:02 UTC (rev 56468) +++ trunk/evas/src/lib/engines/common/evas_font_ot.h 2011-01-30 10:38:08 UTC (rev 56469) @@ -20,6 +20,8 @@ size_t len; Evas_Font_OT_Data_Item *items; }; +# else +typedef void *Evas_Font_OT_Data; #endif #include "Evas.h" @@ -33,8 +35,6 @@ Evas_Coord y_offset; Evas_Coord x_advance; }; -# else -typedef void *Evas_Font_OT_Data; # endif # ifdef OT_SUPPORT |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:38:40
|
Log: Evas font-engine: fixed kerning in the default walker. Author: tasn Date: 2011-01-30 02:38:33 -0800 (Sun, 30 Jan 2011) New Revision: 56473 Trac: http://trac.enlightenment.org/e/changeset/56473 Modified: trunk/evas/src/lib/engines/common/evas_font_default_walk.x Modified: trunk/evas/src/lib/engines/common/evas_font_default_walk.x =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_default_walk.x 2011-01-30 10:38:28 UTC (rev 56472) +++ trunk/evas/src/lib/engines/common/evas_font_default_walk.x 2011-01-30 10:38:33 UTC (rev 56473) @@ -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)) \ - kern = 0; \ + if (evas_common_font_query_kerning(fi, index, prev_index, &kern)) \ + pen_x += kern; \ } \ else \ { \ - if (!evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ - kern = 0; \ + if (evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ + pen_x += kern; \ } \ } \ while (0) @@ -35,8 +35,8 @@ do \ { \ (void) is_visual; \ - if (!evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ - kern = 0; \ + if (evas_common_font_query_kerning(fi, prev_index, index, &kern)) \ + pen_x += kern; \ } \ while (0) #endif @@ -109,7 +109,7 @@ if (_gl == 0) break; /*FIXME: doc */ -#define EVAS_FONT_WALK_DEFAULT_X_OFF (kern) +#define EVAS_FONT_WALK_DEFAULT_X_OFF (0) #define EVAS_FONT_WALK_DEFAULT_Y_OFF (0) #define EVAS_FONT_WALK_DEFAULT_X_BEAR (fg->glyph_out->left) #define EVAS_FONT_WALK_DEFAULT_Y_BEAR (fg->glyph_out->top) |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:39:48
|
Log: Evas font: skip over common script items when getting the font, we should get the font of the actual script items. Author: tasn Date: 2011-01-30 02:39:42 -0800 (Sun, 30 Jan 2011) New Revision: 56484 Trac: http://trac.enlightenment.org/e/changeset/56484 Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c trunk/evas/src/lib/engines/common/evas_font_ot_walk.x Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-01-30 10:39:35 UTC (rev 56483) +++ trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-01-30 10:39:42 UTC (rev 56484) @@ -162,7 +162,17 @@ fi->src->current_size = fi->size; } /* Load the font needed for this script */ - evas_common_font_glyph_search(fn, &fi, *text); + { + /* Skip common chars */ + const Eina_Unicode *tmp; + for (tmp = text ; + *tmp && + evas_common_language_char_script_get(*tmp) == EVAS_SCRIPT_COMMON ; + tmp++) + ; + if (!*tmp && (tmp > text)) tmp--; + evas_common_font_glyph_search(fn, &fi, *tmp); + } if (len < 0) { Modified: trunk/evas/src/lib/engines/common/evas_font_ot_walk.x =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot_walk.x 2011-01-30 10:39:35 UTC (rev 56483) +++ trunk/evas/src/lib/engines/common/evas_font_ot_walk.x 2011-01-30 10:39:42 UTC (rev 56484) @@ -24,7 +24,18 @@ prev_index = 0; \ /* Load the glyph according to the first letter of the script, preety * bad, but will have to do */ \ - evas_common_font_glyph_search(fn, &fi, *text); \ + { \ + /* Skip common chars */ \ + const Eina_Unicode *tmp; \ + for (tmp = text ; \ + *tmp && \ + evas_common_language_char_script_get(*tmp) == \ + EVAS_SCRIPT_COMMON ; \ + tmp++) \ + ; \ + if (!*tmp && (tmp > text)) tmp--; \ + evas_common_font_glyph_search(fn, &fi, *tmp); \ + } \ for (char_index = 0 ; char_index < intl_props->ot_data->len ; char_index++) \ { \ FT_UInt index; \ @@ -47,9 +58,19 @@ { \ int _char_index_d, _i; \ int visible; \ - /* Load the glyph according to the first letter of the script, preety - * bad, but will have to do */ \ - evas_common_font_glyph_search(fn, &fi, *text); \ + /* Load the font needed for this script */ \ + { \ + /* Skip common chars */ \ + const Eina_Unicode *tmp; \ + for (tmp = text ; \ + *tmp && \ + evas_common_language_char_script_get(*tmp) == \ + EVAS_SCRIPT_COMMON ; \ + tmp++) \ + ; \ + if (!*tmp && (tmp > text)) tmp--; \ + evas_common_font_glyph_search(fn, &fi, *tmp); \ + } \ prev_index = 0; \ _i = intl_props->ot_data->len; \ if (intl_props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) \ |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:41:46
|
Log: Evas font-engine: Fixed a puny memory leak. Author: tasn Date: 2011-01-30 02:41:35 -0800 (Sun, 30 Jan 2011) New Revision: 56503 Trac: http://trac.enlightenment.org/e/changeset/56503 Modified: trunk/evas/src/lib/engines/common/evas_font_load.c Modified: trunk/evas/src/lib/engines/common/evas_font_load.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_load.c 2011-01-30 10:41:29 UTC (rev 56502) +++ trunk/evas/src/lib/engines/common/evas_font_load.c 2011-01-30 10:41:35 UTC (rev 56503) @@ -45,6 +45,12 @@ FTLOCK(); FT_Done_Face(fs->ft.face); FTUNLOCK(); +#ifdef OT_SUPPORT + if (evas_common_font_ot_is_enabled()) + { + evas_common_font_ot_unload_face(fs); + } +#endif if (fs->name) eina_stringshare_del(fs->name); free(fs); } |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:42:03
|
Log: Evas textblock: Fixed async rendering support. Author: tasn Date: 2011-01-30 02:41:57 -0800 (Sun, 30 Jan 2011) New Revision: 56506 Trac: http://trac.enlightenment.org/e/changeset/56506 Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-01-30 10:41:49 UTC (rev 56505) +++ trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-01-30 10:41:57 UTC (rev 56506) @@ -116,22 +116,32 @@ EAPI void evas_common_font_ot_cutoff_text_props(Evas_Text_Props *props, int cutoff) { - Evas_Font_OT_Data_Item *tmp; + Evas_Font_OT_Data *new_data; if ((cutoff <= 0) || (!props->ot_data) || (((size_t) cutoff) >= props->ot_data->len)) return; + new_data = malloc(sizeof(Evas_Font_OT_Data)); + memcpy(new_data, props->ot_data, sizeof(Evas_Font_OT_Data)); + new_data->refcount = 1; + new_data->len = cutoff; + new_data->items = malloc(cutoff * sizeof(Evas_Font_OT_Data_Item)); + if (props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) { - memmove(props->ot_data->items, + memcpy(new_data->items, props->ot_data->items + (props->ot_data->len - cutoff), cutoff * sizeof(Evas_Font_OT_Data_Item)); } - tmp = realloc(props->ot_data->items, - cutoff * sizeof(Evas_Font_OT_Data_Item)); - props->ot_data->items = tmp; - props->ot_data->len = cutoff; + else + { + memcpy(new_data->items, + props->ot_data->items, + cutoff * sizeof(Evas_Font_OT_Data_Item)); + } + evas_common_font_ot_props_unref(props->ot_data); + props->ot_data = new_data; } /* Won't work in the middle of ligatures @@ -141,7 +151,7 @@ evas_common_font_ot_split_text_props(Evas_Text_Props *base, Evas_Text_Props *ext, int cutoff) { - Evas_Font_OT_Data_Item *tmp; + Evas_Font_OT_Data *new_data; int i; if ((cutoff <= 0) || (!base->ot_data) || (((size_t) cutoff) >= base->ot_data->len)) @@ -152,11 +162,18 @@ ext->ot_data->len = base->ot_data->len - cutoff; ext->ot_data->items = calloc(ext->ot_data->len, sizeof(Evas_Font_OT_Data_Item)); + + new_data = malloc(sizeof(Evas_Font_OT_Data)); + memcpy(new_data, base->ot_data, sizeof(Evas_Font_OT_Data)); + new_data->refcount = 1; + new_data->items = malloc(cutoff * sizeof(Evas_Font_OT_Data_Item)); + new_data->len = cutoff; + if (base->bidi.dir == EVAS_BIDI_DIRECTION_RTL) { memcpy(ext->ot_data->items, base->ot_data->items, ext->ot_data->len * sizeof(Evas_Font_OT_Data_Item)); - memmove(base->ot_data->items, + memcpy(new_data->items, base->ot_data->items + ext->ot_data->len, cutoff * sizeof(Evas_Font_OT_Data_Item)); } @@ -164,7 +181,11 @@ { memcpy(ext->ot_data->items, base->ot_data->items + cutoff, ext->ot_data->len * sizeof(Evas_Font_OT_Data_Item)); + memcpy(new_data->items, base->ot_data->items, + cutoff * sizeof(Evas_Font_OT_Data_Item)); } + evas_common_font_ot_props_unref(base->ot_data); + base->ot_data = new_data; /* Adjust the offset of the clusters */ { @@ -183,11 +204,6 @@ } ext->ot_data->offset = base->ot_data->offset + min; } - tmp = realloc(base->ot_data->items, - cutoff * sizeof(Evas_Font_OT_Data_Item)); - base->ot_data->items = tmp; - base->ot_data->len = cutoff; - } /* Won't work in the middle of ligatures @@ -198,32 +214,37 @@ evas_common_font_ot_merge_text_props(Evas_Text_Props *item1, const Evas_Text_Props *item2) { - Evas_Font_OT_Data_Item *tmp, *itr; /* Itr will be used for adding back + Evas_Font_OT_Data *new_data; + Evas_Font_OT_Data_Item *itr; /* Itr will be used for adding back the offsets */ size_t len; if (!item1->ot_data || !item2->ot_data) return; len = item1->ot_data->len + item2->ot_data->len; - tmp = calloc(len, sizeof(Evas_Font_OT_Data_Item)); + + new_data = malloc(sizeof(Evas_Font_OT_Data)); + memcpy(new_data, item1->ot_data, sizeof(Evas_Font_OT_Data)); + new_data->refcount = 1; + new_data->items = malloc(len * sizeof(Evas_Font_OT_Data_Item)); + new_data->len = len; if (item1->bidi.dir == EVAS_BIDI_DIRECTION_RTL) { - memcpy(tmp, item2->ot_data->items, + memcpy(new_data->items, item2->ot_data->items, item2->ot_data->len * sizeof(Evas_Font_OT_Data_Item)); - memcpy(tmp + item2->ot_data->len, item1->ot_data->items, + memcpy(new_data->items + item2->ot_data->len, item1->ot_data->items, item1->ot_data->len * sizeof(Evas_Font_OT_Data_Item)); - itr = tmp; + itr = new_data->items; } else { - memcpy(tmp, item1->ot_data->items, + memcpy(new_data->items, item1->ot_data->items, item1->ot_data->len * sizeof(Evas_Font_OT_Data_Item)); - memcpy(tmp + item1->ot_data->len, item2->ot_data->items, + memcpy(new_data->items + item1->ot_data->len, item2->ot_data->items, item2->ot_data->len * sizeof(Evas_Font_OT_Data_Item)); - itr = tmp + item1->ot_data->len; + itr = new_data->items + item1->ot_data->len; } - free(item1->ot_data->items); - item1->ot_data->items = tmp; - item1->ot_data->len = len; + evas_common_font_ot_props_unref(item1->ot_data); + item1->ot_data = new_data; /* Add back the offset of item2 to the newly created */ if (item2->ot_data->offset > 0) { |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:42:13
|
Log: Evas font-engine: Round the fractional coords (instead of floor). Author: tasn Date: 2011-01-30 02:42:07 -0800 (Sun, 30 Jan 2011) New Revision: 56508 Trac: http://trac.enlightenment.org/e/changeset/56508 Modified: trunk/evas/src/lib/engines/common/evas_font_ot_walk.x trunk/evas/src/lib/engines/common/evas_font_private.h Modified: trunk/evas/src/lib/engines/common/evas_font_ot_walk.x =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot_walk.x 2011-01-30 10:42:01 UTC (rev 56507) +++ trunk/evas/src/lib/engines/common/evas_font_ot_walk.x 2011-01-30 10:42:07 UTC (rev 56508) @@ -90,16 +90,19 @@ /*FIXME: doc */ #define EVAS_FONT_WALK_OT_X_OFF \ - (EVAS_FONT_OT_X_OFF_GET( \ - intl_props->ot_data->items[char_index]) >> 6) + (EVAS_FONT_ROUND_26_6_TO_INT( \ + EVAS_FONT_OT_X_OFF_GET( \ + intl_props->ot_data->items[char_index]))) #define EVAS_FONT_WALK_OT_Y_OFF \ - (EVAS_FONT_OT_Y_OFF_GET( \ - intl_props->ot_data->items[char_index]) >> 6) + (EVAS_FONT_ROUND_26_6_TO_INT( \ + EVAS_FONT_OT_Y_OFF_GET( \ + intl_props->ot_data->items[char_index]))) #define EVAS_FONT_WALK_OT_X_BEAR (fg->glyph_out->left) #define EVAS_FONT_WALK_OT_Y_BEAR (fg->glyph_out->top) #define EVAS_FONT_WALK_OT_X_ADV \ - (EVAS_FONT_OT_X_ADV_GET( \ - intl_props->ot_data->items[char_index]) >> 6) + (EVAS_FONT_ROUND_26_6_TO_INT( \ + EVAS_FONT_OT_X_ADV_GET( \ + intl_props->ot_data->items[char_index]))) #define EVAS_FONT_WALK_OT_WIDTH (fg->glyph_out->bitmap.width) #define EVAS_FONT_WALK_OT_POS \ (EVAS_FONT_OT_POS_GET( \ Modified: trunk/evas/src/lib/engines/common/evas_font_private.h =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_private.h 2011-01-30 10:42:01 UTC (rev 56507) +++ trunk/evas/src/lib/engines/common/evas_font_private.h 2011-01-30 10:42:07 UTC (rev 56508) @@ -37,6 +37,9 @@ # define OTUNLOCK() # endif +# define EVAS_FONT_ROUND_26_6_TO_INT(x) \ + (((0x3F & x) > 31) ? ((x >> 6) + 1) : (x >> 6)) + # define EVAS_FONT_CHARACTER_IS_INVISIBLE(x) ( \ ((0x200C <= (x)) && ((x) <= 0x200D)) || /* ZWNJ..ZWH */ \ ((0x200E <= (x)) && ((x) <= 0x200F)) || /* BIDI stuff */ \ |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:42:26
|
Log: Evas font-engine: simplify 26_6 round to int. Author: tasn Date: 2011-01-30 02:42:20 -0800 (Sun, 30 Jan 2011) New Revision: 56510 Trac: http://trac.enlightenment.org/e/changeset/56510 Modified: trunk/evas/src/lib/engines/common/evas_font_private.h Modified: trunk/evas/src/lib/engines/common/evas_font_private.h =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_private.h 2011-01-30 10:42:13 UTC (rev 56509) +++ trunk/evas/src/lib/engines/common/evas_font_private.h 2011-01-30 10:42:20 UTC (rev 56510) @@ -39,7 +39,7 @@ /* 6th bit is on is the same as frac part >= 0.5 */ # define EVAS_FONT_ROUND_26_6_TO_INT(x) \ - ((0x20 & x) ? ((x >> 6) + 1) : (x >> 6)) + (((x + 0x20) & -0x40) >> 6) # define EVAS_FONT_CHARACTER_IS_INVISIBLE(x) ( \ ((0x200C <= (x)) && ((x) <= 0x200D)) || /* ZWNJ..ZWH */ \ |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:43:40
|
Log: Evas font-engine: add a function to just ref text props. Author: tasn Date: 2011-01-30 02:43:34 -0800 (Sun, 30 Jan 2011) New Revision: 56521 Trac: http://trac.enlightenment.org/e/changeset/56521 Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c trunk/evas/src/lib/engines/common/evas_text_utils.h Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-01-30 10:43:26 UTC (rev 56520) +++ trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-01-30 10:43:34 UTC (rev 56521) @@ -31,10 +31,16 @@ const Evas_Text_Props *src) { memcpy(dst, src, sizeof(Evas_Text_Props)); + evas_common_text_props_content_ref(dst); +} + +void +evas_common_text_props_content_ref(Evas_Text_Props *props) +{ #ifdef OT_SUPPORT - if (dst->ot_data) + if (props->ot_data) { - evas_common_font_ot_props_ref(dst->ot_data); + evas_common_font_ot_props_ref(props->ot_data); } #endif } Modified: trunk/evas/src/lib/engines/common/evas_text_utils.h =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.h 2011-01-30 10:43:26 UTC (rev 56520) +++ trunk/evas/src/lib/engines/common/evas_text_utils.h 2011-01-30 10:43:34 UTC (rev 56521) @@ -27,6 +27,9 @@ const Evas_Text_Props *src); void +evas_common_text_props_content_ref(Evas_Text_Props *props); + +void evas_common_text_props_content_unref(Evas_Text_Props *props); EAPI void |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:43:56
|
Log: Evas font-engine: Fixed ot face loading when loading fonts from memory. Author: tasn Date: 2011-01-30 02:43:50 -0800 (Sun, 30 Jan 2011) New Revision: 56523 Trac: http://trac.enlightenment.org/e/changeset/56523 Modified: trunk/evas/src/lib/engines/common/evas_font_load.c Modified: trunk/evas/src/lib/engines/common/evas_font_load.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_load.c 2011-01-30 10:43:42 UTC (rev 56522) +++ trunk/evas/src/lib/engines/common/evas_font_load.c 2011-01-30 10:43:50 UTC (rev 56523) @@ -138,6 +138,12 @@ free(fs); return NULL; } +#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; fs->references = 1; |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:44:37
|
Log: Evas font-engine: Fixed query size when not using OT to take the last char's width on RTL mode, instead of the first. Author: tasn Date: 2011-01-30 02:44:31 -0800 (Sun, 30 Jan 2011) New Revision: 56529 Trac: http://trac.enlightenment.org/e/changeset/56529 Modified: trunk/evas/src/lib/engines/common/evas_font_query.c Modified: trunk/evas/src/lib/engines/common/evas_font_query.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_query.c 2011-01-30 10:44:23 UTC (rev 56528) +++ trunk/evas/src/lib/engines/common/evas_font_query.c 2011-01-30 10:44:31 UTC (rev 56529) @@ -165,7 +165,7 @@ else #endif { - EVAS_FONT_WALK_DEFAULT_TEXT_LOGICAL_START() + EVAS_FONT_WALK_DEFAULT_TEXT_VISUAL_START() { EVAS_FONT_WALK_DEFAULT_TEXT_WORK(EINA_FALSE); if (!visible) continue; |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:45:29
|
Log: Evas font: Fixed memory leak when reloading an already-loaded face. Author: tasn Date: 2011-01-30 02:45:23 -0800 (Sun, 30 Jan 2011) New Revision: 56538 Trac: http://trac.enlightenment.org/e/changeset/56538 Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-01-30 10:45:17 UTC (rev 56537) +++ trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-01-30 10:45:23 UTC (rev 56538) @@ -89,6 +89,8 @@ evas_common_font_ot_load_face(void *_font) { RGBA_Font_Source *font = (RGBA_Font_Source *) _font; + /* Unload the face if by any chance it's already loaded */ + evas_common_font_ot_unload_face(font); font->hb.face = hb_ft_face_create(font->ft.face, NULL); } |
From: Enlightenment S. <no-...@en...> - 2011-01-30 10:46:03
|
Log: Evas font: Fix indentation. Author: tasn Date: 2011-01-30 02:45:56 -0800 (Sun, 30 Jan 2011) New Revision: 56544 Trac: http://trac.enlightenment.org/e/changeset/56544 Modified: trunk/evas/src/lib/engines/common/evas_font_ot.h Modified: trunk/evas/src/lib/engines/common/evas_font_ot.h =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot.h 2011-01-30 10:45:51 UTC (rev 56543) +++ trunk/evas/src/lib/engines/common/evas_font_ot.h 2011-01-30 10:45:56 UTC (rev 56544) @@ -11,7 +11,7 @@ # endif # ifdef OT_SUPPORT -#include <stdlib.h> +# include <stdlib.h> typedef struct _Evas_Font_OT_Data Evas_Font_OT_Data; typedef struct _Evas_Font_OT_Data_Item Evas_Font_OT_Data_Item; struct _Evas_Font_OT_Data @@ -24,11 +24,11 @@ }; # else typedef void *Evas_Font_OT_Data; -#endif +# endif -#include "Evas.h" +# include "Evas.h" -#ifdef OT_SUPPORT +# ifdef OT_SUPPORT struct _Evas_Font_OT_Data_Item { unsigned int index; /* Should conform to FT */ @@ -46,7 +46,7 @@ //# define EVAS_FONT_OT_Y_ADV_GET(a) ((a).y_advance) # define EVAS_FONT_OT_INDEX_GET(a) ((a).index) # define EVAS_FONT_OT_POS_GET(a) ((a).source_cluster) -#else +# else # define EVAS_FONT_OT_X_OFF_GET(a) (0) # define EVAS_FONT_OT_Y_OFF_GET(a) (0) # define EVAS_FONT_OT_X_ADV_GET(a) (0) @@ -70,7 +70,7 @@ EAPI void evas_common_font_ot_unload_face(void *_font); -#include "evas_text_utils.h" +# 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); |
From: Enlightenment S. <no-...@en...> - 2011-01-30 13:55:18
|
Log: Snap 2 Author: tasn Date: 2011-01-30 05:55:12 -0800 (Sun, 30 Jan 2011) New Revision: 56553 Trac: http://trac.enlightenment.org/e/changeset/56553 Modified: trunk/evas/src/lib/engines/common/evas_font_default_walk.x trunk/evas/src/lib/engines/common/evas_font_draw.c trunk/evas/src/lib/engines/common/evas_font_query.c Modified: trunk/evas/src/lib/engines/common/evas_font_default_walk.x =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_default_walk.x 2011-01-30 13:55:04 UTC (rev 56552) +++ trunk/evas/src/lib/engines/common/evas_font_default_walk.x 2011-01-30 13:55:12 UTC (rev 56553) @@ -32,7 +32,7 @@ do \ { \ int visible = 1; \ - for (char_index = 0 ; char_index < text_props->len ; char_index++) \ + for (char_index = text_props->start ; char_index < text_props->start + text_props->len ; char_index++) \ { /** @@ -64,7 +64,9 @@ char_index = 0; \ _char_index_d = 1; \ } \ - for ( ; _i > 0 ; char_index += _char_index_d, _i--) \ + char_index += text_props->start; \ + _i += text_props->start; \ + for ( ; _i > text_props->start ; char_index += _char_index_d, _i--) \ { #else #define EVAS_FONT_WALK_TEXT_LOGICAL_START() EVAS_FONT_WALK_TEXT_VISUAL_START() @@ -131,7 +133,7 @@ #define EVAS_FONT_WALK_PEN_Y (EVAS_FONT_ROUND_26_6_TO_INT(_pen_y)) #define EVAS_FONT_WALK_Y_ADV (0) #define EVAS_FONT_WALK_IS_LAST \ - (char_index + 1 == text_props->len) + (char_index + 1 == text_props->start + text_props->len) #define EVAS_FONT_WALK_IS_FIRST \ (!char_index) #define EVAS_FONT_WALK_LEN (text_props->len) Modified: trunk/evas/src/lib/engines/common/evas_font_draw.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_draw.c 2011-01-30 13:55:04 UTC (rev 56552) +++ trunk/evas/src/lib/engines/common/evas_font_draw.c 2011-01-30 13:55:12 UTC (rev 56553) @@ -535,7 +535,7 @@ LKU(fi->ft_mutex); continue; } - if (EVAS_FONT_CHARACTER_IS_INVISIBLE(text[EVAS_FONT_WALK_POS])) + if (EVAS_FONT_CHARACTER_IS_INVISIBLE(text[EVAS_FONT_WALK_POS - text_props->start])) { visible = 0; } Modified: trunk/evas/src/lib/engines/common/evas_font_query.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_query.c 2011-01-30 13:55:04 UTC (rev 56552) +++ trunk/evas/src/lib/engines/common/evas_font_query.c 2011-01-30 13:55:12 UTC (rev 56553) @@ -202,6 +202,7 @@ goto end; } + position += text_props->start; Evas_Coord cluster_start, last_end; int prev_cluster = -1; int found = 0, items = 1, item_pos = 1; @@ -335,6 +336,7 @@ int prev_cluster = -1; int found = 0, items = 1, item_pos = 1; int last_is_visible = 1; + position += text_props->start; EVAS_FONT_WALK_TEXT_VISUAL_START() { EVAS_FONT_WALK_TEXT_WORK(); @@ -496,7 +498,7 @@ } end: - return ret_val; + return ret_val - text_props->start; } /* position of the char after the last char in the text that will fit in xy. @@ -507,7 +509,7 @@ */ EAPI int -evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Eina_Unicode *in_text, const Evas_Text_Props *text_props __UNUSED__, int x, int y) +evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Eina_Unicode *in_text, const Evas_Text_Props *text_props, int x, int y) { int asc, desc; int ret=-1; @@ -532,6 +534,6 @@ end: - return ret; + return ret - text_props->start; } |
From: Enlightenment S. <no-...@en...> - 2011-01-30 13:58:02
|
Log: Revert "Snap 2" - didn't mean to commit it. :( This reverts commit 66c113787b440a282b6cc2cab6d35f5c700627f4. Author: tasn Date: 2011-01-30 05:57:55 -0800 (Sun, 30 Jan 2011) New Revision: 56555 Trac: http://trac.enlightenment.org/e/changeset/56555 Modified: trunk/evas/src/lib/engines/common/evas_font_default_walk.x trunk/evas/src/lib/engines/common/evas_font_draw.c trunk/evas/src/lib/engines/common/evas_font_query.c Modified: trunk/evas/src/lib/engines/common/evas_font_default_walk.x =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_default_walk.x 2011-01-30 13:55:16 UTC (rev 56554) +++ trunk/evas/src/lib/engines/common/evas_font_default_walk.x 2011-01-30 13:57:55 UTC (rev 56555) @@ -32,7 +32,7 @@ do \ { \ int visible = 1; \ - for (char_index = text_props->start ; char_index < text_props->start + text_props->len ; char_index++) \ + for (char_index = 0 ; char_index < text_props->len ; char_index++) \ { /** @@ -64,9 +64,7 @@ char_index = 0; \ _char_index_d = 1; \ } \ - char_index += text_props->start; \ - _i += text_props->start; \ - for ( ; _i > text_props->start ; char_index += _char_index_d, _i--) \ + for ( ; _i > 0 ; char_index += _char_index_d, _i--) \ { #else #define EVAS_FONT_WALK_TEXT_LOGICAL_START() EVAS_FONT_WALK_TEXT_VISUAL_START() @@ -133,7 +131,7 @@ #define EVAS_FONT_WALK_PEN_Y (EVAS_FONT_ROUND_26_6_TO_INT(_pen_y)) #define EVAS_FONT_WALK_Y_ADV (0) #define EVAS_FONT_WALK_IS_LAST \ - (char_index + 1 == text_props->start + text_props->len) + (char_index + 1 == text_props->len) #define EVAS_FONT_WALK_IS_FIRST \ (!char_index) #define EVAS_FONT_WALK_LEN (text_props->len) Modified: trunk/evas/src/lib/engines/common/evas_font_draw.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_draw.c 2011-01-30 13:55:16 UTC (rev 56554) +++ trunk/evas/src/lib/engines/common/evas_font_draw.c 2011-01-30 13:57:55 UTC (rev 56555) @@ -535,7 +535,7 @@ LKU(fi->ft_mutex); continue; } - if (EVAS_FONT_CHARACTER_IS_INVISIBLE(text[EVAS_FONT_WALK_POS - text_props->start])) + if (EVAS_FONT_CHARACTER_IS_INVISIBLE(text[EVAS_FONT_WALK_POS])) { visible = 0; } Modified: trunk/evas/src/lib/engines/common/evas_font_query.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_query.c 2011-01-30 13:55:16 UTC (rev 56554) +++ trunk/evas/src/lib/engines/common/evas_font_query.c 2011-01-30 13:57:55 UTC (rev 56555) @@ -202,7 +202,6 @@ goto end; } - position += text_props->start; Evas_Coord cluster_start, last_end; int prev_cluster = -1; int found = 0, items = 1, item_pos = 1; @@ -336,7 +335,6 @@ int prev_cluster = -1; int found = 0, items = 1, item_pos = 1; int last_is_visible = 1; - position += text_props->start; EVAS_FONT_WALK_TEXT_VISUAL_START() { EVAS_FONT_WALK_TEXT_WORK(); @@ -498,7 +496,7 @@ } end: - return ret_val - text_props->start; + return ret_val; } /* position of the char after the last char in the text that will fit in xy. @@ -509,7 +507,7 @@ */ EAPI int -evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Eina_Unicode *in_text, const Evas_Text_Props *text_props, int x, int y) +evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Eina_Unicode *in_text, const Evas_Text_Props *text_props __UNUSED__, int x, int y) { int asc, desc; int ret=-1; @@ -534,6 +532,6 @@ end: - return ret - text_props->start; + return ret; } |
From: Enlightenment S. <no-...@en...> - 2011-02-01 12:18:07
|
Log: Evas font: Fixed word_prerender now that we cache everything. Do we really need it now?. Author: tasn Date: 2011-02-01 04:18:01 -0800 (Tue, 01 Feb 2011) New Revision: 56630 Trac: http://trac.enlightenment.org/e/changeset/56630 Modified: trunk/evas/src/lib/engines/common/evas_font_draw.c Modified: trunk/evas/src/lib/engines/common/evas_font_draw.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_draw.c 2011-02-01 12:17:52 UTC (rev 56629) +++ trunk/evas/src/lib/engines/common/evas_font_draw.c 2011-02-01 12:18:01 UTC (rev 56630) @@ -776,7 +776,7 @@ /* Only used if cache is on */ #if defined(METRIC_CACHE) || defined(WORD_CACHE) struct prword * -evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, const Evas_Text_Props *text_props, int len, RGBA_Font *fn, RGBA_Font_Int *fi,int use_kerning) +evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, const Evas_Text_Props *text_props, int len, RGBA_Font *fn, RGBA_Font_Int *fi,int use_kerning __UNUSED__) { struct cinfo *metrics; const Eina_Unicode *text = in_text; @@ -809,6 +809,20 @@ gl = dc->font_ext.func.gl_new ? 1: 0; above = 0; below = 0; baseline = 0; height = 0; descent = 0; + /* Load the glyph according to the first letter of the script, preety + * bad, but will have to do */ + { + /* Skip common chars */ + const Eina_Unicode *tmp; + for (tmp = text ; + *tmp && + evas_common_language_char_script_get(*tmp) == + EVAS_SCRIPT_COMMON ; + tmp++) + ; + if (!*tmp && (tmp > text)) tmp--; + evas_common_font_glyph_search(fn, &fi, *tmp); + } /* First pass: Work out how big and populate */ /* It's a bit hackish to use index and fg here as they are internal, @@ -818,7 +832,26 @@ EVAS_FONT_WALK_TEXT_VISUAL_START() { struct cinfo *ci = metrics + char_index; - EVAS_FONT_WALK_TEXT_WORK(EINA_FALSE); + FT_UInt index; + RGBA_Font_Glyph *fg; +#ifdef OT_SUPPORT + index = text_props->info->glyph[char_index].index; +#else + /* FIXME: Should be removed once we split according to script without + * the use of harfbuzz */ + index = + evas_common_font_glyph_search(fn, &fi, text[EVAS_FONT_WALK_POS]); +#endif + LKL(fi->ft_mutex); + fg = evas_common_font_int_cache_glyph_get(fi, index); + if (!fg) + { + LKU(fi->ft_mutex); + continue; + } + + LKU(fi->ft_mutex); + EVAS_FONT_WALK_TEXT_WORK(); /* Currently broken with invisible chars if (!EVAS_FONT_WALK_IS_VISIBLE) continue; */ ci->index = index; ci->fg = fg; @@ -837,8 +870,8 @@ below = ci->bm.rows - ci->bm.h; if (below > descent) descent = below; if (above > baseline) baseline = above; - ci->pos.x = EVAS_FONT_WALK_PEN_X + ci->fg->glyph_out->left; - ci->pos.y = EVAS_FONT_WALK_PEN_Y + ci->fg->glyph_out->top; + ci->pos.x = EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR; + ci->pos.y = EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR; last_delta = EVAS_FONT_WALK_X_ADV - (ci->bm.w + ci->fg->glyph_out->left); } |
From: Enlightenment S. <no-...@en...> - 2011-02-02 08:25:05
|
Log: Evas font-ot: Started using our glyph and kerning caches when using Harfbuzz - Major speedups (obviously, only with harfbuzz). Author: tasn Date: 2011-02-02 00:24:57 -0800 (Wed, 02 Feb 2011) New Revision: 56644 Trac: http://trac.enlightenment.org/e/changeset/56644 Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-02-02 06:49:53 UTC (rev 56643) +++ trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-02-02 08:24:57 UTC (rev 56644) @@ -87,14 +87,105 @@ font->hb.face = NULL; } +/* Harfbuzz font functions */ +static hb_font_funcs_t *_ft_font_funcs = NULL; + +static hb_codepoint_t +_evas_common_font_ot_hb_get_glyph(hb_font_t *font, hb_face_t *face, + const void *user_data, hb_codepoint_t unicode, + hb_codepoint_t variation_selector) +{ + RGBA_Font_Int *fi = (RGBA_Font_Int *) user_data; + return hb_font_funcs_get_glyph_func(_ft_font_funcs)(font, face, + fi->src->ft.face, unicode, variation_selector); +} + static void -_evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Source *src) +_evas_common_font_ot_hb_get_glyph_advance(hb_font_t *font, hb_face_t *face, + const void *user_data, hb_codepoint_t glyph, + hb_position_t *x_advance, hb_position_t *y_advance) { + /* Use our cache*/ + RGBA_Font_Int *fi = (RGBA_Font_Int *) user_data; + RGBA_Font_Glyph *fg; + (void) font; + (void) face; + fg = evas_common_font_int_cache_glyph_get(fi, glyph); + if (fg) + { + *x_advance = fg->glyph->advance.x >> 10; + *y_advance = fg->glyph->advance.y >> 10; + } +} + +static void +_evas_common_font_ot_hb_get_glyph_extents(hb_font_t *font, hb_face_t *face, + const void *user_data, hb_codepoint_t glyph, hb_glyph_extents_t *extents) +{ + RGBA_Font_Int *fi = (RGBA_Font_Int *) user_data; + hb_font_funcs_get_glyph_extents_func(_ft_font_funcs)(font, face, + fi->src->ft.face, glyph, extents); +} + +static hb_bool_t +_evas_common_font_ot_hb_get_contour_point(hb_font_t *font, hb_face_t *face, + const void *user_data, unsigned int point_index, hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y) +{ + RGBA_Font_Int *fi = (RGBA_Font_Int *) user_data; + return hb_font_funcs_get_contour_point_func(_ft_font_funcs)(font, face, + fi->src->ft.face, point_index, glyph, x, y); +} + +static hb_position_t +_evas_common_font_ot_hb_get_kerning(hb_font_t *font, hb_face_t *face, + const void *user_data, hb_codepoint_t first_glyph, + hb_codepoint_t second_glyph) +{ + RGBA_Font_Int *fi = (RGBA_Font_Int *) user_data; + int kern; + (void) font; + (void) face; + if (evas_common_font_query_kerning(fi, first_glyph, second_glyph, &kern)) + return kern; + else + return 0; +} + +/* End of harfbuzz font funcs */ + +static hb_font_funcs_t * +_evas_common_font_ot_font_funcs_get(void) +{ + static hb_font_funcs_t *font_funcs = NULL; + if (!font_funcs) + { + _ft_font_funcs = hb_ft_get_font_funcs(); + font_funcs = hb_font_funcs_create(); + hb_font_funcs_set_glyph_func(font_funcs, + _evas_common_font_ot_hb_get_glyph); + hb_font_funcs_set_glyph_advance_func(font_funcs, + _evas_common_font_ot_hb_get_glyph_advance); + hb_font_funcs_set_glyph_extents_func(font_funcs, + _evas_common_font_ot_hb_get_glyph_extents); + hb_font_funcs_set_contour_point_func(font_funcs, + _evas_common_font_ot_hb_get_contour_point); + hb_font_funcs_set_kerning_func(font_funcs, + _evas_common_font_ot_hb_get_kerning); + } + + return font_funcs; +} + +static void +_evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Int *fi) +{ hb_font_t *hb_font; - hb_font = hb_ft_font_create(src->ft.face, NULL); + hb_font = hb_ft_font_create(fi->src->ft.face, NULL); + hb_font_set_funcs(hb_font, _evas_common_font_ot_font_funcs_get(), NULL, fi); - hb_shape(hb_font, src->hb.face, buffer, NULL, 0); + hb_shape(hb_font, fi->src->hb.face, buffer, NULL, 0); hb_font_destroy(hb_font); } @@ -152,7 +243,7 @@ /* 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); + _evas_common_font_ot_shape(buffer, fi); props->len = hb_buffer_get_length(buffer); props->info->ot = calloc(props->len, |
From: Enlightenment S. <no-...@en...> - 2011-02-06 08:31:53
|
Log: Evas font-engine: Don't ref/unref info if len==0 because in this case there's no 'info' but the text prop is legal (empty string). Author: tasn Date: 2011-02-06 00:31:46 -0800 (Sun, 06 Feb 2011) New Revision: 56746 Trac: http://trac.enlightenment.org/e/changeset/56746 Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-06 02:04:37 UTC (rev 56745) +++ trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-06 08:31:46 UTC (rev 56746) @@ -39,23 +39,20 @@ void evas_common_text_props_content_ref(Evas_Text_Props *props) { + /* No info in this case */ + if (props->len == 0) + return; + props->info->refcount++; } void evas_common_text_props_content_unref(Evas_Text_Props *props) { - /* We allow this, because sometimes we want to have props without info, - * and we don't want to diverge the code paths too much. */ - if (!props->info) - return; + /* No info in this case */ + if (props->len == 0) + return; - if (props->info->refcount == 0) - { - ERR("Trying to unref props with refount == 0"); - return; - } - if (--(props->info->refcount) == 0) { if (props->info->glyph) @@ -69,7 +66,7 @@ } } -/* Won't work in the middle of ligatures */ +/* Won't work in the middle of ligatures, assumes cutoff < len */ EAPI void evas_common_text_props_split(Evas_Text_Props *base, Evas_Text_Props *ext, int cutoff) |
From: Enlightenment S. <no-...@en...> - 2011-02-08 08:13:14
|
Log: Evas font-engine: Fixed the issue of text not showing when using pipe-rendering. For some reason I put the parameters as "src, dst" instead of "dst, src" and I also missed the compilation warning about the passing const as non-const. Author: tasn Date: 2011-02-08 00:12:55 -0800 (Tue, 08 Feb 2011) New Revision: 56796 Trac: http://trac.enlightenment.org/e/changeset/56796 Modified: trunk/evas/src/lib/engines/common/evas_pipe.c Modified: trunk/evas/src/lib/engines/common/evas_pipe.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_pipe.c 2011-02-08 02:51:40 UTC (rev 56795) +++ trunk/evas/src/lib/engines/common/evas_pipe.c 2011-02-08 08:12:55 UTC (rev 56796) @@ -1238,8 +1238,8 @@ op->op.text.x = x; op->op.text.y = y; op->op.text.text = eina_unicode_strdup(text); - evas_common_text_props_content_copy_and_ref(intl_props, - &(op->op.text.intl_props)); + evas_common_text_props_content_copy_and_ref(&(op->op.text.intl_props), + intl_props); #ifdef EVAS_FRAME_QUEUING LKL(fn->ref_fq_add); fn->ref_fq[0]++; |
From: Enlightenment S. <no-...@en...> - 2011-02-08 13:22:18
|
Log: Evas encoding: Improved evas_common_encoding_utf8_get_len to be more consistent with evas_common_encoding_utf8_get_next. This is a semi fix to the issue with malformed utf8 strings (#670) Author: tasn Date: 2011-02-08 05:22:10 -0800 (Tue, 08 Feb 2011) New Revision: 56806 Trac: http://trac.enlightenment.org/e/changeset/56806 Modified: trunk/evas/src/lib/engines/common/evas_encoding.c Modified: trunk/evas/src/lib/engines/common/evas_encoding.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_encoding.c 2011-02-08 12:10:58 UTC (rev 56805) +++ trunk/evas/src/lib/engines/common/evas_encoding.c 2011-02-08 13:22:10 UTC (rev 56806) @@ -236,14 +236,11 @@ evas_common_encoding_utf8_get_len(const char *buf) { /* returns the number of utf8 characters (not bytes) in the string */ - int index = 0, len = 0; + int i = 0, len = 0; - while (buf[index]) - { - if ((buf[index] & 0xc0) != 0x80) - len++; - index++; - } + while (evas_common_encoding_utf8_get_next(buf, &i)) + len++; + return len; } |
From: Enlightenment S. <no-...@en...> - 2011-02-08 15:23:30
|
Log: Evas font-query: Fixed compilation warnings. Cedric's compiler doesn't trust me like me compiler trusts me. Author: tasn Date: 2011-02-08 07:23:22 -0800 (Tue, 08 Feb 2011) New Revision: 56813 Trac: http://trac.enlightenment.org/e/changeset/56813 Modified: trunk/evas/src/lib/engines/common/evas_font_query.c Modified: trunk/evas/src/lib/engines/common/evas_font_query.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_query.c 2011-02-08 14:13:21 UTC (rev 56812) +++ trunk/evas/src/lib/engines/common/evas_font_query.c 2011-02-08 15:23:22 UTC (rev 56813) @@ -202,10 +202,10 @@ goto end; } - Evas_Coord cluster_start, last_end; + Evas_Coord cluster_start = 0, last_end = 0; int prev_cluster = -1; int found = 0, items = 1, item_pos = 1; - int last_is_visible; + int last_is_visible = 0; EVAS_FONT_WALK_TEXT_VISUAL_START() { EVAS_FONT_WALK_TEXT_WORK(); @@ -325,10 +325,10 @@ ret_val = 1; goto end; } - Evas_Coord cluster_start; + Evas_Coord cluster_start = 0; int prev_cluster = -1; int found = 0, items = 1, item_pos = 1; - int last_is_visible = 1; + int last_is_visible = 0; EVAS_FONT_WALK_TEXT_VISUAL_START() { EVAS_FONT_WALK_TEXT_WORK(); @@ -417,7 +417,7 @@ asc = evas_common_font_max_ascent_get(fn); desc = evas_common_font_max_descent_get(fn); - Evas_Coord cluster_start; + Evas_Coord cluster_start = 0; int prev_cluster = -1; int found = 0, items = 1; EVAS_FONT_WALK_TEXT_VISUAL_START() |
From: Enlightenment S. <no-...@en...> - 2011-02-10 15:02:33
|
Log: Evas text_utils: fixed a bug with splitting. Cutoff is the position in the string, not in the string object. Author: tasn Date: 2011-02-10 07:02:26 -0800 (Thu, 10 Feb 2011) New Revision: 56920 Trac: http://trac.enlightenment.org/e/changeset/56920 Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-10 14:41:36 UTC (rev 56919) +++ trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-10 15:02:26 UTC (rev 56920) @@ -69,8 +69,53 @@ /* Won't work in the middle of ligatures, assumes cutoff < len */ EAPI void evas_common_text_props_split(Evas_Text_Props *base, - Evas_Text_Props *ext, int cutoff) + Evas_Text_Props *ext, int _cutoff) { + size_t cutoff; + + /* Translate text cutoff pos to string object cutoff point */ +#ifdef OT_SUPPORT + cutoff = 0; + + { + Evas_Font_OT_Info *itr; + size_t i; + itr = base->info->ot + base->start; + _cutoff += base->text_offset; + /* FIXME: can I binary search? I don't think this is always sorted */ + for (i = 0 ; i < base->len ; i++, itr++) + { + if (itr->source_cluster == (size_t) _cutoff) + { + if (base->bidi.dir == EVAS_BIDI_DIRECTION_RTL) + { + /* Walk to the last one of the same cluster */ + for ( ; i < base->len ; i++, itr++) + { + if (itr->source_cluster != (size_t) _cutoff) + break; + } + cutoff = base->len - i; + } + else + { + cutoff = i; + } + break; + } + } + } + + /* If we didn't find a reasonable cut location, return. */ + if (cutoff == 0) + { + ERR("Couldn't find the cutoff position."); + return; + } +#else + cutoff = (size_t) _cutoff; +#endif + evas_common_text_props_content_copy_and_ref(ext, base); if (base->bidi.dir == EVAS_BIDI_DIRECTION_RTL) { |
From: Enlightenment S. <no-...@en...> - 2011-02-10 15:29:19
|
Log: Evas text_utils: make the text_props_content_ref/unref more robust. Don't allocate a text info if the length is 0. No point in that because content won't be allocated anyway. Author: tasn Date: 2011-02-10 07:29:13 -0800 (Thu, 10 Feb 2011) New Revision: 56924 Trac: http://trac.enlightenment.org/e/changeset/56924 Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-10 15:13:09 UTC (rev 56923) +++ trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-10 15:29:13 UTC (rev 56924) @@ -39,8 +39,8 @@ void evas_common_text_props_content_ref(Evas_Text_Props *props) { - /* No info in this case */ - if (props->len == 0) + /* No content in this case */ + if (!props->info) return; props->info->refcount++; @@ -49,8 +49,8 @@ void evas_common_text_props_content_unref(Evas_Text_Props *props) { - /* No info in this case */ - if (props->len == 0) + /* No content in this case */ + if (!props->info) return; if (--(props->info->refcount) == 0) @@ -175,6 +175,11 @@ { 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)); fi = fn->fonts->data; |
From: Enlightenment S. <no-...@en...> - 2011-02-13 12:57:43
|
Log: Evas font-engine: Added text_len to text_props which fixes a bug with cursor position and ligatures. Author: tasn Date: 2011-02-13 04:57:37 -0800 (Sun, 13 Feb 2011) New Revision: 56983 Trac: http://trac.enlightenment.org/e/changeset/56983 Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c trunk/evas/src/lib/engines/common/evas_font_query.c trunk/evas/src/lib/engines/common/evas_text_utils.c trunk/evas/src/lib/engines/common/evas_text_utils.h Modified: trunk/evas/src/lib/engines/common/evas_font_ot.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-02-13 11:23:37 UTC (rev 56982) +++ trunk/evas/src/lib/engines/common/evas_font_ot.c 2011-02-13 12:57:37 UTC (rev 56983) @@ -31,10 +31,6 @@ i++) ; right_bound = i; - if (left_bound < 0) - left_bound = 0; - if (right_bound >= (int) (props->start + props->len)) - right_bound = props->start + props->len - 1; if (right_bound == left_bound) { @@ -44,26 +40,22 @@ { if (left_bound < 0) { - items = props->start + props->len - - props->info->ot[left_bound + 1].source_cluster; + items = props->text_offset + props->text_len - base_cluster; } else { - items = props->info->ot[left_bound].source_cluster - - props->info->ot[left_bound + 1].source_cluster; + items = props->info->ot[left_bound].source_cluster - base_cluster; } } else { - if (right_bound == (int) (props->start + props->len)) + if (right_bound > (int) (props->text_offset + props->text_len)) { - items = props->start + props->len - - props->info->ot[right_bound - 1].source_cluster; + items = props->text_offset + props->text_len - base_cluster; } else { - items = props->info->ot[right_bound].source_cluster - - props->info->ot[right_bound - 1].source_cluster; + items = props->info->ot[right_bound].source_cluster - base_cluster; } } return (items > 0) ? items : 1; Modified: trunk/evas/src/lib/engines/common/evas_font_query.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_query.c 2011-02-13 11:23:37 UTC (rev 56982) +++ trunk/evas/src/lib/engines/common/evas_font_query.c 2011-02-13 12:57:37 UTC (rev 56983) @@ -143,7 +143,7 @@ position = pos; /* If it's the null, choose location according to the direction. */ - if (text_props->len == position) + if (position == text_props->text_len) { /* if it's rtl then the location is the left of the string, * otherwise, the right. */ @@ -267,7 +267,7 @@ position = pos; /* If it's the null, choose location according to the direction. */ - if (text_props->len == position) + if (position == text_props->text_len) { /* if it's rtl then the location is the left of the string, * otherwise, the right. */ Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-13 11:23:37 UTC (rev 56982) +++ trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-13 12:57:37 UTC (rev 56983) @@ -143,6 +143,8 @@ ext->text_offset = base->text_offset + base->len; #endif } + ext->text_len = base->text_len - (ext->text_offset - base->text_offset); + base->text_len = (ext->text_offset - base->text_offset); } /* Won't work in the middle of ligatures */ @@ -161,6 +163,7 @@ } item1->len += item2->len; + item1->text_len += item2->text_len; } EAPI Eina_Bool @@ -325,6 +328,7 @@ } text_props->len = len; #endif + text_props->text_len = len; text_props->info->refcount = 1; return EINA_TRUE; } Modified: trunk/evas/src/lib/engines/common/evas_text_utils.h =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.h 2011-02-13 11:23:37 UTC (rev 56982) +++ trunk/evas/src/lib/engines/common/evas_text_utils.h 2011-02-13 12:57:37 UTC (rev 56983) @@ -16,6 +16,7 @@ size_t start; size_t len; size_t text_offset; /* The text offset from the start of the info */ + size_t text_len; /* The length of the original text */ Evas_BiDi_Props bidi; Evas_Script_Type script; Evas_Text_Props_Info *info; |
From: Enlightenment S. <no-...@en...> - 2011-02-13 13:07:43
|
Log: Evas textblock: Improved error message. Author: tasn Date: 2011-02-13 05:07:37 -0800 (Sun, 13 Feb 2011) New Revision: 56984 Trac: http://trac.enlightenment.org/e/changeset/56984 Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c Modified: trunk/evas/src/lib/engines/common/evas_text_utils.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-13 12:57:37 UTC (rev 56983) +++ trunk/evas/src/lib/engines/common/evas_text_utils.c 2011-02-13 13:07:37 UTC (rev 56984) @@ -109,7 +109,7 @@ /* If we didn't find a reasonable cut location, return. */ if (cutoff == 0) { - ERR("Couldn't find the cutoff position."); + ERR("Couldn't find the cutoff position. Is it inside a cluster?"); return; } #else |
From: Enlightenment S. <no-...@en...> - 2011-02-13 16:35:10
|
Log: Evas font: removed an obsolete comment. Author: tasn Date: 2011-02-13 08:35:03 -0800 (Sun, 13 Feb 2011) New Revision: 56989 Trac: http://trac.enlightenment.org/e/changeset/56989 Modified: trunk/evas/src/lib/engines/common/evas_font_query.c Modified: trunk/evas/src/lib/engines/common/evas_font_query.c =================================================================== --- trunk/evas/src/lib/engines/common/evas_font_query.c 2011-02-13 15:19:35 UTC (rev 56988) +++ trunk/evas/src/lib/engines/common/evas_font_query.c 2011-02-13 16:35:03 UTC (rev 56989) @@ -59,7 +59,6 @@ } /* text x inset */ -/* FIXME: should use OT info when available. */ EAPI int evas_common_font_query_inset(RGBA_Font *fn __UNUSED__, const Evas_Text_Props *text_props) { |