summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-11-07 11:22:09 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-07 11:34:53 +0900
commitb038d7df25f9cecaa4f0d8c1c7355e4852e5348a (patch)
tree595da7d0114056e147d4a40fedc72d5b71b3927a /src/lib/evas/canvas
parenta75b3dcdfbe0760972c8b4d55a90dc6250bd1e45 (diff)
Remove evas internal dependency from the evas_font module
Summary: dev branch : devs/subhransu/font The Final goal is to move the evas_font module to ector so that both ector and evas can reuse the code. make the api simple so that sam eapi can be used by evas_textblock and ector text. This is the 1st stage to achive that gola, first remove the evas internal dependancy as much as possible before moving to ector library. Reviewers: jpeg, raster, herdsman, cedric, id213sin Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5419
Diffstat (limited to '')
-rw-r--r--src/lib/evas/canvas/evas_font_dir.c1105
-rw-r--r--src/lib/evas/canvas/evas_main.c135
-rw-r--r--src/lib/evas/canvas/evas_object_text.c14
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c43
-rw-r--r--src/lib/evas/canvas/evas_object_textgrid.c54
-rw-r--r--src/lib/evas/canvas/evas_render.c4
-rw-r--r--src/lib/evas/canvas/render2/evas_render2_old.c2
7 files changed, 694 insertions, 663 deletions
diff --git a/src/lib/evas/canvas/evas_font_dir.c b/src/lib/evas/canvas/evas_font_dir.c
index e120f682d6..cbdef108ff 100644
--- a/src/lib/evas/canvas/evas_font_dir.c
+++ b/src/lib/evas/canvas/evas_font_dir.c
@@ -13,8 +13,14 @@
13#include <fontconfig/fcfreetype.h> 13#include <fontconfig/fcfreetype.h>
14#endif 14#endif
15 15
16#include "evas_common_private.h" 16#include "evas_font.h"
17#include "evas_private.h" 17
18/* General types - used for script type chceking */
19#define OPAQUE_TYPE(type) struct __##type { int a; }; \
20 typedef struct __##type type
21
22OPAQUE_TYPE(Evas_Font_Set); /* General type for RGBA_Font */
23OPAQUE_TYPE(Evas_Font_Instance); /* General type for RGBA_Font_Int */
18 24
19/* font dir cache */ 25/* font dir cache */
20static Eina_Hash *font_dirs = NULL; 26static Eina_Hash *font_dirs = NULL;
@@ -57,6 +63,70 @@ static int evas_object_text_font_string_parse(char *buffer, char dest[14][256]);
57static FcConfig *fc_config = NULL; 63static FcConfig *fc_config = NULL;
58#endif 64#endif
59 65
66/* FIXME move these helper function to eina_file or eina_path */
67/* get the casefold feature! */
68#include <fnmatch.h>
69#ifndef _MSC_VER
70# include <unistd.h>
71# include <sys/param.h>
72#endif
73int
74_file_path_is_full_path(const char *path)
75{
76 if (!path) return 0;
77#ifdef _WIN32
78 if (evil_path_is_absolute(path)) return 1;
79#else
80 if (path[0] == '/') return 1;
81#endif
82 return 0;
83}
84
85static DATA64
86_file_modified_time(const char *file)
87{
88 struct stat st;
89
90 if (stat(file, &st) < 0) return 0;
91 if (st.st_ctime > st.st_mtime) return (DATA64)st.st_ctime;
92 else return (DATA64)st.st_mtime;
93 return 0;
94}
95
96Eina_List *
97_file_path_list(char *path, const char *match, int match_case)
98{
99 Eina_File_Direct_Info *info;
100 Eina_Iterator *it;
101 Eina_List *files = NULL;
102 int flags;
103
104 flags = FNM_PATHNAME;
105#ifdef FNM_CASEFOLD
106 if (!match_case)
107 flags |= FNM_CASEFOLD;
108#elif defined FNM_IGNORECASE
109 if (!match_case)
110 flags |= FNM_IGNORECASE;
111#else
112/*#warning "Your libc does not provide case-insensitive matching!"*/
113#endif
114
115 it = eina_file_direct_ls(path);
116 EINA_ITERATOR_FOREACH(it, info)
117 {
118 if (match)
119 {
120 if (fnmatch(match, info->path + info->name_start, flags) == 0)
121 files = eina_list_append(files, strdup(info->path + info->name_start));
122 }
123 else
124 files = eina_list_append(files, strdup(info->path + info->name_start));
125 }
126 if (it) eina_iterator_free(it);
127 return files;
128}
129
60static void 130static void
61evas_font_init(void) 131evas_font_init(void)
62{ 132{
@@ -102,13 +172,13 @@ evas_font_dir_cache_find(char *dir, char *font)
102 fd = object_text_font_cache_dir_update(dir, fd); 172 fd = object_text_font_cache_dir_update(dir, fd);
103 if (fd) 173 if (fd)
104 { 174 {
105 Evas_Font *fn; 175 Evas_Font *fn;
106 176
107 fn = object_text_font_cache_font_find(fd, font); 177 fn = object_text_font_cache_font_find(fd, font);
108 if (fn) 178 if (fn)
109 { 179 {
110 return fn->path; 180 return fn->path;
111 } 181 }
112 } 182 }
113 return NULL; 183 return NULL;
114} 184}
@@ -122,123 +192,117 @@ evas_font_set_get(const char *name)
122 p = strchr(name, ','); 192 p = strchr(name, ',');
123 if (!p) 193 if (!p)
124 { 194 {
125 fonts = eina_list_append(fonts, eina_stringshare_add(name)); 195 fonts = eina_list_append(fonts, eina_stringshare_add(name));
126 } 196 }
127 else 197 else
128 { 198 {
129 const char *pp; 199 const char *pp;
130 char *nm; 200 char *nm;
131 201
132 pp = name; 202 pp = name;
133 while (p) 203 while (p)
134 { 204 {
135 nm = alloca(p - pp + 1); 205 nm = alloca(p - pp + 1);
136 strncpy(nm, pp, p - pp); 206 strncpy(nm, pp, p - pp);
137 nm[p - pp] = 0; 207 nm[p - pp] = 0;
138 fonts = eina_list_append(fonts, eina_stringshare_add(nm)); 208 fonts = eina_list_append(fonts, eina_stringshare_add(nm));
139 pp = p + 1; 209 pp = p + 1;
140 p = strchr(pp, ','); 210 p = strchr(pp, ',');
141 if (!p) fonts = eina_list_append(fonts, eina_stringshare_add(pp)); 211 if (!p) fonts = eina_list_append(fonts, eina_stringshare_add(pp));
142 } 212 }
143 } 213 }
144 return fonts; 214 return fonts;
145} 215}
146 216
147void 217void
148evas_fonts_zero_free(Evas *eo_evas) 218evas_fonts_zero_free()
149{ 219{
150 Fndat *fd; 220 Fndat *fd;
151 Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
152 221
153 EINA_LIST_FREE(fonts_zero, fd) 222 EINA_LIST_FREE(fonts_zero, fd)
154 { 223 {
155 if (fd->fdesc) evas_font_desc_unref(fd->fdesc); 224 if (fd->fdesc) evas_font_desc_unref(fd->fdesc);
156 if (fd->source) eina_stringshare_del(fd->source); 225 if (fd->source) eina_stringshare_del(fd->source);
157 if ((evas->engine.func) && (evas->engine.func->font_free)) 226 evas_common_font_free((RGBA_Font *)fd->font);
158 evas->engine.func->font_free(_evas_engine_context(evas), fd->font);
159#ifdef HAVE_FONTCONFIG 227#ifdef HAVE_FONTCONFIG
160 if (fd->set) FcFontSetDestroy(fd->set); 228 if (fd->set) FcFontSetDestroy(fd->set);
161 if (fd->p_nm) FcPatternDestroy(fd->p_nm); 229 if (fd->p_nm) FcPatternDestroy(fd->p_nm);
162#endif 230#endif
163 free(fd); 231 free(fd);
164 } 232 }
165} 233}
166 234
167void 235void
168evas_fonts_zero_pressure(Evas *eo_evas) 236evas_fonts_zero_pressure()
169{ 237{
170 Fndat *fd; 238 Fndat *fd;
171 Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
172 239
173 while (fonts_zero 240 while (fonts_zero
174 && eina_list_count(fonts_zero) > 4) /* 4 is arbitrary */ 241 && eina_list_count(fonts_zero) > 4) /* 4 is arbitrary */
175 { 242 {
176 fd = eina_list_data_get(fonts_zero); 243 fd = eina_list_data_get(fonts_zero);
177 244
178 if (fd->ref != 0) break; 245 if (fd->ref != 0) break;
179 fonts_zero = eina_list_remove_list(fonts_zero, fonts_zero); 246 fonts_zero = eina_list_remove_list(fonts_zero, fonts_zero);
180 247
181 if (fd->fdesc) evas_font_desc_unref(fd->fdesc); 248 if (fd->fdesc) evas_font_desc_unref(fd->fdesc);
182 if (fd->source) eina_stringshare_del(fd->source); 249 if (fd->source) eina_stringshare_del(fd->source);
183 if ((evas->engine.func) && (evas->engine.func->font_free)) 250 evas_common_font_free((RGBA_Font *)fd->font);
184 evas->engine.func->font_free(_evas_engine_context(evas), fd->font); 251 #ifdef HAVE_FONTCONFIG
185#ifdef HAVE_FONTCONFIG 252 if (fd->set) FcFontSetDestroy(fd->set);
186 if (fd->set) FcFontSetDestroy(fd->set); 253 if (fd->p_nm) FcPatternDestroy(fd->p_nm);
187 if (fd->p_nm) FcPatternDestroy(fd->p_nm); 254 #endif
188#endif 255 free(fd);
189 free(fd); 256
190 257 if (eina_list_count(fonts_zero) < 5) break;
191 if (eina_list_count(fonts_zero) < 5) break;
192 } 258 }
193} 259}
194 260
195void 261void
196evas_font_free(Evas *eo_evas, void *font) 262evas_font_free(void *font)
197{ 263{
198 Eina_List *l; 264 Eina_List *l;
199 Fndat *fd; 265 Fndat *fd;
200 Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
201 266
202 EINA_LIST_FOREACH(fonts_cache, l, fd) 267 EINA_LIST_FOREACH(fonts_cache, l, fd)
203 { 268 {
204 if (fd->font == font) 269 if (fd->font == font)
205 { 270 {
206 fd->ref--; 271 fd->ref--;
207 if (fd->ref == 0) 272 if (fd->ref == 0)
208 { 273 {
209 fonts_cache = eina_list_remove_list(fonts_cache, l); 274 fonts_cache = eina_list_remove_list(fonts_cache, l);
210 fonts_zero = eina_list_append(fonts_zero, fd); 275 fonts_zero = eina_list_append(fonts_zero, fd);
211 } 276 }
212 break; 277 break;
213 } 278 }
214 } 279 }
215 while (fonts_zero 280 while (fonts_zero
216 && eina_list_count(fonts_zero) > 42) /* 42 is arbitrary */ 281 && eina_list_count(fonts_zero) > 42) /* 42 is arbitrary */
217 { 282 {
218 fd = eina_list_data_get(fonts_zero); 283 fd = eina_list_data_get(fonts_zero);
219 284
220 if (fd->ref != 0) break; 285 if (fd->ref != 0) break;
221 fonts_zero = eina_list_remove_list(fonts_zero, fonts_zero); 286 fonts_zero = eina_list_remove_list(fonts_zero, fonts_zero);
222 287
223 if (fd->fdesc) evas_font_desc_unref(fd->fdesc); 288 if (fd->fdesc) evas_font_desc_unref(fd->fdesc);
224 if (fd->source) eina_stringshare_del(fd->source); 289 if (fd->source) eina_stringshare_del(fd->source);
225 evas->engine.func->font_free(_evas_engine_context(evas), fd->font); 290 evas_common_font_free((RGBA_Font *)fd->font);
226#ifdef HAVE_FONTCONFIG 291 #ifdef HAVE_FONTCONFIG
227 if (fd->set) FcFontSetDestroy(fd->set); 292 if (fd->set) FcFontSetDestroy(fd->set);
228 if (fd->p_nm) FcPatternDestroy(fd->p_nm); 293 if (fd->p_nm) FcPatternDestroy(fd->p_nm);
229#endif 294 #endif
230 free(fd); 295 free(fd);
231 296
232 if (eina_list_count(fonts_zero) < 43) break; 297 if (eina_list_count(fonts_zero) < 43) break;
233 } 298 }
234} 299}
235 300
236#ifdef HAVE_FONTCONFIG 301#ifdef HAVE_FONTCONFIG
237static Evas_Font_Set * 302static Evas_Font_Set *
238_evas_load_fontconfig(Evas_Font_Set *font, Evas *eo_evas, FcFontSet *set, int size, 303_evas_load_fontconfig(Evas_Font_Set *font, FcFontSet *set, int size,
239 Font_Rend_Flags wanted_rend, Efl_Text_Font_Bitmap_Scalable bitmap_scalable) 304 Font_Rend_Flags wanted_rend, Efl_Text_Font_Bitmap_Scalable bitmap_scalable)
240{ 305{
241 Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
242 int i; 306 int i;
243 307
244 /* Do loading for all in family */ 308 /* Do loading for all in family */
@@ -249,9 +313,9 @@ _evas_load_fontconfig(Evas_Font_Set *font, Evas *eo_evas, FcFontSet *set, int si
249 if (FcPatternGet(set->fonts[i], FC_FILE, 0, &filename) == FcResultMatch) 313 if (FcPatternGet(set->fonts[i], FC_FILE, 0, &filename) == FcResultMatch)
250 { 314 {
251 if (font) 315 if (font)
252 evas->engine.func->font_add(_evas_engine_context(evas), font, (char *)filename.u.s, size, wanted_rend, bitmap_scalable); 316 evas_common_font_add((RGBA_Font *)font, (char *)filename.u.s, size, wanted_rend, bitmap_scalable);
253 else 317 else
254 font = evas->engine.func->font_load(_evas_engine_context(evas), (char *)filename.u.s, size, wanted_rend, bitmap_scalable); 318 font = (Evas_Font_Set *)evas_common_font_load((char *)filename.u.s, size, wanted_rend, bitmap_scalable);
255 } 319 }
256 } 320 }
257 321
@@ -385,7 +449,7 @@ _evas_font_style_find_internal(const char *style, const char *style_end,
385 const char *cur = _map[i].name; 449 const char *cur = _map[i].name;
386 len = strlen(cur); 450 len = strlen(cur);
387 if (!strncasecmp(style, cur, len) && 451 if (!strncasecmp(style, cur, len) &&
388 (!cur[len] || (cur[len] == ' '))) 452 (!cur[len] || (cur[len] == ' ')))
389 { 453 {
390 return _map[i].type; 454 return _map[i].type;
391 } 455 }
@@ -474,8 +538,8 @@ evas_font_desc_cmp(const Evas_Font_Description *a,
474{ 538{
475 /* FIXME: Do actual comparison, i.e less than and bigger than. */ 539 /* FIXME: Do actual comparison, i.e less than and bigger than. */
476 return !((a->name == b->name) && (a->weight == b->weight) && 540 return !((a->name == b->name) && (a->weight == b->weight) &&
477 (a->slant == b->slant) && (a->width == b->width) && 541 (a->slant == b->slant) && (a->width == b->width) &&
478 (a->spacing == b->spacing) && (a->lang == b->lang)); 542 (a->spacing == b->spacing) && (a->lang == b->lang));
479} 543}
480 544
481const char * 545const char *
@@ -552,9 +616,8 @@ evas_font_name_parse(Evas_Font_Description *fdesc, const char *name)
552} 616}
553 617
554void * 618void *
555evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size, Efl_Text_Font_Bitmap_Scalable bitmap_scalable) 619evas_font_load(const Eina_List *font_paths, int hinting, Evas_Font_Description *fdesc, const char *source, Evas_Font_Size size, Efl_Text_Font_Bitmap_Scalable bitmap_scalable)
556{ 620{
557 Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS);
558#ifdef HAVE_FONTCONFIG 621#ifdef HAVE_FONTCONFIG
559 FcPattern *p_nm = NULL; 622 FcPattern *p_nm = NULL;
560 FcFontSet *set = NULL; 623 FcFontSet *set = NULL;
@@ -583,32 +646,32 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
583 EINA_LIST_FOREACH(fonts_cache, l, fd) 646 EINA_LIST_FOREACH(fonts_cache, l, fd)
584 { 647 {
585 if (!evas_font_desc_cmp(fdesc, fd->fdesc)) 648 if (!evas_font_desc_cmp(fdesc, fd->fdesc))
586 { 649 {
587 if (((!source) && (!fd->source)) || 650 if (((!source) && (!fd->source)) ||
588 ((source) && (fd->source) && (!strcmp(source, fd->source)))) 651 ((source) && (fd->source) && (!strcmp(source, fd->source))))
589 { 652 {
590 if ((size == fd->size) && 653 if ((size == fd->size) &&
591 (wanted_rend == fd->wanted_rend) && 654 (wanted_rend == fd->wanted_rend) &&
592 (bitmap_scalable == fd->bitmap_scalable)) 655 (bitmap_scalable == fd->bitmap_scalable))
593 { 656 {
594 fonts_cache = eina_list_promote_list(fonts_cache, l); 657 fonts_cache = eina_list_promote_list(fonts_cache, l);
595 fd->ref++; 658 fd->ref++;
596 return fd->font; 659 return fd->font;
597 } 660 }
598#ifdef HAVE_FONTCONFIG 661 #ifdef HAVE_FONTCONFIG
599 else if (fd->set && fd->p_nm && !fd->file_font) 662 else if (fd->set && fd->p_nm && !fd->file_font)
600 { 663 {
601 found_fd = fd; 664 found_fd = fd;
602 } 665 }
603#endif 666 #endif
604 } 667 }
605 } 668 }
606 } 669 }
607 670
608#ifdef HAVE_FONTCONFIG 671#ifdef HAVE_FONTCONFIG
609 if (found_fd) 672 if (found_fd)
610 { 673 {
611 font = _evas_load_fontconfig(font, evas->evas, found_fd->set, size, wanted_rend, bitmap_scalable); 674 font = _evas_load_fontconfig(font, found_fd->set, size, wanted_rend, bitmap_scalable);
612 goto on_find; 675 goto on_find;
613 } 676 }
614#endif 677#endif
@@ -616,32 +679,32 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
616 EINA_LIST_FOREACH_SAFE(fonts_zero, l, l_next, fd) 679 EINA_LIST_FOREACH_SAFE(fonts_zero, l, l_next, fd)
617 { 680 {
618 if (!evas_font_desc_cmp(fdesc, fd->fdesc)) 681 if (!evas_font_desc_cmp(fdesc, fd->fdesc))
619 { 682 {
620 if (((!source) && (!fd->source)) || 683 if (((!source) && (!fd->source)) ||
621 ((source) && (fd->source) && (!strcmp(source, fd->source)))) 684 ((source) && (fd->source) && (!strcmp(source, fd->source))))
622 { 685 {
623 if ((size == fd->size) && 686 if ((size == fd->size) &&
624 (wanted_rend == fd->wanted_rend)) 687 (wanted_rend == fd->wanted_rend))
625 { 688 {
626 fonts_zero = eina_list_remove_list(fonts_zero, l); 689 fonts_zero = eina_list_remove_list(fonts_zero, l);
627 fonts_cache = eina_list_prepend(fonts_cache, fd); 690 fonts_cache = eina_list_prepend(fonts_cache, fd);
628 fd->ref++; 691 fd->ref++;
629 return fd->font; 692 return fd->font;
630 } 693 }
631#ifdef HAVE_FONTCONFIG 694 #ifdef HAVE_FONTCONFIG
632 else if (fd->set && fd->p_nm && !fd->file_font) 695 else if (fd->set && fd->p_nm && !fd->file_font)
633 { 696 {
634 found_fd = fd; 697 found_fd = fd;
635 } 698 }
636#endif 699 #endif
637 } 700 }
638 } 701 }
639 } 702 }
640 703
641#ifdef HAVE_FONTCONFIG 704#ifdef HAVE_FONTCONFIG
642 if (found_fd) 705 if (found_fd)
643 { 706 {
644 font = _evas_load_fontconfig(font, evas->evas, found_fd->set, size, wanted_rend, bitmap_scalable); 707 font = _evas_load_fontconfig(font, found_fd->set, size, wanted_rend, bitmap_scalable);
645 goto on_find; 708 goto on_find;
646 } 709 }
647#endif 710#endif
@@ -649,57 +712,53 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
649 fonts = evas_font_set_get(fdesc->name); 712 fonts = evas_font_set_get(fdesc->name);
650 EINA_LIST_FOREACH(fonts, l, nm) /* Load each font in append */ 713 EINA_LIST_FOREACH(fonts, l, nm) /* Load each font in append */
651 { 714 {
652 if (l == fonts || !font) /* First iteration OR no font */ 715 if (l == fonts || !font) /* First iteration OR no font */
653 { 716 {
654 if (source) /* Load Font from "eet" source */ 717 if (source) /* Load Font from "eet" source */
655 { 718 {
656 Eet_File *ef; 719 Eet_File *ef;
657 char *fake_name; 720 char fake_name[PATH_MAX];
658 721
659 fake_name = evas_file_path_join(source, nm); 722 eina_file_path_join(fake_name, PATH_MAX, source, nm);
660 if (fake_name) 723 font = (Evas_Font_Set *)evas_common_font_load(fake_name, size, wanted_rend, bitmap_scalable);
661 { 724 if (!font) /* Load from fake name failed, probably not cached */
662 font = evas->engine.func->font_load(_evas_engine_context(evas), fake_name, size, wanted_rend, bitmap_scalable); 725 {
663 if (!font) /* Load from fake name failed, probably not cached */ 726 /* read original!!! */
664 { 727 ef = eet_open(source, EET_FILE_MODE_READ);
665 /* read original!!! */ 728 if (ef)
666 ef = eet_open(source, EET_FILE_MODE_READ); 729 {
667 if (ef) 730 void *fdata;
668 { 731 int fsize = 0;
669 void *fdata; 732
670 int fsize = 0; 733 fdata = eet_read(ef, nm, &fsize);
671 734 if (fdata)
672 fdata = eet_read(ef, nm, &fsize); 735 {
673 if (fdata) 736 font = (Evas_Font_Set *)evas_common_font_memory_load(source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable);
674 { 737 free(fdata);
675 font = evas->engine.func->font_memory_load(_evas_engine_context(evas), source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable); 738 }
676 free(fdata); 739 eet_close(ef);
677 } 740 }
678 eet_close(ef); 741 }
679 } 742 }
680 } 743 if (!font) /* Source load failed */
681 free(fake_name); 744 {
682 } 745 if (_file_path_is_full_path((char *)nm)) /* Try filename */
683 } 746 font = (Evas_Font_Set *)evas_common_font_load((char *)nm, size, wanted_rend, bitmap_scalable);
684 if (!font) /* Source load failed */ 747 else /* search font path */
685 { 748 {
686 if (evas_file_path_is_full_path((char *)nm)) /* Try filename */ 749 const Eina_List *ll;
687 font = evas->engine.func->font_load(_evas_engine_context(evas), (char *)nm, size, wanted_rend, bitmap_scalable); 750 char *dir;
688 else /* search font path */ 751
689 { 752 EINA_LIST_FOREACH(font_paths, ll, dir)
690 Eina_List *ll; 753 {
691 char *dir; 754 const char *f_file;
692 755
693 EINA_LIST_FOREACH(evas->font_path, ll, dir) 756 f_file = evas_font_dir_cache_find(dir, (char *)nm);
694 { 757 if (f_file)
695 const char *f_file; 758 {
696 759 font = (Evas_Font_Set *)evas_common_font_load(f_file, size, wanted_rend, bitmap_scalable);
697 f_file = evas_font_dir_cache_find(dir, (char *)nm); 760 if (font) break;
698 if (f_file) 761 }
699 {
700 font = evas->engine.func->font_load(_evas_engine_context(evas), f_file, size, wanted_rend, bitmap_scalable);
701 if (font) break;
702 }
703 } 762 }
704 763
705 if (!font) 764 if (!font)
@@ -711,71 +770,66 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
711 f_file = evas_font_dir_cache_find(dir, (char *)nm); 770 f_file = evas_font_dir_cache_find(dir, (char *)nm);
712 if (f_file) 771 if (f_file)
713 { 772 {
714 font = evas->engine.func->font_load(_evas_engine_context(evas), f_file, size, wanted_rend, bitmap_scalable); 773 font = (Evas_Font_Set *)evas_common_font_load(f_file, size, wanted_rend, bitmap_scalable);
715 if (font) break; 774 if (font) break;
716 } 775 }
717 } 776 }
718 } 777 }
719 } 778 }
720 } 779 }
721 } 780 }
722 else /* Base font loaded, append others */ 781 else /* Base font loaded, append others */
723 { 782 {
724 void *ok = NULL; 783 void *ok = NULL;
725 784
726 if (source) 785 if (source)
727 { 786 {
728 Eet_File *ef; 787 Eet_File *ef;
729 char *fake_name; 788 char fake_name[PATH_MAX];
730 789
731 fake_name = evas_file_path_join(source, nm); 790 eina_file_path_join(fake_name, PATH_MAX, source, nm);
732 if (fake_name) 791 if (!evas_common_font_add((RGBA_Font *)font, fake_name, size, wanted_rend, bitmap_scalable))
733 { 792 {
734 /* FIXME: make an engine func */ 793 /* read original!!! */
735 if (!evas->engine.func->font_add(_evas_engine_context(evas), font, fake_name, size, wanted_rend, bitmap_scalable)) 794 ef = eet_open(source, EET_FILE_MODE_READ);
736 { 795 if (ef)
737 /* read original!!! */ 796 {
738 ef = eet_open(source, EET_FILE_MODE_READ); 797 void *fdata;
739 if (ef) 798 int fsize = 0;
740 { 799
741 void *fdata; 800 fdata = eet_read(ef, nm, &fsize);
742 int fsize = 0; 801 if ((fdata) && (fsize > 0))
743 802 {
744 fdata = eet_read(ef, nm, &fsize); 803 ok = evas_common_font_memory_add((RGBA_Font *)font, source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable);
745 if ((fdata) && (fsize > 0)) 804 }
746 { 805 eet_close(ef);
747 ok = evas->engine.func->font_memory_add(_evas_engine_context(evas), font, source, nm, size, fdata, fsize, wanted_rend, bitmap_scalable); 806 free(fdata);
748 } 807 }
749 eet_close(ef); 808 }
750 free(fdata); 809 else
751 } 810 ok = (void *)1;
752 } 811 }
753 else 812 if (!ok)
754 ok = (void *)1; 813 {
755 free(fake_name); 814 if (_file_path_is_full_path((char *)nm))
756 } 815 evas_common_font_add((RGBA_Font *)font, (char *)nm, size, wanted_rend, bitmap_scalable);
757 } 816 else
758 if (!ok) 817 {
759 { 818 const Eina_List *ll;
760 if (evas_file_path_is_full_path((char *)nm)) 819 char *dir;
761 evas->engine.func->font_add(_evas_engine_context(evas), font, (char *)nm, size, wanted_rend, bitmap_scalable); 820 RGBA_Font *fn = NULL;
762 else 821
763 { 822 EINA_LIST_FOREACH(font_paths, ll, dir)
764 Eina_List *ll; 823 {
765 char *dir; 824 const char *f_file;
766 RGBA_Font *fn = NULL; 825
767 826 f_file = evas_font_dir_cache_find(dir, (char *)nm);
768 EINA_LIST_FOREACH(evas->font_path, ll, dir) 827 if (f_file)
769 { 828 {
770 const char *f_file; 829 fn = evas_common_font_add((RGBA_Font *)font, f_file, size, wanted_rend, bitmap_scalable);
771 830 if (fn)
772 f_file = evas_font_dir_cache_find(dir, (char *)nm); 831 break;
773 if (f_file) 832 }
774 {
775 fn = (RGBA_Font *)evas->engine.func->font_add(_evas_engine_context(evas), font, f_file, size, wanted_rend, bitmap_scalable);
776 if (fn)
777 break;
778 }
779 } 833 }
780 834
781 if (!fn) 835 if (!fn)
@@ -787,23 +841,23 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
787 f_file = evas_font_dir_cache_find(dir, (char *)nm); 841 f_file = evas_font_dir_cache_find(dir, (char *)nm);
788 if (f_file) 842 if (f_file)
789 { 843 {
790 fn = (RGBA_Font *)evas->engine.func->font_add(_evas_engine_context(evas), font, f_file, size, wanted_rend, bitmap_scalable); 844 fn = evas_common_font_add((RGBA_Font *)font, f_file, size, wanted_rend, bitmap_scalable);
791 if (fn) 845 if (fn)
792 break; 846 break;
793 } 847 }
794 } 848 }
795 } 849 }
796 } 850 }
797 } 851 }
798 } 852 }
799 eina_stringshare_del(nm); 853 eina_stringshare_del(nm);
800 } 854 }
801 eina_list_free(fonts); 855 eina_list_free(fonts);
802 856
803#ifdef HAVE_FONTCONFIG 857#ifdef HAVE_FONTCONFIG
804 if (!font) /* Search using fontconfig */ 858 if (!font) /* Search using fontconfig */
805 { 859 {
806 FcResult res; 860 FcResult res;
807 861
808 p_nm = FcPatternBuild (NULL, 862 p_nm = FcPatternBuild (NULL,
809 FC_WEIGHT, FcTypeInteger, _fc_weight_map[fdesc->weight], 863 FC_WEIGHT, FcTypeInteger, _fc_weight_map[fdesc->weight],
@@ -844,26 +898,27 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
844 if (fdesc->lang) 898 if (fdesc->lang)
845 FcPatternAddString (p_nm, FC_LANG, (FcChar8 *) fdesc->lang); 899 FcPatternAddString (p_nm, FC_LANG, (FcChar8 *) fdesc->lang);
846 900
847 FcConfigSubstitute(fc_config, p_nm, FcMatchPattern); 901 FcConfigSubstitute(fc_config, p_nm, FcMatchPattern);
848 FcDefaultSubstitute(p_nm); 902 FcDefaultSubstitute(p_nm);
849 903
850 /* do matching */ 904 /* do matching */
851 set = FcFontSort(fc_config, p_nm, FcTrue, NULL, &res); 905 set = FcFontSort(fc_config, p_nm, FcTrue, NULL, &res);
852 if (!set) 906 if (!set)
853 { 907 {
854 ERR("No fontconfig font matches '%s'. It was the last resource, no font found!", fdesc->name); 908 //FIXME add ERR log capability
855 FcPatternDestroy(p_nm); 909 //ERR("No fontconfig font matches '%s'. It was the last resource, no font found!", fdesc->name);
856 p_nm = NULL; 910 FcPatternDestroy(p_nm);
857 } 911 p_nm = NULL;
858 else 912 }
913 else
859 { 914 {
860 font = _evas_load_fontconfig(font, evas->evas, set, size, wanted_rend, bitmap_scalable); 915 font = _evas_load_fontconfig(font, set, size, wanted_rend, bitmap_scalable);
861 } 916 }
862 } 917 }
863 else /* Add a fallback list from fontconfig according to the found font. */ 918 else /* Add a fallback list from fontconfig according to the found font. */
864 { 919 {
865#if FC_MAJOR >= 2 && FC_MINOR >= 11 920#if FC_MAJOR >= 2 && FC_MINOR >= 11
866 FcResult res; 921 FcResult res;
867 922
868 FT_Face face = evas_common_font_freetype_face_get((RGBA_Font *) font); 923 FT_Face face = evas_common_font_freetype_face_get((RGBA_Font *) font);
869 924
@@ -884,7 +939,7 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
884 } 939 }
885 else 940 else
886 { 941 {
887 font = _evas_load_fontconfig(font, evas->evas, set, size, wanted_rend, bitmap_scalable); 942 font = _evas_load_fontconfig(font, set, size, wanted_rend, bitmap_scalable);
888 } 943 }
889 } 944 }
890#endif 945#endif
@@ -913,24 +968,20 @@ evas_font_load(Evas *eo_evas, Evas_Font_Description *fdesc, const char *source,
913 } 968 }
914 969
915 if (font) 970 if (font)
916 evas->engine.func->font_hinting_set(_evas_engine_context(evas), font, 971 evas_common_font_hinting_set((RGBA_Font *)font, hinting);
917 evas->hinting);
918 return font; 972 return font;
919} 973}
920 974
921void 975void
922evas_font_load_hinting_set(Evas *eo_evas, void *font, int hinting) 976evas_font_load_hinting_set(void *font, int hinting)
923{ 977{
924 Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS); 978 evas_common_font_hinting_set((RGBA_Font *) font, hinting);
925 evas->engine.func->font_hinting_set(_evas_engine_context(evas), font,
926 hinting);
927} 979}
928 980
929Eina_List * 981Eina_List *
930evas_font_dir_available_list(const Evas *eo_evas) 982evas_font_dir_available_list(const Eina_List *font_paths)
931{ 983{
932 const Evas_Public_Data *evas = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS); 984 const Eina_List *l;
933 Eina_List *l;
934 Eina_List *ll; 985 Eina_List *ll;
935 Eina_List *available = NULL; 986 Eina_List *available = NULL;
936 char *dir; 987 char *dir;
@@ -954,25 +1005,25 @@ evas_font_dir_available_list(const Evas *eo_evas)
954 1005
955 if (set) 1006 if (set)
956 { 1007 {
957 for (i = 0; i < set->nfont; i++) 1008 for (i = 0; i < set->nfont; i++)
958 { 1009 {
959 char *font; 1010 char *font;
960 1011
961 font = (char *)FcNameUnparse(set->fonts[i]); 1012 font = (char *)FcNameUnparse(set->fonts[i]);
962 available = eina_list_append(available, eina_stringshare_add(font)); 1013 available = eina_list_append(available, eina_stringshare_add(font));
963 free(font); 1014 free(font);
964 } 1015 }
965 1016
966 FcFontSetDestroy(set); 1017 FcFontSetDestroy(set);
967 } 1018 }
968#endif 1019#endif
969 1020
970 /* Add fonts in evas font_path*/ 1021 /* Add fonts in font_paths*/
971 if (evas->font_path) 1022 if (font_paths)
972 { 1023 {
973 if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL); 1024 if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL);
974 1025
975 EINA_LIST_FOREACH(evas->font_path, l, dir) 1026 EINA_LIST_FOREACH(font_paths, l, dir)
976 { 1027 {
977 Evas_Font_Dir *fd; 1028 Evas_Font_Dir *fd;
978 1029
@@ -1016,8 +1067,8 @@ evas_font_dir_available_list_free(Eina_List *available)
1016{ 1067{
1017 while (available) 1068 while (available)
1018 { 1069 {
1019 eina_stringshare_del(available->data); 1070 eina_stringshare_del(available->data);
1020 available = eina_list_remove(available, available->data); 1071 available = eina_list_remove(available, available->data);
1021 } 1072 }
1022} 1073}
1023 1074
@@ -1032,47 +1083,39 @@ font_cache_dir_free(const Eina_Hash *hash EINA_UNUSED, const void *key, void *da
1032static Evas_Font_Dir * 1083static Evas_Font_Dir *
1033object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd) 1084object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
1034{ 1085{
1086 char file_path[PATH_MAX];
1035 DATA64 mt; 1087 DATA64 mt;
1036 char *tmp;
1037 1088
1038 if (fd) 1089 if (fd)
1039 { 1090 {
1040 mt = evas_file_modified_time(dir); 1091 mt = _file_modified_time(dir);
1041 if (mt != fd->dir_mod_time) 1092 if (mt != fd->dir_mod_time)
1042 { 1093 {
1043 eina_hash_del(font_dirs, dir, fd); 1094 eina_hash_del(font_dirs, dir, fd);
1044 object_text_font_cache_dir_del(dir, fd); 1095 object_text_font_cache_dir_del(dir, fd);
1045 } 1096 }
1046 else 1097 else
1047 { 1098 {
1048 tmp = evas_file_path_join(dir, "fonts.dir"); 1099 eina_file_path_join(file_path, PATH_MAX, dir, "fonts.dir");
1049 if (tmp) 1100 mt = _file_modified_time(file_path);
1050 { 1101 if (mt != fd->fonts_dir_mod_time)
1051 mt = evas_file_modified_time(tmp); 1102 {
1052 free(tmp); 1103 eina_hash_del(font_dirs, dir, fd);
1053 if (mt != fd->fonts_dir_mod_time) 1104 object_text_font_cache_dir_del(dir, fd);
1054 { 1105 }
1055 eina_hash_del(font_dirs, dir, fd); 1106 else
1056 object_text_font_cache_dir_del(dir, fd); 1107 {
1057 } 1108 eina_file_path_join(file_path, PATH_MAX, dir, "fonts.alias");
1058 else 1109 mt = _file_modified_time(file_path);
1059 { 1110 if (mt != fd->fonts_alias_mod_time)
1060 tmp = evas_file_path_join(dir, "fonts.alias"); 1111 {
1061 if (tmp) 1112 eina_hash_del(font_dirs, dir, fd);
1062 { 1113 object_text_font_cache_dir_del(dir, fd);
1063 mt = evas_file_modified_time(tmp); 1114 }
1064 free(tmp); 1115 else
1065 } 1116 return fd;
1066 if (mt != fd->fonts_alias_mod_time) 1117 }
1067 { 1118 }
1068 eina_hash_del(font_dirs, dir, fd);
1069 object_text_font_cache_dir_del(dir, fd);
1070 }
1071 else
1072 return fd;
1073 }
1074 }
1075 }
1076 } 1119 }
1077 return object_text_font_cache_dir_add(dir); 1120 return object_text_font_cache_dir_add(dir);
1078} 1121}
@@ -1089,23 +1132,23 @@ object_text_font_cache_font_find_x(Evas_Font_Dir *fd, char *font)
1089 if (num != 14) return NULL; 1132 if (num != 14) return NULL;
1090 EINA_LIST_FOREACH(fd->fonts, l, fn) 1133 EINA_LIST_FOREACH(fd->fonts, l, fn)
1091 { 1134 {
1092 if (fn->type == 1) 1135 if (fn->type == 1)
1093 { 1136 {
1094 int i; 1137 int i;
1095 int match = 0; 1138 int match = 0;
1096 1139
1097 for (i = 0; i < 14; i++) 1140 for (i = 0; i < 14; i++)
1098 { 1141 {
1099 if ((font_prop[i][0] == '*') && (font_prop[i][1] == 0)) 1142 if ((font_prop[i][0] == '*') && (font_prop[i][1] == 0))
1100 match++; 1143 match++;
1101 else 1144 else
1102 { 1145 {
1103 if (!strcasecmp(font_prop[i], fn->x.prop[i])) match++; 1146 if (!strcasecmp(font_prop[i], fn->x.prop[i])) match++;
1104 else break; 1147 else break;
1105 } 1148 }
1106 } 1149 }
1107 if (match == 14) return fn; 1150 if (match == 14) return fn;
1108 } 1151 }
1109 } 1152 }
1110 return NULL; 1153 return NULL;
1111} 1154}
@@ -1118,10 +1161,10 @@ object_text_font_cache_font_find_file(Evas_Font_Dir *fd, char *font)
1118 1161
1119 EINA_LIST_FOREACH(fd->fonts, l, fn) 1162 EINA_LIST_FOREACH(fd->fonts, l, fn)
1120 { 1163 {
1121 if (fn->type == 0) 1164 if (fn->type == 0)
1122 { 1165 {
1123 if (!strcasecmp(font, fn->simple.name)) return fn; 1166 if (!strcasecmp(font, fn->simple.name)) return fn;
1124 } 1167 }
1125 } 1168 }
1126 return NULL; 1169 return NULL;
1127} 1170}
@@ -1155,10 +1198,13 @@ object_text_font_cache_font_find(Evas_Font_Dir *fd, char *font)
1155static Evas_Font_Dir * 1198static Evas_Font_Dir *
1156object_text_font_cache_dir_add(char *dir) 1199object_text_font_cache_dir_add(char *dir)
1157{ 1200{
1201 char file_path[PATH_MAX];
1158 Evas_Font_Dir *fd; 1202 Evas_Font_Dir *fd;
1159 char *tmp, *tmp2, *file; 1203 char *file;
1204 char tmp2[PATH_MAX];
1160 Eina_List *fdir; 1205 Eina_List *fdir;
1161 Evas_Font *fn; 1206 Evas_Font *fn;
1207 FILE *f;
1162 1208
1163 fd = calloc(1, sizeof(Evas_Font_Dir)); 1209 fd = calloc(1, sizeof(Evas_Font_Dir));
1164 if (!fd) return NULL; 1210 if (!fd) return NULL;
@@ -1169,134 +1215,105 @@ object_text_font_cache_dir_add(char *dir)
1169 /* READ fonts.alias, fonts.dir and directory listing */ 1215 /* READ fonts.alias, fonts.dir and directory listing */
1170 1216
1171 /* fonts.dir */ 1217 /* fonts.dir */
1172 tmp = evas_file_path_join(dir, "fonts.dir"); 1218 eina_file_path_join(file_path, PATH_MAX, dir, "fonts.dir");
1173 if (tmp) 1219
1220 f = fopen(file_path, "rb");
1221 if (f)
1174 { 1222 {
1175 FILE *f; 1223 int num;
1176 1224 char fname[4096], fdef[4096];
1177 f = fopen(tmp, "rb"); 1225
1178 if (f) 1226 if (fscanf(f, "%i\n", &num) != 1) goto cant_read;
1179 { 1227 /* read font lines */
1180 int num; 1228 while (fscanf(f, "%4090s %[^\n]\n", fname, fdef) == 2)
1181 char fname[4096], fdef[4096]; 1229 {
1182 1230 char font_prop[14][256];
1183 if (fscanf(f, "%i\n", &num) != 1) goto cant_read; 1231 int i;
1184 /* read font lines */ 1232
1185 while (fscanf(f, "%4090s %[^\n]\n", fname, fdef) == 2) 1233 /* skip comments */
1186 { 1234 if ((fdef[0] == '!') || (fdef[0] == '#')) continue;
1187 char font_prop[14][256]; 1235 /* parse font def */
1188 int i; 1236 num = evas_object_text_font_string_parse((char *)fdef, font_prop);
1189 1237 if (num == 14)
1190 /* skip comments */ 1238 {
1191 if ((fdef[0] == '!') || (fdef[0] == '#')) continue; 1239 fn = calloc(1, sizeof(Evas_Font));
1192 /* parse font def */ 1240 if (fn)
1193 num = evas_object_text_font_string_parse((char *)fdef, font_prop); 1241 {
1194 if (num == 14) 1242 fn->type = 1;
1195 { 1243 for (i = 0; i < 14; i++)
1196 fn = calloc(1, sizeof(Evas_Font)); 1244 fn->x.prop[i] = eina_stringshare_add(font_prop[i]);
1197 if (fn) 1245 eina_file_path_join(tmp2, PATH_MAX, dir, fname);
1198 { 1246 fn->path = eina_stringshare_add(tmp2);
1199 fn->type = 1; 1247 fd->fonts = eina_list_append(fd->fonts, fn);
1200 for (i = 0; i < 14; i++) 1248 }
1201 fn->x.prop[i] = eina_stringshare_add(font_prop[i]); 1249 }
1202 tmp2 = evas_file_path_join(dir, fname); 1250 }
1203 if (tmp2) 1251 cant_read: ;
1204 { 1252 fclose(f);
1205 fn->path = eina_stringshare_add(tmp2);
1206 free(tmp2);
1207 }
1208 fd->fonts = eina_list_append(fd->fonts, fn);
1209 }
1210 }
1211 }
1212 cant_read: ;
1213 fclose(f);
1214 }
1215 free(tmp);
1216 } 1253 }
1217 1254
1218 /* directoy listing */ 1255 /* directoy listing */
1219 fdir = evas_file_path_list(dir, "*.ttf", 0); 1256 fdir = _file_path_list(dir, "*.ttf", 0);
1220 EINA_LIST_FREE(fdir, file) 1257 EINA_LIST_FREE(fdir, file)
1221 { 1258 {
1222 tmp = evas_file_path_join(dir, file); 1259 eina_file_path_join(file_path, PATH_MAX, dir, file);
1223 if (tmp) 1260 fn = calloc(1, sizeof(Evas_Font));
1224 { 1261 if (fn)
1225 fn = calloc(1, sizeof(Evas_Font)); 1262 {
1226 if (fn) 1263 char *p;
1227 { 1264
1228 char *p; 1265 fn->type = 0;
1229 1266 strcpy(tmp2, file);
1230 fn->type = 0; 1267 p = strrchr(tmp2, '.');
1231 tmp2 = alloca(strlen(file) + 1); 1268 if (p) *p = 0;
1232 strcpy(tmp2, file); 1269 fn->simple.name = eina_stringshare_add(tmp2);
1233 p = strrchr(tmp2, '.'); 1270 eina_file_path_join(tmp2, PATH_MAX, dir, file);
1234 if (p) *p = 0; 1271 fn->path = eina_stringshare_add(tmp2);
1235 fn->simple.name = eina_stringshare_add(tmp2); 1272 fd->fonts = eina_list_append(fd->fonts, fn);
1236 tmp2 = evas_file_path_join(dir, file); 1273 }
1237 if (tmp2) 1274 free(file);
1238 {
1239 fn->path = eina_stringshare_add(tmp2);
1240 free(tmp2);
1241 }
1242 fd->fonts = eina_list_append(fd->fonts, fn);
1243 }
1244 free(tmp);
1245 }
1246 free(file);
1247 } 1275 }
1248 1276
1249 /* fonts.alias */ 1277 /* fonts.alias */
1250 tmp = evas_file_path_join(dir, "fonts.alias"); 1278 eina_file_path_join(file_path, PATH_MAX, dir, "fonts.alias");
1251 if (tmp)
1252 {
1253 FILE *f;
1254
1255 f = fopen(tmp, "rb");
1256 if (f)
1257 {
1258 char fname[4096], fdef[4096];
1259
1260 /* read font alias lines */
1261 while (fscanf(f, "%4090s %4090[^\n]\n", fname, fdef) == 2)
1262 {
1263 Evas_Font_Alias *fa;
1264
1265 /* skip comments */
1266 if ((fname[0] == '!') || (fname[0] == '#')) continue;
1267 fa = calloc(1, sizeof(Evas_Font_Alias));
1268 if (fa)
1269 {
1270 fa->alias = eina_stringshare_add(fname);
1271 fa->fn = object_text_font_cache_font_find_x(fd, fdef);
1272 if ((!fa->alias) || (!fa->fn))
1273 {
1274 if (fa->alias) eina_stringshare_del(fa->alias);
1275 free(fa);
1276 }
1277 else
1278 fd->aliases = eina_list_append(fd->aliases, fa);
1279 }
1280 }
1281 fclose(f);
1282 }
1283 free(tmp);
1284 }
1285 1279
1286 fd->dir_mod_time = evas_file_modified_time(dir); 1280 f = fopen(file_path, "rb");
1287 tmp = evas_file_path_join(dir, "fonts.dir"); 1281 if (f)
1288 if (tmp)
1289 { 1282 {
1290 fd->fonts_dir_mod_time = evas_file_modified_time(tmp); 1283 char fname[4096], fdef[4096];
1291 free(tmp); 1284
1292 } 1285 /* read font alias lines */
1293 tmp = evas_file_path_join(dir, "fonts.alias"); 1286 while (fscanf(f, "%4090s %4090[^\n]\n", fname, fdef) == 2)
1294 if (tmp) 1287 {
1295 { 1288 Evas_Font_Alias *fa;
1296 fd->fonts_alias_mod_time = evas_file_modified_time(tmp); 1289
1297 free(tmp); 1290 /* skip comments */
1291 if ((fname[0] == '!') || (fname[0] == '#')) continue;
1292 fa = calloc(1, sizeof(Evas_Font_Alias));
1293 if (fa)
1294 {
1295 fa->alias = eina_stringshare_add(fname);
1296 fa->fn = object_text_font_cache_font_find_x(fd, fdef);
1297 if ((!fa->alias) || (!fa->fn))
1298 {
1299 if (fa->alias) eina_stringshare_del(fa->alias);
1300 free(fa);
1301 }
1302 else
1303 fd->aliases = eina_list_append(fd->aliases, fa);
1304 }
1305 }
1306 fclose(f);
1298 } 1307 }
1299 1308
1309 fd->dir_mod_time = _file_modified_time(dir);
1310
1311 eina_file_path_join(file_path, PATH_MAX, dir, "fonts.dir");
1312 fd->fonts_dir_mod_time = _file_modified_time(file_path);
1313
1314 eina_file_path_join(file_path, PATH_MAX, dir, "fonts.alias");
1315 fd->fonts_alias_mod_time = _file_modified_time(file_path);
1316
1300 return fd; 1317 return fd;
1301} 1318}
1302 1319
@@ -1306,27 +1323,27 @@ object_text_font_cache_dir_del(char *dir EINA_UNUSED, Evas_Font_Dir *fd)
1306 if (fd->lookup) eina_hash_free(fd->lookup); 1323 if (fd->lookup) eina_hash_free(fd->lookup);
1307 while (fd->fonts) 1324 while (fd->fonts)
1308 { 1325 {
1309 Evas_Font *fn; 1326 Evas_Font *fn;
1310 int i; 1327 int i;
1311 1328
1312 fn = fd->fonts->data; 1329 fn = fd->fonts->data;
1313 fd->fonts = eina_list_remove(fd->fonts, fn); 1330 fd->fonts = eina_list_remove(fd->fonts, fn);
1314 for (i = 0; i < 14; i++) 1331 for (i = 0; i < 14; i++)
1315 { 1332 {
1316 if (fn->x.prop[i]) eina_stringshare_del(fn->x.prop[i]); 1333 if (fn->x.prop[i]) eina_stringshare_del(fn->x.prop[i]);
1317 } 1334 }
1318 if (fn->simple.name) eina_stringshare_del(fn->simple.name); 1335 if (fn->simple.name) eina_stringshare_del(fn->simple.name);
1319 if (fn->path) eina_stringshare_del(fn->path); 1336 if (fn->path) eina_stringshare_del(fn->path);
1320 free(fn); 1337 free(fn);
1321 } 1338 }
1322 while (fd->aliases) 1339 while (fd->aliases)
1323 { 1340 {
1324 Evas_Font_Alias *fa; 1341 Evas_Font_Alias *fa;
1325 1342
1326 fa = fd->aliases->data; 1343 fa = fd->aliases->data;
1327 fd->aliases = eina_list_remove(fd->aliases, fa); 1344 fd->aliases = eina_list_remove(fd->aliases, fa);
1328 if (fa->alias) eina_stringshare_del(fa->alias); 1345 if (fa->alias) eina_stringshare_del(fa->alias);
1329 free(fa); 1346 free(fa);
1330 } 1347 }
1331 free(fd); 1348 free(fd);
1332} 1349}
@@ -1344,59 +1361,22 @@ evas_object_text_font_string_parse(char *buffer, char dest[14][256])
1344 i = 1; 1361 i = 1;
1345 while (p[i]) 1362 while (p[i])
1346 { 1363 {
1347 dest[n][m] = p[i]; 1364 dest[n][m] = p[i];
1348 if ((p[i] == '-') || (m == 255)) 1365 if ((p[i] == '-') || (m == 255))
1349 { 1366 {
1350 dest[n][m] = 0; 1367 dest[n][m] = 0;
1351 n++; 1368 n++;
1352 m = -1; 1369 m = -1;
1353 } 1370 }
1354 i++; 1371 i++;
1355 m++; 1372 m++;
1356 if (n == 14) return n; 1373 if (n == 14) return n;
1357 } 1374 }
1358 dest[n][m] = 0; 1375 dest[n][m] = 0;
1359 n++; 1376 n++;
1360 return n; 1377 return n;
1361} 1378}
1362 1379
1363EOLIAN void
1364_evas_canvas_font_path_clear(Eo *eo_e EINA_UNUSED, Evas_Public_Data *evas)
1365{
1366 evas_canvas_async_block(evas);
1367 while (evas->font_path)
1368 {
1369 eina_stringshare_del(evas->font_path->data);
1370 evas->font_path = eina_list_remove(evas->font_path, evas->font_path->data);
1371 }
1372}
1373
1374EOLIAN void
1375_evas_canvas_font_path_append(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
1376{
1377 if (!path) return;
1378 evas_canvas_async_block(e);
1379 e->font_path = eina_list_append(e->font_path, eina_stringshare_add(path));
1380
1381 evas_font_init();
1382}
1383
1384EOLIAN void
1385_evas_canvas_font_path_prepend(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
1386{
1387 if (!path) return;
1388 evas_canvas_async_block(e);
1389 e->font_path = eina_list_prepend(e->font_path, eina_stringshare_add(path));
1390
1391 evas_font_init();
1392}
1393
1394EOLIAN const Eina_List*
1395_evas_canvas_font_path_list(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
1396{
1397 return e->font_path;
1398}
1399
1400EAPI void 1380EAPI void
1401evas_font_path_global_append(const char *path) 1381evas_font_path_global_append(const char *path)
1402{ 1382{
@@ -1439,103 +1419,6 @@ evas_font_path_global_list(void)
1439 return global_font_path; 1419 return global_font_path;
1440} 1420}
1441 1421
1442void
1443evas_font_object_rehint(Evas_Object *eo_obj)
1444{
1445 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
1446 if (obj->is_smart)
1447 {
1448 EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), obj)
1449 evas_font_object_rehint(obj->object);
1450 }
1451 else
1452 {
1453 if (!strcmp(obj->type, "text"))
1454 _evas_object_text_rehint(eo_obj);
1455 if (!strcmp(obj->type, "textblock"))
1456 _evas_object_textblock_rehint(eo_obj);
1457 }
1458}
1459
1460EAPI void
1461evas_font_hinting_set(Eo *eo_e, Evas_Font_Hinting_Flags hinting)
1462{
1463 Evas_Layer *lay;
1464
1465 EVAS_LEGACY_API(eo_e, e);
1466 evas_canvas_async_block(e);
1467 if (e->hinting == hinting) return;
1468 e->hinting = hinting;
1469
1470 EINA_INLIST_FOREACH(e->layers, lay)
1471 {
1472 Evas_Object_Protected_Data *obj;
1473
1474 EINA_INLIST_FOREACH(lay->objects, obj)
1475 evas_font_object_rehint(obj->object);
1476 }
1477}
1478
1479EAPI Evas_Font_Hinting_Flags
1480evas_font_hinting_get(const Evas *eo_e)
1481{
1482 EVAS_LEGACY_API(eo_e, e, EVAS_FONT_HINTING_NONE);
1483 return e->hinting;
1484}
1485
1486EAPI Eina_Bool
1487evas_font_hinting_can_hint(const Evas *eo_e, Evas_Font_Hinting_Flags hinting)
1488{
1489 EVAS_LEGACY_API(eo_e, e, EINA_FALSE);
1490 if (e->engine.func->font_hinting_can_hint && _evas_engine_context(e))
1491 return e->engine.func->font_hinting_can_hint(_evas_engine_context(e),
1492 hinting);
1493 else return EINA_FALSE;
1494}
1495
1496EOLIAN void
1497_evas_canvas_font_cache_flush(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
1498{
1499 evas_canvas_async_block(e);
1500 evas_render_rendering_wait(e);
1501 if (_evas_engine_context(e))
1502 e->engine.func->font_cache_flush(_evas_engine_context(e));
1503}
1504
1505EOLIAN void
1506_evas_canvas_font_cache_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int size)
1507{
1508 if (size < 0) size = 0;
1509 evas_canvas_async_block(e);
1510 evas_render_rendering_wait(e);
1511 if (_evas_engine_context(e))
1512 e->engine.func->font_cache_set(_evas_engine_context(e), size);
1513}
1514
1515EOLIAN int
1516_evas_canvas_font_cache_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
1517{
1518 if (_evas_engine_context(e))
1519 return e->engine.func->font_cache_get(_evas_engine_context(e));
1520 return -1;
1521}
1522
1523EOLIAN Eina_List*
1524_evas_canvas_font_available_list(Eo *eo_e, Evas_Public_Data *_pd EINA_UNUSED)
1525{
1526 return evas_font_dir_available_list(eo_e);
1527}
1528
1529EAPI void
1530evas_font_available_list_free(Evas *eo_e, Eina_List *available)
1531{
1532 MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
1533 return;
1534 MAGIC_CHECK_END();
1535
1536 evas_font_dir_available_list_free(available);
1537}
1538
1539EAPI void 1422EAPI void
1540evas_font_reinit(void) 1423evas_font_reinit(void)
1541{ 1424{
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 04c6cb06a7..f6480e41aa 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -384,7 +384,7 @@ next_zombie:
384 EINA_LIST_FREE(e->obscures, r) 384 EINA_LIST_FREE(e->obscures, r)
385 eina_rectangle_free(r); 385 eina_rectangle_free(r);
386 386
387 evas_fonts_zero_free(eo_e); 387 evas_fonts_zero_free();
388 388
389 evas_event_callback_all_del(eo_e); 389 evas_event_callback_all_del(eo_e);
390 evas_event_callback_cleanup(eo_e); 390 evas_event_callback_cleanup(eo_e);
@@ -1289,6 +1289,139 @@ _evas_pointer_list_in_rect_get(Evas_Public_Data *edata, Evas_Object *obj,
1289 return list; 1289 return list;
1290} 1290}
1291 1291
1292/* font related api */
1293
1294EOLIAN static void
1295_evas_canvas_font_path_clear(Eo *eo_e EINA_UNUSED, Evas_Public_Data *evas)
1296{
1297 evas_canvas_async_block(evas);
1298 while (evas->font_path)
1299 {
1300 eina_stringshare_del(evas->font_path->data);
1301 evas->font_path = eina_list_remove(evas->font_path, evas->font_path->data);
1302 }
1303}
1304
1305EOLIAN static void
1306_evas_canvas_font_path_append(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
1307{
1308 if (!path) return;
1309 evas_canvas_async_block(e);
1310 e->font_path = eina_list_append(e->font_path, eina_stringshare_add(path));
1311}
1312
1313EOLIAN static void
1314_evas_canvas_font_path_prepend(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *path)
1315{
1316 if (!path) return;
1317 evas_canvas_async_block(e);
1318 e->font_path = eina_list_prepend(e->font_path, eina_stringshare_add(path));
1319}
1320
1321EOLIAN static const Eina_List*
1322_evas_canvas_font_path_list(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
1323{
1324 return e->font_path;
1325}
1326
1327EOLIAN static void
1328_evas_canvas_font_cache_flush(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
1329{
1330 evas_canvas_async_block(e);
1331 evas_render_rendering_wait(e);
1332 if (_evas_engine_context(e))
1333 e->engine.func->font_cache_flush(_evas_engine_context(e));
1334}
1335
1336EOLIAN static void
1337_evas_canvas_font_cache_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int size)
1338{
1339 if (size < 0) size = 0;
1340 evas_canvas_async_block(e);
1341 evas_render_rendering_wait(e);
1342 if (_evas_engine_context(e))
1343 e->engine.func->font_cache_set(_evas_engine_context(e), size);
1344}
1345
1346EOLIAN static int
1347_evas_canvas_font_cache_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
1348{
1349 if (_evas_engine_context(e))
1350 return e->engine.func->font_cache_get(_evas_engine_context(e));
1351 return -1;
1352}
1353
1354EOLIAN static Eina_List*
1355_evas_canvas_font_available_list(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *pd)
1356{
1357 return evas_font_dir_available_list(pd->font_path);
1358}
1359
1360static void
1361evas_font_object_rehint(Evas_Object *eo_obj)
1362{
1363 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
1364 if (obj->is_smart)
1365 {
1366 EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(eo_obj), obj)
1367 evas_font_object_rehint(obj->object);
1368 }
1369 else
1370 {
1371 if (!strcmp(obj->type, "text"))
1372 _evas_object_text_rehint(eo_obj);
1373 if (!strcmp(obj->type, "textblock"))
1374 _evas_object_textblock_rehint(eo_obj);
1375 }
1376}
1377
1378EAPI void
1379evas_font_hinting_set(Eo *eo_e, Evas_Font_Hinting_Flags hinting)
1380{
1381 Evas_Layer *lay;
1382
1383 EVAS_LEGACY_API(eo_e, e);
1384 evas_canvas_async_block(e);
1385 if (e->hinting == hinting) return;
1386 e->hinting = hinting;
1387
1388 EINA_INLIST_FOREACH(e->layers, lay)
1389 {
1390 Evas_Object_Protected_Data *obj;
1391
1392 EINA_INLIST_FOREACH(lay->objects, obj)
1393 evas_font_object_rehint(obj->object);
1394 }
1395}
1396
1397EAPI Evas_Font_Hinting_Flags
1398evas_font_hinting_get(const Evas *eo_e)
1399{
1400 EVAS_LEGACY_API(eo_e, e, EVAS_FONT_HINTING_NONE);
1401 return e->hinting;
1402}
1403
1404EAPI Eina_Bool
1405evas_font_hinting_can_hint(const Evas *eo_e, Evas_Font_Hinting_Flags hinting)
1406{
1407 EVAS_LEGACY_API(eo_e, e, EINA_FALSE);
1408 if (e->engine.func->font_hinting_can_hint && _evas_engine_context(e))
1409 return e->engine.func->font_hinting_can_hint(_evas_engine_context(e),
1410 hinting);
1411 else return EINA_FALSE;
1412}
1413
1414EAPI void
1415evas_font_available_list_free(Evas *eo_e, Eina_List *available)
1416{
1417 MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
1418 return;
1419 MAGIC_CHECK_END();
1420
1421 evas_font_dir_available_list_free(available);
1422}
1423
1424
1292/* Legacy EAPI */ 1425/* Legacy EAPI */
1293 1426
1294EAPI Eina_Bool 1427EAPI Eina_Bool
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 5cd0da45ce..47f37ff81c 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -439,12 +439,15 @@ _evas_text_font_reload(Eo *eo_obj, Evas_Text_Data *o)
439 /* DO IT */ 439 /* DO IT */
440 if (o->font) 440 if (o->font)
441 { 441 {
442 evas_font_free(obj->layer->evas->evas, o->font); 442 evas_font_free(o->font);
443 o->font = NULL; 443 o->font = NULL;
444 } 444 }
445 445
446 o->font = evas_font_load(obj->layer->evas->evas, o->cur.fdesc, o->cur.source, 446 o->font = evas_font_load(obj->layer->evas->font_path,
447 (int)(((double) o->cur.size) * obj->cur->scale), o->cur.bitmap_scalable); 447 obj->layer->evas->hinting,
448 o->cur.fdesc, o->cur.source,
449 (int)(((double) o->cur.size) * obj->cur->scale),
450 o->cur.bitmap_scalable);
448 { 451 {
449 o->ascent = 0; 452 o->ascent = 0;
450 o->descent = 0; 453 o->descent = 0;
@@ -1657,7 +1660,7 @@ evas_object_text_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1657 if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters); 1660 if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters);
1658 if (o->cur.text) free(o->cur.text); 1661 if (o->cur.text) free(o->cur.text);
1659 if (o->font && obj->layer && obj->layer->evas) 1662 if (o->font && obj->layer && obj->layer->evas)
1660 evas_font_free(obj->layer->evas->evas, o->font); 1663 evas_font_free(o->font);
1661 o->font = NULL; 1664 o->font = NULL;
1662 o->cur.utf8_text = NULL; 1665 o->cur.utf8_text = NULL;
1663 o->cur.font = NULL; 1666 o->cur.font = NULL;
@@ -2241,8 +2244,7 @@ _evas_object_text_rehint(Evas_Object *eo_obj)
2241 Eina_List *was = NULL; 2244 Eina_List *was = NULL;
2242 2245
2243 if (!o->font) return; 2246 if (!o->font) return;
2244 evas_font_load_hinting_set(obj->layer->evas->evas, o->font, 2247 evas_font_load_hinting_set(o->font, obj->layer->evas->hinting);
2245 obj->layer->evas->hinting);
2246 was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj, 1, 1); 2248 was = _evas_pointer_list_in_rect_get(obj->layer->evas, eo_obj, obj, 1, 1);
2247 /* DO II */ 2249 /* DO II */
2248 _evas_object_text_recalc(eo_obj, o->cur.text); 2250 _evas_object_text_recalc(eo_obj, o->cur.text);
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index c311b58909..0b375e41d5 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -1007,7 +1007,7 @@ _format_unref_free(Evas_Object_Protected_Data *evas_o, Evas_Object_Textblock_For
1007 fmt->gfx_filter = NULL; 1007 fmt->gfx_filter = NULL;
1008 } 1008 }
1009 if ((obj->layer) && (obj->layer->evas)) 1009 if ((obj->layer) && (obj->layer->evas))
1010 evas_font_free(obj->layer->evas->evas, fmt->font.font); 1010 evas_font_free(fmt->font.font);
1011 free(fmt); 1011 free(fmt);
1012} 1012}
1013 1013
@@ -2835,8 +2835,12 @@ _format_dup(Evas_Object *eo_obj, const Evas_Object_Textblock_Format *fmt)
2835 if (fmt->font.source) fmt2->font.source = eina_stringshare_add(fmt->font.source); 2835 if (fmt->font.source) fmt2->font.source = eina_stringshare_add(fmt->font.source);
2836 2836
2837 /* FIXME: just ref the font here... */ 2837 /* FIXME: just ref the font here... */
2838 fmt2->font.font = evas_font_load(obj->layer->evas->evas, fmt2->font.fdesc, 2838 fmt2->font.font = evas_font_load(obj->layer->evas->font_path,
2839 fmt2->font.source, (int)(((double) fmt2->font.size) * obj->cur->scale), fmt2->font.bitmap_scalable); 2839 obj->layer->evas->hinting,
2840 fmt2->font.fdesc,
2841 fmt2->font.source,
2842 (int)(((double) fmt2->font.size) * obj->cur->scale),
2843 fmt2->font.bitmap_scalable);
2840 2844
2841 if (fmt->gfx_filter) 2845 if (fmt->gfx_filter)
2842 { 2846 {
@@ -3392,8 +3396,12 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
3392 fmt->font.fdesc->slant = _FMT_INFO(font_slant); 3396 fmt->font.fdesc->slant = _FMT_INFO(font_slant);
3393 fmt->font.fdesc->width = _FMT_INFO(font_width); 3397 fmt->font.fdesc->width = _FMT_INFO(font_width);
3394 fmt->font.fdesc->lang = _FMT_INFO(font_lang); 3398 fmt->font.fdesc->lang = _FMT_INFO(font_lang);
3395 fmt->font.font = evas_font_load(evas_obj->layer->evas->evas, fmt->font.fdesc, 3399 fmt->font.font = evas_font_load(evas_obj->layer->evas->font_path,
3396 fmt->font.source, (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale), fmt->font.bitmap_scalable); 3400 evas_obj->layer->evas->hinting,
3401 fmt->font.fdesc,
3402 fmt->font.source,
3403 (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale),
3404 fmt->font.bitmap_scalable);
3397 } 3405 }
3398 if (_FMT_INFO(gfx_filter_name)) 3406 if (_FMT_INFO(gfx_filter_name))
3399 { 3407 {
@@ -4276,7 +4284,7 @@ _text_item_update_sizes(Ctxt *c, Evas_Object_Textblock_Text_Item *ti)
4276 if (shx1 < minx) minx = shx1; 4284 if (shx1 < minx) minx = shx1;
4277 if (shx2 > maxx) maxx = shx2; 4285 if (shx2 > maxx) maxx = shx2;
4278 ti->x_adjustment = maxx - minx; 4286 ti->x_adjustment = maxx - minx;
4279 4287
4280 ti->parent.w = tw + ti->x_adjustment; 4288 ti->parent.w = tw + ti->x_adjustment;
4281 ti->parent.h = th; 4289 ti->parent.h = th;
4282 ti->parent.adv = advw; 4290 ti->parent.adv = advw;
@@ -4538,9 +4546,13 @@ _format_finalize(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt)
4538 4546
4539 of = fmt->font.font; 4547 of = fmt->font.font;
4540 4548
4541 fmt->font.font = evas_font_load(obj->layer->evas->evas, fmt->font.fdesc, 4549 fmt->font.font = evas_font_load(obj->layer->evas->font_path,
4542 fmt->font.source, (int)(((double) fmt->font.size) * obj->cur->scale), fmt->font.bitmap_scalable); 4550 obj->layer->evas->hinting,
4543 if (of) evas_font_free(obj->layer->evas->evas, of); 4551 fmt->font.fdesc,
4552 fmt->font.source,
4553 (int)(((double) fmt->font.size) * obj->cur->scale),
4554 fmt->font.bitmap_scalable);
4555 if (of) evas_font_free(of);
4544} 4556}
4545 4557
4546static Efl_Canvas_Text_Filter_Program * 4558static Efl_Canvas_Text_Filter_Program *
@@ -4666,11 +4678,11 @@ _layout_do_format(const Evas_Object *obj, Ctxt *c,
4666 // item size=20x10 href=name 4678 // item size=20x10 href=name
4667 // item relsize=20x10 href=name 4679 // item relsize=20x10 href=name
4668 // item abssize=20x10 href=name 4680 // item abssize=20x10 href=name
4669 // 4681 //
4670 // optional arguments: 4682 // optional arguments:
4671 // vsize=full 4683 // vsize=full
4672 // vsize=ascent 4684 // vsize=ascent
4673 // 4685 //
4674 // size == item size (modifies line size) - can be multiplied by 4686 // size == item size (modifies line size) - can be multiplied by
4675 // scale factor 4687 // scale factor
4676 // relsize == relative size (height is current font height, width 4688 // relsize == relative size (height is current font height, width
@@ -5424,7 +5436,7 @@ _item_get_cutoff(Ctxt *c, Evas_Object_Textblock_Item *it, Evas_Coord x, Evas_Coo
5424 * that don't intersect in whole) will be split, and the rest are set to be 5436 * that don't intersect in whole) will be split, and the rest are set to be
5425 * visually-deleted. 5437 * visually-deleted.
5426 * Note that a special case for visible format items does not 5438 * Note that a special case for visible format items does not
5427 * split them, but instead just visually-deletes them (because there are no 5439 * split them, but instead just visually-deletes them (because there are no
5428 * characters to split). 5440 * characters to split).
5429 */ 5441 */
5430static inline void 5442static inline void
@@ -7903,7 +7915,7 @@ _evas_object_textblock_text_markup_get(Eo *eo_obj, Efl_Canvas_Text_Data *o)
7903 { 7915 {
7904 Eina_Unicode tmp_ch; 7916 Eina_Unicode tmp_ch;
7905 off += fnode->offset; 7917 off += fnode->offset;
7906 7918
7907 if (off > len) break; 7919 if (off > len) break;
7908 /* No need to skip on the first run */ 7920 /* No need to skip on the first run */
7909 tmp_ch = text[off]; 7921 tmp_ch = text[off];
@@ -14597,9 +14609,8 @@ _evas_object_textblock_rehint(Evas_Object *eo_obj)
14597 Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it); 14609 Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it);
14598 if (ti->parent.format->font.font) 14610 if (ti->parent.format->font.font)
14599 { 14611 {
14600 evas_font_load_hinting_set(obj->layer->evas->evas, 14612 evas_font_load_hinting_set(ti->parent.format->font.font,
14601 ti->parent.format->font.font, 14613 obj->layer->evas->hinting);
14602 obj->layer->evas->hinting);
14603 } 14614 }
14604 } 14615 }
14605 } 14616 }
diff --git a/src/lib/evas/canvas/evas_object_textgrid.c b/src/lib/evas/canvas/evas_object_textgrid.c
index 50a636d18b..e0404a67af 100644
--- a/src/lib/evas/canvas/evas_object_textgrid.c
+++ b/src/lib/evas/canvas/evas_object_textgrid.c
@@ -210,7 +210,7 @@ evas_object_textgrid_rows_clear(Evas_Object *eo_obj)
210} 210}
211 211
212static void 212static void
213evas_object_textgrid_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) 213evas_object_textgrid_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj EINA_UNUSED)
214{ 214{
215 Evas_Object_Textgrid_Color *c; 215 Evas_Object_Textgrid_Color *c;
216 Evas_Textgrid_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); 216 Evas_Textgrid_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
@@ -223,10 +223,10 @@ evas_object_textgrid_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
223 223
224 if (o->cur.font_description_normal) 224 if (o->cur.font_description_normal)
225 evas_font_desc_unref(o->cur.font_description_normal); 225 evas_font_desc_unref(o->cur.font_description_normal);
226 if (o->font_normal) evas_font_free(obj->layer->evas->evas, o->font_normal); 226 if (o->font_normal) evas_font_free(o->font_normal);
227 if (o->font_bold) evas_font_free(obj->layer->evas->evas, o->font_bold); 227 if (o->font_bold) evas_font_free(o->font_bold);
228 if (o->font_italic) evas_font_free(obj->layer->evas->evas, o->font_italic); 228 if (o->font_italic) evas_font_free(o->font_italic);
229 if (o->font_bolditalic) evas_font_free(obj->layer->evas->evas, o->font_bolditalic); 229 if (o->font_bolditalic) evas_font_free(o->font_bolditalic);
230 230
231 if (o->cur.cells) free(o->cur.cells); 231 if (o->cur.cells) free(o->cur.cells);
232 while ((c = eina_array_pop(&o->cur.palette_standard))) 232 while ((c = eina_array_pop(&o->cur.palette_standard)))
@@ -784,17 +784,17 @@ evas_object_textgrid_render_pre(Evas_Object *eo_obj,
784 if (r->ch1 >= 0) 784 if (r->ch1 >= 0)
785 { 785 {
786 Evas_Coord chx, chy, chw, chh; 786 Evas_Coord chx, chy, chw, chh;
787 787
788 chx = r->ch1 * o->cur.char_width; 788 chx = r->ch1 * o->cur.char_width;
789 chy = i * o->cur.char_height; 789 chy = i * o->cur.char_height;
790 chw = (r->ch2 - r->ch1 + 1) * o->cur.char_width; 790 chw = (r->ch2 - r->ch1 + 1) * o->cur.char_width;
791 chh = o->cur.char_height; 791 chh = o->cur.char_height;
792 792
793 chx -= o->cur.char_width; 793 chx -= o->cur.char_width;
794 chy -= o->cur.char_height; 794 chy -= o->cur.char_height;
795 chw += o->cur.char_width * 2; 795 chw += o->cur.char_width * 2;
796 chh += o->cur.char_height * 2; 796 chh += o->cur.char_height * 2;
797 797
798 chx += obj->cur->geometry.x; 798 chx += obj->cur->geometry.x;
799 chy += obj->cur->geometry.y; 799 chy += obj->cur->geometry.y;
800 RECTS_CLIP_TO_RECT(chx, chy, chw, chh, 800 RECTS_CLIP_TO_RECT(chx, chy, chw, chh,
@@ -808,7 +808,7 @@ evas_object_textgrid_render_pre(Evas_Object *eo_obj,
808 } 808 }
809 } 809 }
810 } 810 }
811 811
812 done: 812 done:
813 o->core_change = 0; 813 o->core_change = 0;
814 o->row_change = 0; 814 o->row_change = 0;
@@ -1003,11 +1003,12 @@ _alternate_font_weight_slant(Evas_Object_Protected_Data *obj,
1003 int ret = -1; 1003 int ret = -1;
1004 Evas_Font_Set *font; 1004 Evas_Font_Set *font;
1005 1005
1006 font = evas_font_load(obj->layer->evas->evas, 1006 font = evas_font_load(obj->layer->evas->font_path,
1007 obj->layer->evas->hinting,
1007 fdesc, 1008 fdesc,
1008 o->cur.font_source, 1009 o->cur.font_source,
1009 (int)(((double) o->cur.font_size) * 1010 (int)(((double) o->cur.font_size) *
1010 obj->cur->scale), 1011 obj->cur->scale),
1011 o->cur.bitmap_scalable); 1012 o->cur.bitmap_scalable);
1012 if (font) 1013 if (font)
1013 { 1014 {
@@ -1040,7 +1041,7 @@ _alternate_font_weight_slant(Evas_Object_Protected_Data *obj,
1040 (o->cur.char_height != vadvance) || 1041 (o->cur.char_height != vadvance) ||
1041 (o->ascent != ascent)) 1042 (o->ascent != ascent))
1042 { 1043 {
1043 evas_font_free(obj->layer->evas->evas, font); 1044 evas_font_free(font);
1044 } 1045 }
1045 else 1046 else
1046 { 1047 {
@@ -1080,16 +1081,17 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
1080 1081
1081 if (o->font_normal) 1082 if (o->font_normal)
1082 { 1083 {
1083 evas_font_free(obj->layer->evas->evas, o->font_normal); 1084 evas_font_free(o->font_normal);
1084 o->font_normal = NULL; 1085 o->font_normal = NULL;
1085 } 1086 }
1086 1087
1087 o->font_normal = evas_font_load(obj->layer->evas->evas, 1088 o->font_normal = evas_font_load(obj->layer->evas->font_path,
1088 o->cur.font_description_normal, 1089 obj->layer->evas->hinting,
1089 o->cur.font_source, 1090 o->cur.font_description_normal,
1090 (int)(((double) o->cur.font_size) * 1091 o->cur.font_source,
1091 obj->cur->scale), 1092 (int)(((double) o->cur.font_size) *
1092 o->cur.bitmap_scalable); 1093 obj->cur->scale),
1094 o->cur.bitmap_scalable);
1093 if (o->font_normal) 1095 if (o->font_normal)
1094 { 1096 {
1095 Eina_Unicode W[2] = { 'O', 0 }; 1097 Eina_Unicode W[2] = { 'O', 0 };
@@ -1133,7 +1135,7 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
1133 /* Bold */ 1135 /* Bold */
1134 if (o->font_bold) 1136 if (o->font_bold)
1135 { 1137 {
1136 evas_font_free(obj->layer->evas->evas, o->font_bold); 1138 evas_font_free(o->font_bold);
1137 o->font_bold = NULL; 1139 o->font_bold = NULL;
1138 } 1140 }
1139 if ((fdesc->weight == EVAS_FONT_WEIGHT_NORMAL) || 1141 if ((fdesc->weight == EVAS_FONT_WEIGHT_NORMAL) ||
@@ -1153,7 +1155,7 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
1153 /* Italic */ 1155 /* Italic */
1154 if (o->font_italic) 1156 if (o->font_italic)
1155 { 1157 {
1156 evas_font_free(obj->layer->evas->evas, o->font_italic); 1158 evas_font_free(o->font_italic);
1157 o->font_italic = NULL; 1159 o->font_italic = NULL;
1158 } 1160 }
1159 if (fdesc->slant == EVAS_FONT_SLANT_NORMAL) 1161 if (fdesc->slant == EVAS_FONT_SLANT_NORMAL)
@@ -1180,7 +1182,7 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
1180 /* BoldItalic */ 1182 /* BoldItalic */
1181 if (o->font_bolditalic) 1183 if (o->font_bolditalic)
1182 { 1184 {
1183 evas_font_free(obj->layer->evas->evas, o->font_bolditalic); 1185 evas_font_free(o->font_bolditalic);
1184 o->font_bolditalic = NULL; 1186 o->font_bolditalic = NULL;
1185 } 1187 }
1186 if (fdesc->slant == EVAS_FONT_SLANT_NORMAL && 1188 if (fdesc->slant == EVAS_FONT_SLANT_NORMAL &&
@@ -1384,7 +1386,7 @@ _evas_textgrid_palette_get(const Eo *eo_obj EINA_UNUSED, Evas_Textgrid_Data *o,
1384 default: 1386 default:
1385 return; 1387 return;
1386 } 1388 }
1387 1389
1388 if (idx >= (int)eina_array_count(palette)) return; 1390 if (idx >= (int)eina_array_count(palette)) return;
1389 color = eina_array_data_get(palette, idx); 1391 color = eina_array_data_get(palette, idx);
1390 if (!color) return; 1392 if (!color) return;
@@ -1437,16 +1439,16 @@ _evas_textgrid_update_add(Eo *eo_obj, Evas_Textgrid_Data *o, int x, int y, int w
1437{ 1439{
1438 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 1440 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
1439 int i, x2; 1441 int i, x2;
1440 1442
1441 RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, o->cur.w, o->cur.h); 1443 RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, o->cur.w, o->cur.h);
1442 if ((w <= 0) || (h <= 0)) return; 1444 if ((w <= 0) || (h <= 0)) return;
1443 1445
1444 evas_object_async_block(obj); 1446 evas_object_async_block(obj);
1445 x2 = x + w - 1; 1447 x2 = x + w - 1;
1446 for (i = 0; i < h; i++) 1448 for (i = 0; i < h; i++)
1447 { 1449 {
1448 Evas_Object_Textgrid_Row *r = &(o->cur.rows[y + i]); 1450 Evas_Object_Textgrid_Row *r = &(o->cur.rows[y + i]);
1449 1451
1450 if (r->ch1 < 0) 1452 if (r->ch1 < 0)
1451 { 1453 {
1452 evas_object_textgrid_row_clear(o, r); 1454 evas_object_textgrid_row_clear(o, r);
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 9e6a65859f..1409f39ebb 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -4001,7 +4001,7 @@ _evas_canvas_render_idle_flush(Eo *eo_e, Evas_Public_Data *evas)
4001 4001
4002 evas_render_rendering_wait(evas); 4002 evas_render_rendering_wait(evas);
4003 4003
4004 evas_fonts_zero_pressure(eo_e); 4004 evas_fonts_zero_pressure();
4005 4005
4006 if (ENFN && ENFN->output_idle_flush) 4006 if (ENFN && ENFN->output_idle_flush)
4007 { 4007 {
@@ -4125,7 +4125,7 @@ _evas_canvas_render_dump(Eo *eo_e, Evas_Public_Data *evas)
4125 GC_ALL(evas_object_image_load_opts_cow); 4125 GC_ALL(evas_object_image_load_opts_cow);
4126 GC_ALL(evas_object_image_state_cow); 4126 GC_ALL(evas_object_image_state_cow);
4127 4127
4128 evas_fonts_zero_pressure(eo_e); 4128 evas_fonts_zero_pressure();
4129 4129
4130 if (ENFN && ENFN->output_idle_flush) 4130 if (ENFN && ENFN->output_idle_flush)
4131 { 4131 {
diff --git a/src/lib/evas/canvas/render2/evas_render2_old.c b/src/lib/evas/canvas/render2/evas_render2_old.c
index 71eb7307b0..b310ccb267 100644
--- a/src/lib/evas/canvas/render2/evas_render2_old.c
+++ b/src/lib/evas/canvas/render2/evas_render2_old.c
@@ -433,7 +433,7 @@ _evas_render2_idle_flush(Eo *eo_e)
433 // wait for rendering to finish so we don't mess up shared resources 433 // wait for rendering to finish so we don't mess up shared resources
434 _evas_render2_wait(eo_e); 434 _evas_render2_wait(eo_e);
435 // clean fonts 435 // clean fonts
436 evas_fonts_zero_pressure(eo_e); 436 evas_fonts_zero_pressure();
437 // call engine idle flush call 437 // call engine idle flush call
438 if ((e->engine.func) && (e->engine.func->output_idle_flush) && 438 if ((e->engine.func) && (e->engine.func->output_idle_flush) &&
439 (e->engine.data.output)) 439 (e->engine.data.output))