diff options
author | Rafael Antognolli <antognolli@gmail.com> | 2012-06-22 20:31:31 +0000 |
---|---|---|
committer | Rafael Antognolli <antognolli@gmail.com> | 2012-06-22 20:31:31 +0000 |
commit | 2f3426b67c0d04e18669e182c6835b6844739609 (patch) | |
tree | 288c00d89da02e8b34840a8cf793ab8dc4cf692e /legacy/evas/src/lib/engines | |
parent | 64fecc2faba783ef63a719cbf2868458401cb61a (diff) |
evas/cserve2: CServe2 client side lib modifications.
Add the calls to request font loading and glyphs on the client lib.
SVN revision: 72700
Diffstat (limited to 'legacy/evas/src/lib/engines')
7 files changed, 105 insertions, 62 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_font.h b/legacy/evas/src/lib/engines/common/evas_font.h index ed6655bef5..3769b13975 100644 --- a/legacy/evas/src/lib/engines/common/evas_font.h +++ b/legacy/evas/src/lib/engines/common/evas_font.h | |||
@@ -37,17 +37,17 @@ EAPI void evas_common_font_size_use (RGBA_Font *fn); | |||
37 | EAPI RGBA_Font_Int *evas_common_font_int_load (const char *name, int size, Font_Rend_Flags wanted_rend); | 37 | EAPI RGBA_Font_Int *evas_common_font_int_load (const char *name, int size, Font_Rend_Flags wanted_rend); |
38 | EAPI RGBA_Font_Int *evas_common_font_int_load_init (RGBA_Font_Int *fn); | 38 | EAPI RGBA_Font_Int *evas_common_font_int_load_init (RGBA_Font_Int *fn); |
39 | EAPI RGBA_Font_Int *evas_common_font_int_load_complete (RGBA_Font_Int *fi); | 39 | EAPI RGBA_Font_Int *evas_common_font_int_load_complete (RGBA_Font_Int *fi); |
40 | EAPI RGBA_Font *evas_common_font_memory_load (const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend); | 40 | EAPI RGBA_Font *evas_common_font_memory_load (const char *source, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend); |
41 | EAPI RGBA_Font *evas_common_font_load (const char *name, int size, Font_Rend_Flags wanted_rend); | 41 | EAPI RGBA_Font *evas_common_font_load (const char *name, int size, Font_Rend_Flags wanted_rend); |
42 | EAPI RGBA_Font *evas_common_font_add (RGBA_Font *fn, const char *name, int size, Font_Rend_Flags wanted_rend); | 42 | EAPI RGBA_Font *evas_common_font_add (RGBA_Font *fn, const char *name, int size, Font_Rend_Flags wanted_rend); |
43 | EAPI RGBA_Font *evas_common_font_memory_add (RGBA_Font *fn, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend); | 43 | EAPI RGBA_Font *evas_common_font_memory_add (RGBA_Font *fn, const char *source, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend); |
44 | EAPI void evas_common_font_free (RGBA_Font *fn); | 44 | EAPI void evas_common_font_free (RGBA_Font *fn); |
45 | EAPI void evas_common_font_hinting_set (RGBA_Font *fn, Font_Hint_Flags hinting); | 45 | EAPI void evas_common_font_hinting_set (RGBA_Font *fn, Font_Hint_Flags hinting); |
46 | EAPI Eina_Bool evas_common_hinting_available (Font_Hint_Flags hinting); | 46 | EAPI Eina_Bool evas_common_hinting_available (Font_Hint_Flags hinting); |
47 | EAPI RGBA_Font *evas_common_font_memory_hinting_load (const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); | 47 | EAPI RGBA_Font *evas_common_font_memory_hinting_load (const char *source, const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); |
48 | EAPI RGBA_Font *evas_common_font_hinting_load (const char *name, int size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); | 48 | EAPI RGBA_Font *evas_common_font_hinting_load (const char *name, int size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); |
49 | EAPI RGBA_Font *evas_common_font_hinting_add (RGBA_Font *fn, const char *name, int size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); | 49 | EAPI RGBA_Font *evas_common_font_hinting_add (RGBA_Font *fn, const char *name, int size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); |
50 | EAPI RGBA_Font *evas_common_font_memory_hinting_add (RGBA_Font *fn, const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); | 50 | EAPI RGBA_Font *evas_common_font_memory_hinting_add (RGBA_Font *fn, const char *source, const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend); |
51 | EAPI void evas_common_font_int_modify_cache_by (RGBA_Font_Int *fi, int dir); | 51 | EAPI void evas_common_font_int_modify_cache_by (RGBA_Font_Int *fi, int dir); |
52 | EAPI int evas_common_font_cache_get (void); | 52 | EAPI int evas_common_font_cache_get (void); |
53 | EAPI void evas_common_font_cache_set (int size); | 53 | EAPI void evas_common_font_cache_set (int size); |
diff --git a/legacy/evas/src/lib/engines/common/evas_font_default_walk.x b/legacy/evas/src/lib/engines/common/evas_font_default_walk.x index f6e4520c4e..7636201160 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_default_walk.x +++ b/legacy/evas/src/lib/engines/common/evas_font_default_walk.x | |||
@@ -97,7 +97,7 @@ | |||
97 | 97 | ||
98 | #define EVAS_FONT_WALK_IS_VISIBLE (_glyph_itr->index != 0) | 98 | #define EVAS_FONT_WALK_IS_VISIBLE (_glyph_itr->index != 0) |
99 | #define EVAS_FONT_WALK_X_BEAR (_glyph_itr->x_bear) | 99 | #define EVAS_FONT_WALK_X_BEAR (_glyph_itr->x_bear) |
100 | #define EVAS_FONT_WALK_Y_BEAR (fg->glyph_out->top) | 100 | #define EVAS_FONT_WALK_Y_BEAR (_glyph_itr->y_bear) |
101 | #define EVAS_FONT_WALK_X_ADV ((_glyph_itr > text_props->info->glyph) ? \ | 101 | #define EVAS_FONT_WALK_X_ADV ((_glyph_itr > text_props->info->glyph) ? \ |
102 | _glyph_itr->pen_after - (_glyph_itr - 1)->pen_after : \ | 102 | _glyph_itr->pen_after - (_glyph_itr - 1)->pen_after : \ |
103 | _glyph_itr->pen_after) | 103 | _glyph_itr->pen_after) |
diff --git a/legacy/evas/src/lib/engines/common/evas_font_draw.c b/legacy/evas/src/lib/engines/common/evas_font_draw.c index 614e56ebc5..5a5bb7eb7a 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_draw.c +++ b/legacy/evas/src/lib/engines/common/evas_font_draw.c | |||
@@ -7,35 +7,6 @@ | |||
7 | 7 | ||
8 | #include "evas_font_ot.h" | 8 | #include "evas_font_ot.h" |
9 | 9 | ||
10 | struct prword | ||
11 | { | ||
12 | EINA_INLIST; | ||
13 | struct cinfo *cinfo; | ||
14 | Evas_Text_Props text_props; | ||
15 | DATA8 *im; | ||
16 | int roww; | ||
17 | int width; | ||
18 | int height; | ||
19 | int baseline; | ||
20 | }; | ||
21 | |||
22 | struct cinfo | ||
23 | { | ||
24 | FT_UInt index; | ||
25 | struct | ||
26 | { | ||
27 | int x, y; | ||
28 | } pos; | ||
29 | int posx; | ||
30 | RGBA_Font_Glyph *fg; | ||
31 | struct | ||
32 | { | ||
33 | int w,h; | ||
34 | int rows; | ||
35 | unsigned char *data; | ||
36 | } bm; | ||
37 | }; | ||
38 | |||
39 | typedef struct _Evas_Glyph Evas_Glyph; | 10 | typedef struct _Evas_Glyph Evas_Glyph; |
40 | struct _Evas_Glyph | 11 | struct _Evas_Glyph |
41 | { | 12 | { |
@@ -82,6 +53,11 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, in | |||
82 | fg = glyphs[it].fg; | 53 | fg = glyphs[it].fg; |
83 | idx = glyphs[it].idx; | 54 | idx = glyphs[it].idx; |
84 | 55 | ||
56 | glyphs[it].coord.w = fg->glyph_out->bitmap.width; | ||
57 | glyphs[it].coord.h = fg->glyph_out->bitmap.rows; | ||
58 | glyphs[it].j = fg->glyph_out->bitmap.pitch; | ||
59 | glyphs[it].data = fg->glyph_out->bitmap.buffer; | ||
60 | |||
85 | if (dc->font_ext.func.gl_new) | 61 | if (dc->font_ext.func.gl_new) |
86 | { | 62 | { |
87 | /* extension calls */ | 63 | /* extension calls */ |
@@ -102,11 +78,6 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, in | |||
102 | w = glyphs[it].coord.w; | 78 | w = glyphs[it].coord.w; |
103 | if (j < w) j = w; | 79 | if (j < w) j = w; |
104 | h = glyphs[it].coord.h; | 80 | h = glyphs[it].coord.h; |
105 | /* | ||
106 | if ((fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays) | ||
107 | && (fg->glyph_out->bitmap.num_grays == 256) | ||
108 | ) | ||
109 | */ | ||
110 | 81 | ||
111 | #ifdef HAVE_PIXMAN | 82 | #ifdef HAVE_PIXMAN |
112 | # ifdef PIXMAN_FONT | 83 | # ifdef PIXMAN_FONT |
@@ -260,6 +231,7 @@ EAPI void | |||
260 | evas_common_font_draw_prepare(Evas_Text_Props *text_props) | 231 | evas_common_font_draw_prepare(Evas_Text_Props *text_props) |
261 | { | 232 | { |
262 | RGBA_Font_Int *fi; | 233 | RGBA_Font_Int *fi; |
234 | RGBA_Font_Glyph *fg; | ||
263 | EVAS_FONT_WALK_TEXT_INIT(); | 235 | EVAS_FONT_WALK_TEXT_INIT(); |
264 | 236 | ||
265 | fi = text_props->font_instance; | 237 | fi = text_props->font_instance; |
@@ -285,7 +257,6 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props) | |||
285 | EVAS_FONT_WALK_TEXT_START() | 257 | EVAS_FONT_WALK_TEXT_START() |
286 | { | 258 | { |
287 | Evas_Glyph glyph; | 259 | Evas_Glyph glyph; |
288 | RGBA_Font_Glyph *fg; | ||
289 | FT_UInt idx; | 260 | FT_UInt idx; |
290 | 261 | ||
291 | if (!EVAS_FONT_WALK_IS_VISIBLE) continue; | 262 | if (!EVAS_FONT_WALK_IS_VISIBLE) continue; |
@@ -298,16 +269,16 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props) | |||
298 | glyph.fg = fg; | 269 | glyph.fg = fg; |
299 | glyph.coord.x = EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR; | 270 | glyph.coord.x = EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR; |
300 | glyph.coord.y = EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR; | 271 | glyph.coord.y = EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR; |
301 | glyph.coord.w = fg->glyph_out->bitmap.width; | ||
302 | glyph.coord.h = fg->glyph_out->bitmap.rows; | ||
303 | glyph.j = fg->glyph_out->bitmap.pitch; | ||
304 | glyph.idx = idx; | 272 | glyph.idx = idx; |
305 | glyph.data = fg->glyph_out->bitmap.buffer; | ||
306 | 273 | ||
307 | eina_binbuf_append_length(text_props->bin, (void*) &glyph, sizeof (Evas_Glyph)); | 274 | eina_binbuf_append_length(text_props->bin, (void*) &glyph, sizeof (Evas_Glyph)); |
308 | } | 275 | } |
309 | EVAS_FONT_WALK_TEXT_END(); | 276 | EVAS_FONT_WALK_TEXT_END(); |
310 | 277 | ||
278 | /* check if there's a request queue in fi, if so ask cserve2 to render | ||
279 | * those glyphs | ||
280 | */ | ||
281 | |||
311 | text_props->generation = fi->generation; | 282 | text_props->generation = fi->generation; |
312 | } | 283 | } |
313 | 284 | ||
diff --git a/legacy/evas/src/lib/engines/common/evas_font_load.c b/legacy/evas/src/lib/engines/common/evas_font_load.c index 8e0bc15ea6..2307fde8df 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_load.c +++ b/legacy/evas/src/lib/engines/common/evas_font_load.c | |||
@@ -6,6 +6,10 @@ | |||
6 | #include "evas_font_private.h" /* for Frame-Queuing support */ | 6 | #include "evas_font_private.h" /* for Frame-Queuing support */ |
7 | #include "evas_font_ot.h" | 7 | #include "evas_font_ot.h" |
8 | 8 | ||
9 | #ifdef EVAS_CSERVE2 | ||
10 | # include "../../cserve2/evas_cs2_private.h" | ||
11 | #endif | ||
12 | |||
9 | #ifdef USE_HARFBUZZ | 13 | #ifdef USE_HARFBUZZ |
10 | # include <hb.h> | 14 | # include <hb.h> |
11 | # include <hb-ft.h> | 15 | # include <hb-ft.h> |
@@ -85,6 +89,9 @@ _evas_common_font_int_free(RGBA_Font_Int *fi) | |||
85 | fonts_use_usage -= fi->usage; | 89 | fonts_use_usage -= fi->usage; |
86 | fi->usage = 0; | 90 | fi->usage = 0; |
87 | } | 91 | } |
92 | #ifdef EVAS_CSERVE2 | ||
93 | evas_cserve2_font_free(fi->cs2_handler); | ||
94 | #endif | ||
88 | free(fi); | 95 | free(fi); |
89 | } | 96 | } |
90 | 97 | ||
@@ -303,26 +310,43 @@ _evas_common_font_int_cache_init(RGBA_Font_Int *fi) | |||
303 | } | 310 | } |
304 | 311 | ||
305 | EAPI RGBA_Font_Int * | 312 | EAPI RGBA_Font_Int * |
306 | evas_common_font_int_memory_load(const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend) | 313 | evas_common_font_int_memory_load(const char *source, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend) |
307 | { | 314 | { |
308 | RGBA_Font_Int *fi; | 315 | RGBA_Font_Int *fi; |
316 | char *fake_name; | ||
309 | 317 | ||
310 | fi = evas_common_font_int_find(name, size, wanted_rend); | 318 | fake_name = evas_file_path_join(source, name); |
311 | if (fi) return fi; | 319 | fi = evas_common_font_int_find(fake_name, size, wanted_rend); |
320 | if (fi) | ||
321 | { | ||
322 | free(fake_name); | ||
323 | return fi; | ||
324 | } | ||
312 | fi = calloc(1, sizeof(RGBA_Font_Int)); | 325 | fi = calloc(1, sizeof(RGBA_Font_Int)); |
313 | if (!fi) return NULL; | 326 | if (!fi) |
314 | fi->src = evas_common_font_source_find(name); | 327 | { |
328 | free(fake_name); | ||
329 | return NULL; | ||
330 | } | ||
331 | fi->src = evas_common_font_source_find(fake_name); | ||
315 | if (!fi->src) | 332 | if (!fi->src) |
316 | fi->src = evas_common_font_source_memory_load(name, data, data_size); | 333 | fi->src = evas_common_font_source_memory_load(fake_name, data, data_size); |
317 | if (!fi->src) | 334 | if (!fi->src) |
318 | { | 335 | { |
319 | free(fi); | 336 | free(fi); |
337 | free(fake_name); | ||
320 | return NULL; | 338 | return NULL; |
321 | } | 339 | } |
322 | fi->size = size; | 340 | fi->size = size; |
323 | _evas_common_font_int_cache_init(fi); | 341 | _evas_common_font_int_cache_init(fi); |
324 | fi = evas_common_font_int_load_init(fi); | 342 | fi = evas_common_font_int_load_init(fi); |
325 | evas_common_font_int_load_complete(fi); | 343 | evas_common_font_int_load_complete(fi); |
344 | #ifdef EVAS_CSERVE2 | ||
345 | if (evas_cserve2_use_get()) | ||
346 | fi->cs2_handler = evas_cserve2_font_load(source, name, size, font_dpi, | ||
347 | wanted_rend); | ||
348 | #endif | ||
349 | free(fake_name); | ||
326 | return fi; | 350 | return fi; |
327 | } | 351 | } |
328 | 352 | ||
@@ -349,6 +373,11 @@ evas_common_font_int_load(const char *name, int size, | |||
349 | fi->wanted_rend = wanted_rend; | 373 | fi->wanted_rend = wanted_rend; |
350 | _evas_common_font_int_cache_init(fi); | 374 | _evas_common_font_int_cache_init(fi); |
351 | fi = evas_common_font_int_load_init(fi); | 375 | fi = evas_common_font_int_load_init(fi); |
376 | #ifdef EVAS_CSERVE2 | ||
377 | if (evas_cserve2_use_get()) | ||
378 | fi->cs2_handler = evas_cserve2_font_load(NULL, name, size, font_dpi, | ||
379 | wanted_rend); | ||
380 | #endif | ||
352 | // evas_common_font_int_load_complete(fi); | 381 | // evas_common_font_int_load_complete(fi); |
353 | return fi; | 382 | return fi; |
354 | } | 383 | } |
@@ -469,12 +498,12 @@ evas_common_font_int_load_complete(RGBA_Font_Int *fi) | |||
469 | } | 498 | } |
470 | 499 | ||
471 | EAPI RGBA_Font * | 500 | EAPI RGBA_Font * |
472 | evas_common_font_memory_load(const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend) | 501 | evas_common_font_memory_load(const char *source, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend) |
473 | { | 502 | { |
474 | RGBA_Font *fn; | 503 | RGBA_Font *fn; |
475 | RGBA_Font_Int *fi; | 504 | RGBA_Font_Int *fi; |
476 | 505 | ||
477 | fi = evas_common_font_int_memory_load(name, size, data, data_size, | 506 | fi = evas_common_font_int_memory_load(source, name, size, data, data_size, |
478 | wanted_rend); | 507 | wanted_rend); |
479 | if (!fi) return NULL; | 508 | if (!fi) return NULL; |
480 | fn = calloc(1, sizeof(RGBA_Font)); | 509 | fn = calloc(1, sizeof(RGBA_Font)); |
@@ -585,13 +614,13 @@ evas_common_font_add(RGBA_Font *fn, const char *name, int size, Font_Rend_Flags | |||
585 | } | 614 | } |
586 | 615 | ||
587 | EAPI RGBA_Font * | 616 | EAPI RGBA_Font * |
588 | evas_common_font_memory_add(RGBA_Font *fn, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend) | 617 | evas_common_font_memory_add(RGBA_Font *fn, const char *source, const char *name, int size, const void *data, int data_size, Font_Rend_Flags wanted_rend) |
589 | { | 618 | { |
590 | RGBA_Font_Int *fi; | 619 | RGBA_Font_Int *fi; |
591 | 620 | ||
592 | if (!fn) | 621 | if (!fn) |
593 | return NULL; | 622 | return NULL; |
594 | fi = evas_common_font_int_memory_load(name, size, data, data_size, wanted_rend); | 623 | fi = evas_common_font_int_memory_load(source, name, size, data, data_size, wanted_rend); |
595 | if (fi) | 624 | if (fi) |
596 | { | 625 | { |
597 | fn->fonts = eina_list_append(fn->fonts, fi); | 626 | fn->fonts = eina_list_append(fn->fonts, fi); |
@@ -681,11 +710,11 @@ evas_common_hinting_available(Font_Hint_Flags hinting) | |||
681 | } | 710 | } |
682 | 711 | ||
683 | EAPI RGBA_Font * | 712 | EAPI RGBA_Font * |
684 | evas_common_font_memory_hinting_load(const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend) | 713 | evas_common_font_memory_hinting_load(const char *source, const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend) |
685 | { | 714 | { |
686 | RGBA_Font *fn; | 715 | RGBA_Font *fn; |
687 | 716 | ||
688 | fn = evas_common_font_memory_load(name, size, data, data_size, wanted_rend); | 717 | fn = evas_common_font_memory_load(source, name, size, data, data_size, wanted_rend); |
689 | if (fn) evas_common_font_hinting_set(fn, hinting); | 718 | if (fn) evas_common_font_hinting_set(fn, hinting); |
690 | return fn; | 719 | return fn; |
691 | } | 720 | } |
@@ -709,9 +738,9 @@ evas_common_font_hinting_add(RGBA_Font *fn, const char *name, int size, Font_Hin | |||
709 | } | 738 | } |
710 | 739 | ||
711 | EAPI RGBA_Font * | 740 | EAPI RGBA_Font * |
712 | evas_common_font_memory_hinting_add(RGBA_Font *fn, const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend) | 741 | evas_common_font_memory_hinting_add(RGBA_Font *fn, const char *source, const char *name, int size, const void *data, int data_size, Font_Hint_Flags hinting, Font_Rend_Flags wanted_rend) |
713 | { | 742 | { |
714 | fn = evas_common_font_memory_add(fn, name, size, data, data_size, | 743 | fn = evas_common_font_memory_add(fn, source, name, size, data, data_size, |
715 | wanted_rend); | 744 | wanted_rend); |
716 | if (fn) evas_common_font_hinting_set(fn, hinting); | 745 | if (fn) evas_common_font_hinting_set(fn, hinting); |
717 | return fn; | 746 | return fn; |
@@ -749,6 +778,7 @@ _evas_common_font_int_clear(RGBA_Font_Int *fi) | |||
749 | FT_Done_Glyph(fg->glyph); | 778 | FT_Done_Glyph(fg->glyph); |
750 | /* extension calls */ | 779 | /* extension calls */ |
751 | if (fg->ext_dat_free) fg->ext_dat_free(fg->ext_dat); | 780 | if (fg->ext_dat_free) fg->ext_dat_free(fg->ext_dat); |
781 | if (fg->glyph_out_free) fg->glyph_out_free(fg->glyph_out); | ||
752 | free(fg); | 782 | free(fg); |
753 | fmap->item[i] = NULL; | 783 | fmap->item[i] = NULL; |
754 | } | 784 | } |
diff --git a/legacy/evas/src/lib/engines/common/evas_font_main.c b/legacy/evas/src/lib/engines/common/evas_font_main.c index c09c46b83d..2240fdf57c 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_main.c +++ b/legacy/evas/src/lib/engines/common/evas_font_main.c | |||
@@ -3,6 +3,10 @@ | |||
3 | 3 | ||
4 | #include "evas_font_private.h" | 4 | #include "evas_font_private.h" |
5 | 5 | ||
6 | #ifdef EVAS_CSERVE2 | ||
7 | # include "../../cserve2/evas_cs2_private.h" | ||
8 | #endif | ||
9 | |||
6 | #include <assert.h> | 10 | #include <assert.h> |
7 | 11 | ||
8 | #include FT_OUTLINE_H | 12 | #include FT_OUTLINE_H |
@@ -364,7 +368,15 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx) | |||
364 | { | 368 | { |
365 | fg = _fash_gl_find(fi->fash, idx); | 369 | fg = _fash_gl_find(fi->fash, idx); |
366 | if (fg == (void *)(-1)) return NULL; | 370 | if (fg == (void *)(-1)) return NULL; |
367 | else if (fg) return fg; | 371 | else if (fg) |
372 | { | ||
373 | #ifdef EVAS_CSERVE2 | ||
374 | if (fi->cs2_handler) | ||
375 | evas_cserve2_font_glyph_used(fi->cs2_handler, idx, | ||
376 | fi->hinting); | ||
377 | #endif | ||
378 | return fg; | ||
379 | } | ||
368 | } | 380 | } |
369 | // fg = eina_hash_find(fi->glyphs, &hindex); | 381 | // fg = eina_hash_find(fi->glyphs, &hindex); |
370 | // if (fg) return fg; | 382 | // if (fg) return fg; |
@@ -413,6 +425,7 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx) | |||
413 | &outbox); | 425 | &outbox); |
414 | fg->width = EVAS_FONT_ROUND_26_6_TO_INT(outbox.xMax - outbox.xMin); | 426 | fg->width = EVAS_FONT_ROUND_26_6_TO_INT(outbox.xMax - outbox.xMin); |
415 | fg->x_bear = EVAS_FONT_ROUND_26_6_TO_INT(outbox.xMin); | 427 | fg->x_bear = EVAS_FONT_ROUND_26_6_TO_INT(outbox.xMin); |
428 | fg->y_bear = EVAS_FONT_ROUND_26_6_TO_INT(outbox.yMax); | ||
416 | } | 429 | } |
417 | 430 | ||
418 | fg->index = idx; | 431 | fg->index = idx; |
@@ -421,6 +434,11 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx) | |||
421 | if (!fi->fash) fi->fash = _fash_gl_new(); | 434 | if (!fi->fash) fi->fash = _fash_gl_new(); |
422 | if (fi->fash) _fash_gl_add(fi->fash, idx, fg); | 435 | if (fi->fash) _fash_gl_add(fi->fash, idx, fg); |
423 | 436 | ||
437 | #ifdef EVAS_CSERVE2 | ||
438 | if (fi->cs2_handler) | ||
439 | evas_cserve2_font_glyph_request(fi->cs2_handler, idx, fi->hinting); | ||
440 | #endif | ||
441 | |||
424 | // eina_hash_direct_add(fi->glyphs, &fg->index, fg); | 442 | // eina_hash_direct_add(fi->glyphs, &fg->index, fg); |
425 | return fg; | 443 | return fg; |
426 | } | 444 | } |
@@ -431,6 +449,20 @@ evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *fg) | |||
431 | int size; | 449 | int size; |
432 | FT_Error error; | 450 | FT_Error error; |
433 | RGBA_Font_Int *fi = fg->fi; | 451 | RGBA_Font_Int *fi = fg->fi; |
452 | FT_BitmapGlyph fbg; | ||
453 | |||
454 | #ifdef EVAS_CSERVE2 | ||
455 | if (fi->cs2_handler) | ||
456 | { | ||
457 | fg->glyph_out = evas_cserve2_font_glyph_bitmap_get(fi->cs2_handler, | ||
458 | fg->index, | ||
459 | fg->fi->hinting); | ||
460 | if (fg->glyph_out) | ||
461 | return EINA_TRUE; | ||
462 | } | ||
463 | #endif | ||
464 | |||
465 | /* no cserve2 case */ | ||
434 | FTLOCK(); | 466 | FTLOCK(); |
435 | error = FT_Glyph_To_Bitmap(&(fg->glyph), FT_RENDER_MODE_NORMAL, 0, 1); | 467 | error = FT_Glyph_To_Bitmap(&(fg->glyph), FT_RENDER_MODE_NORMAL, 0, 1); |
436 | if (error) | 468 | if (error) |
@@ -444,7 +476,17 @@ evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *fg) | |||
444 | } | 476 | } |
445 | FTUNLOCK(); | 477 | FTUNLOCK(); |
446 | 478 | ||
447 | fg->glyph_out = (FT_BitmapGlyph)fg->glyph; | 479 | fbg = (FT_BitmapGlyph)fg->glyph; |
480 | |||
481 | fg->glyph_out = malloc(sizeof(RGBA_Font_Glyph_Out)); | ||
482 | fg->glyph_out->bitmap.rows = fbg->bitmap.rows; | ||
483 | fg->glyph_out->bitmap.width = fbg->bitmap.width; | ||
484 | fg->glyph_out->bitmap.pitch = fbg->bitmap.pitch; | ||
485 | fg->glyph_out->bitmap.buffer = fbg->bitmap.buffer; | ||
486 | fg->glyph_out->bitmap.num_grays = fbg->bitmap.num_grays; | ||
487 | fg->glyph_out->bitmap.pixel_mode = fbg->bitmap.pixel_mode; | ||
488 | |||
489 | fg->glyph_out_free = free; | ||
448 | /* This '+ 200' is just an estimation of how much memory freetype will use | 490 | /* This '+ 200' is just an estimation of how much memory freetype will use |
449 | * on it's size. This value is not really used anywhere in code - it's | 491 | * on it's size. This value is not really used anywhere in code - it's |
450 | * only for statistics. */ | 492 | * only for statistics. */ |
diff --git a/legacy/evas/src/lib/engines/common/evas_text_utils.c b/legacy/evas/src/lib/engines/common/evas_text_utils.c index b2e291eb41..dca75f6cd3 100644 --- a/legacy/evas/src/lib/engines/common/evas_text_utils.c +++ b/legacy/evas/src/lib/engines/common/evas_text_utils.c | |||
@@ -317,6 +317,7 @@ _content_create_ot(RGBA_Font_Int *fi, const Eina_Unicode *text, | |||
317 | LKU(fi->ft_mutex); | 317 | LKU(fi->ft_mutex); |
318 | 318 | ||
319 | gl_itr->x_bear = fg->x_bear; | 319 | gl_itr->x_bear = fg->x_bear; |
320 | gl_itr->y_bear = fg->y_bear; | ||
320 | gl_itr->width = fg->width; | 321 | gl_itr->width = fg->width; |
321 | /* text_props->info->glyph[char_index].advance = | 322 | /* text_props->info->glyph[char_index].advance = |
322 | * text_props->info->glyph[char_index].index = | 323 | * text_props->info->glyph[char_index].index = |
@@ -435,6 +436,7 @@ _content_create_regular(RGBA_Font_Int *fi, const Eina_Unicode *text, | |||
435 | 436 | ||
436 | gl_itr->index = idx; | 437 | gl_itr->index = idx; |
437 | gl_itr->x_bear = fg->x_bear; | 438 | gl_itr->x_bear = fg->x_bear; |
439 | gl_itr->y_bear = fg->y_bear; | ||
438 | adv = fg->glyph->advance.x >> 10; | 440 | adv = fg->glyph->advance.x >> 10; |
439 | gl_itr->width = fg->width; | 441 | gl_itr->width = fg->width; |
440 | 442 | ||
diff --git a/legacy/evas/src/lib/engines/common/evas_text_utils.h b/legacy/evas/src/lib/engines/common/evas_text_utils.h index e30827db9b..a10ce7d569 100644 --- a/legacy/evas/src/lib/engines/common/evas_text_utils.h +++ b/legacy/evas/src/lib/engines/common/evas_text_utils.h | |||
@@ -50,12 +50,10 @@ struct _Evas_Font_Glyph_Info | |||
50 | { | 50 | { |
51 | unsigned int index; /* Should conform to FT */ | 51 | unsigned int index; /* Should conform to FT */ |
52 | Evas_Coord x_bear; | 52 | Evas_Coord x_bear; |
53 | #if 0 | ||
54 | /* This one is rarely used, only in draw, in which we already get the glyph | 53 | /* This one is rarely used, only in draw, in which we already get the glyph |
55 | * so it doesn't really save time. Leaving it here just so no one will | 54 | * so it doesn't really save time. Leaving it here just so no one will |
56 | * add it thinking it was accidentally skipped */ | 55 | * add it thinking it was accidentally skipped */ |
57 | Evas_Coord y_bear; | 56 | Evas_Coord y_bear; |
58 | #endif | ||
59 | Evas_Coord width; | 57 | Evas_Coord width; |
60 | Evas_Coord pen_after; | 58 | Evas_Coord pen_after; |
61 | }; | 59 | }; |