Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/buffer Modified Files: evas_engine.c Log Message: werd to my homies... this had to happen sooner or later.... evas supports FONTSETS! so u can do Vera,Kochi,Blah ... etc. as the font name it will fall back font by font until it finds a char or finally fails. this is for internationalisation support... WHERD! =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/buffer/evas_engine.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- evas_engine.c 2 Mar 2005 04:18:41 -0000 1.14 +++ evas_engine.c 20 Mar 2005 15:57:55 -0000 1.15 @@ -70,6 +70,8 @@ static int evas_engine_buffer_image_cache_get(void *data); static void *evas_engine_buffer_font_load(void *data, char *name, int size); static void *evas_engine_buffer_font_memory_load(void *data, char *name, int size, const void *fdata, int fdata_size); +static void *evas_engine_buffer_font_add(void *data, void *font, char *name, int size); +static void *evas_engine_buffer_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size); static void evas_engine_buffer_font_free(void *data, void *font); static int evas_engine_buffer_font_ascent_get(void *data, void *font); static int evas_engine_buffer_font_descent_get(void *data, void *font); @@ -156,6 +158,8 @@ /* font draw functions */ evas_engine_buffer_font_load, evas_engine_buffer_font_memory_load, + evas_engine_buffer_font_add, + evas_engine_buffer_font_memory_add, evas_engine_buffer_font_free, evas_engine_buffer_font_ascent_get, evas_engine_buffer_font_descent_get, @@ -939,6 +943,24 @@ return evas_common_font_memory_load(name, size, fdata, fdata_size); } +static void * +evas_engine_buffer_font_add(void *data, void *font, char *name, int size) +{ + Render_Engine *re; + + re = (Render_Engine *)data; + return evas_common_font_add(font, name, size); +} + +static void * +evas_engine_buffer_font_memory_add(void *data, void *font, char *name, int size, const void *fdata, int fdata_size) +{ + Render_Engine *re; + + re = (Render_Engine *)data; + return evas_common_font_memory_add(font, name, size, fdata, fdata_size); +} + static void evas_engine_buffer_font_free(void *data, void *font) { @@ -1054,7 +1076,7 @@ evas_common_font_draw(surface, context, font, x, y, text); else { - /* create output surface size render_w x render_h, draw text in adapted size, and scale to w x h */ + /* create output surface size ow x oh and scale to w x h */ RGBA_Draw_Context *dc, *dc_in; dc_in = context; @@ -1064,45 +1086,26 @@ RGBA_Image *im; int inset; - if ((h * ow) < (w * oh)) - { - mult = w; - divv = ow; - } - else - { - mult = h; - divv = oh; - } - render_w = (ow * mult) / divv; - render_h = (oh * mult) / divv; - - newfont = evas_common_font_load( ((RGBA_Font *)font)->src->name, (((RGBA_Font *)font)->size*mult)/divv); - dc->col.col = dc_in->col.col; inset = evas_common_font_query_inset( font, text); - im = evas_common_image_create(render_w+inset, render_h); + im = evas_common_image_create(ow+inset, oh); if (im) { int max_ascent; int i, j; im->flags |= RGBA_IMAGE_HAS_ALPHA; - j = (render_w+inset) * render_h; - for (i = 0; i < j; i++) im->image->data[i] = (dc->col.col & 0xffffff); + j = (ow+inset) * oh; + memset(im->image->data, 0, j * sizeof(DATA32)); + + max_ascent = evas_common_font_max_ascent_get(font); - if (newfont) - { - max_ascent = evas_common_font_max_ascent_get(newfont); - - evas_common_font_draw(im, dc, newfont, 0, max_ascent, text); - evas_common_cpu_end_opt(); - evas_common_scale_rgba_in_to_out_clip_smooth(im, surface, context, - inset, 0, render_w, render_h, - x + ((inset * w) / render_w), y - ((max_ascent * h) / render_h), - w, h); - evas_common_font_free(newfont); - } + evas_common_font_draw(im, dc, font, 0, max_ascent, text); + evas_common_cpu_end_opt(); + evas_common_scale_rgba_in_to_out_clip_smooth(im, surface, context, + inset, 0, ow, oh, + x + ((inset * w) / ow), y - ((max_ascent * h) / oh), + w, h); evas_common_image_free(im); } evas_common_draw_context_free(dc); ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs