Enlightenment CVS committal Author : shorne Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/common Modified Files: evas_font_load.c Log Message: Fix problem with fonts that cant load completely * fix reference counting for font_int(s) * properly backout if face doesnt load correctly, this way we dont end up using the face again * put some comments about fudged font cache =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_font_load.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -3 -r1.40 -r1.41 --- evas_font_load.c 13 Nov 2006 23:23:43 -0000 1.40 +++ evas_font_load.c 5 May 2007 10:30:11 -0000 1.41 @@ -69,11 +69,20 @@ int error; error = FT_New_Face(evas_ft_lib, fs->file, 0, &(fs->ft.face)); - if (error) return error; + if (error) + { + fs->ft.face = NULL; + return error; + } error = FT_Select_Charmap(fs->ft.face, ft_encoding_unicode); - if (error) return error; - + if (error) + { + FT_Done_Face(fs->ft.face); + fs->ft.face = NULL; + return error; + } + fs->ft.orig_upem = fs->ft.face->units_per_EM; return error; } @@ -123,6 +132,7 @@ RGBA_Font_Int *fi; fi = l->data; + if (fi->src->current_size != fi->size) { FT_Activate_Size(fi->ft.size); @@ -278,6 +288,7 @@ fi = evas_common_font_int_load(name, size); if (!fi) return NULL; + /* First font, complete load */ if (!fi->ft.size) { @@ -285,9 +296,12 @@ { if (evas_common_font_source_load_complete(fi->src)) { - fonts = evas_object_list_remove(fonts, fi); - evas_common_font_source_free(fi->src); - free(fi); + fi->references--; + if (fi->references == 0) + { + evas_common_font_int_modify_cache_by(fi, 1); + evas_common_font_flush(); + } return NULL; } } @@ -297,7 +311,12 @@ fn = calloc(1, sizeof(RGBA_Font)); if (!fn) { - free(fi); + fi->references--; + if (fi->references == 0) + { + evas_common_font_int_modify_cache_by(fi, 1); + evas_common_font_flush(); + } return NULL; } fn->fonts = evas_list_append(fn->fonts, fi); @@ -472,6 +491,10 @@ key = 0; } +/* when the fi->references == 0 we increase this instead of really deleting + * we then check if the cache_useage size is larger than allowed + * !If the cache is NOT too large we dont delete font_int + * !If the cache is too large we really delete font_int */ EAPI void evas_common_font_int_modify_cache_by(RGBA_Font_Int *fi, int dir) { @@ -519,6 +542,9 @@ fdata = 0; } +/* We run this when the cache gets larger than allowed size + * We check cache size each time a fi->references goes to 0 + * PERFORMS: Find font_int(s) with references == 0 and delete them */ EAPI void evas_common_font_flush_last(void) { ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs