Evas font: Fixed font cache to correctly handle different font sizes.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 26 Jul 2012 11:31:36 +0000 (11:31 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 26 Jul 2012 11:31:36 +0000 (11:31 +0000)
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.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@74435 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_font_dir.c

index aa0d9c3..551d8d9 100644 (file)
@@ -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 */
      {