summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_font_query.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-04-17 19:19:52 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-04-17 19:20:26 +0100
commitd9b9647a1542779503d82e54171893d3dff19d20 (patch)
tree092c2b42def04898ab8711dc598cb5d1d0206ccc /src/lib/evas/common/evas_font_query.c
parent04567a16db062449ac5ab02dc24984c063bcde73 (diff)
Revert "evas_textblock: pick textrun fonts"
This reverts commit 9b987c67e1e38602ba2e4c9c990798e99d938bbe. this breaks color emoji in terminology (evas textgrid).
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_font_query.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/lib/evas/common/evas_font_query.c b/src/lib/evas/common/evas_font_query.c
index a25c19c81e..ec480fd8e1 100644
--- a/src/lib/evas/common/evas_font_query.c
+++ b/src/lib/evas/common/evas_font_query.c
@@ -17,7 +17,7 @@
17 * @return length of the run found. 17 * @return length of the run found.
18 */ 18 */
19EAPI int 19EAPI int
20evas_common_font_query_run_font_end_get(RGBA_Font *fn, RGBA_Font_Int **script_fi, RGBA_Font_Int **cur_fi, Evas_Script_Type script EINA_UNUSED, const Eina_Unicode *text, int run_len) 20evas_common_font_query_run_font_end_get(RGBA_Font *fn, RGBA_Font_Int **script_fi, RGBA_Font_Int **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len)
21{ 21{
22 RGBA_Font_Int *fi = NULL; 22 RGBA_Font_Int *fi = NULL;
23 const Eina_Unicode *run_end = text + run_len; 23 const Eina_Unicode *run_end = text + run_len;
@@ -26,7 +26,38 @@ evas_common_font_query_run_font_end_get(RGBA_Font *fn, RGBA_Font_Int **script_fi
26 /* If there's no current script_fi, find it first */ 26 /* If there's no current script_fi, find it first */
27 if (!*script_fi) 27 if (!*script_fi)
28 { 28 {
29 fi = fn->fonts->data; 29 const Eina_Unicode *base_char = NULL;
30 /* Skip common chars */
31 for (base_char = text ;
32 (base_char < run_end) &&
33 (evas_common_language_char_script_get(*base_char) != script) ;
34 base_char++)
35 ;
36 /* If counter reach variation sequence it is safe to pick default font */
37 if(VAR_SEQ_SAFE(base_char) || (base_char != run_end && VAR_SEQ_SAFE((base_char+1)))) goto get_top_font;
38
39 if (base_char == run_end) base_char = text;
40
41 /* Find the first renderable char */
42 while (base_char < run_end)
43 {
44 /* 0x1F is the last ASCII contral char, just a hack in
45 * the meanwhile. */
46 if ((*base_char > 0x1F) &&
47 evas_common_font_glyph_search(fn, &fi, *base_char, 0, EVAS_FONT_SEARCH_OPTION_NONE))
48 break;
49 base_char++;
50 }
51
52
53 /* If everything else fails, at least try to find a font for the
54 * replacement char */
55 if (base_char == run_end)
56 evas_common_font_glyph_search(fn, &fi, REPLACEMENT_CHAR, 0, EVAS_FONT_SEARCH_OPTION_NONE);
57get_top_font:
58
59 if (!fi)
60 fi = fn->fonts->data;
30 61
31 *script_fi = fi; 62 *script_fi = fi;
32 } 63 }