From 6c9804fba90ee9f8d4d80a6f20526d08c4dec4bc Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 26 Jul 2012 11:31:36 +0000 Subject: [PATCH] Evas font: Fixed font cache to correctly handle different font sizes. Used to just go for the first match in the cache which means it would always think we only have the wrong size in the cache, and it would just add new entries all the time. SVN revision: 74435 --- legacy/evas/src/lib/canvas/evas_font_dir.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/legacy/evas/src/lib/canvas/evas_font_dir.c b/legacy/evas/src/lib/canvas/evas_font_dir.c index aa0d9c3299..551d8d9a26 100644 --- a/legacy/evas/src/lib/canvas/evas_font_dir.c +++ b/legacy/evas/src/lib/canvas/evas_font_dir.c @@ -495,6 +495,7 @@ evas_font_load(Evas *evas, Evas_Font_Description *fdesc, const char *source, Eva Evas_Font_Set *font = NULL; Eina_List *fonts, *l; Fndat *fd; + Fndat *found_fd = NULL; char *nm; Font_Rend_Flags wanted_rend = 0; @@ -525,15 +526,19 @@ evas_font_load(Evas *evas, Evas_Font_Description *fdesc, const char *source, Eva #ifdef HAVE_FONTCONFIG else if (fd->set && fd->p_nm) { - font = evas_load_fontconfig(evas, fd->set, size, - wanted_rend); - goto on_find; + found_fd = fd; } #endif } } } + if (found_fd) + { + font = evas_load_fontconfig(evas, found_fd->set, size, wanted_rend); + goto on_find; + } + EINA_LIST_FOREACH(fonts_zero, l, fd) { if (!evas_font_desc_cmp(fdesc, fd->fdesc)) @@ -552,15 +557,19 @@ evas_font_load(Evas *evas, Evas_Font_Description *fdesc, const char *source, Eva #ifdef HAVE_FONTCONFIG else if (fd->set && fd->p_nm) { - font = evas_load_fontconfig(evas, fd->set, size, - wanted_rend); - goto on_find; + found_fd = fd; } #endif } } } + if (found_fd) + { + font = evas_load_fontconfig(evas, found_fd->set, size, wanted_rend); + goto on_find; + } + fonts = evas_font_set_get(fdesc->name); EINA_LIST_FOREACH(fonts, l, nm) /* Load each font in append */ {