Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h text.c theme.c ttfont.c 


Log Message:
Use TT font path. Enable specifying additional font paths.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.469
retrieving revision 1.470
diff -u -3 -r1.469 -r1.470
--- E.h 16 Jul 2005 15:53:52 -0000      1.469
+++ E.h 16 Jul 2005 16:35:38 -0000      1.470
@@ -959,6 +959,7 @@
    {
       char               *name;
       char               *extra_path;
+      char               *ttfont_path;
    } theme;
 #ifdef ENABLE_THEME_TRANSPARENCY
    struct
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/text.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- text.c      16 Jul 2005 15:53:53 -0000      1.55
+++ text.c      16 Jul 2005 16:35:39 -0000      1.56
@@ -151,23 +151,15 @@
 
    /* Try FreeType */
    {
-      char                s[4096], w[4046], *s2, *ss;
+      char                s[4096], *s2, *ss;
 
-      s2 = NULL;
       s2 = Estrdup(ts->fontname);
       ss = strchr(s2, '/');
       if (ss)
        {
-          *ss = ' ';
-          word(s2, 1, w);
-          Esnprintf(s, sizeof(s), "ttfonts/%s.ttf", w);
-          word(s2, 2, w);
-          ss = ThemeFileFind(s);
-          if (ss)
-            {
-               ts->efont = Efont_load(ss, atoi(w));
-               Efree(ss);
-            }
+          *ss++ = '\0';
+          Esnprintf(s, sizeof(s), "%s.ttf", s2);
+          ts->efont = Efont_load(s2, atoi(ss));
        }
       if (s2)
         Efree(s2);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/theme.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- theme.c     16 Jul 2005 15:53:53 -0000      1.49
+++ theme.c     16 Jul 2005 16:35:39 -0000      1.50
@@ -485,6 +485,7 @@
 static const CfgItem ThemeCfgItems[] = {
    CFG_ITEM_STR(Conf.theme, name),
    CFG_ITEM_STR(Conf.theme, extra_path),
+   CFG_ITEM_STR(Conf.theme, ttfont_path),
 };
 #define N_CFG_ITEMS (sizeof(ThemeCfgItems)/sizeof(CfgItem))
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ttfont.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- ttfont.c    7 May 2005 11:20:01 -0000       1.43
+++ ttfont.c    16 Jul 2005 16:35:39 -0000      1.44
@@ -42,6 +42,21 @@
    imlib_context_set_color(r, g, b, 255);
 }
 
+static void
+EFonts_Init(void)
+{
+   char                s[4096];
+   char              **lst;
+   int                 i, num;
+
+   Esnprintf(s, sizeof(s), "%s/ttfonts", Mode.theme.path);
+   imlib_add_path_to_font_path(s);
+   lst = StrlistFromString(Conf.theme.ttfont_path, ':', &num);
+   for (i = 0; i < num; i++)
+      imlib_add_path_to_font_path(lst[i]);
+   StrlistFree(lst, num);
+}
+
 void
 EFont_draw_string(Display * dpy, Drawable win, GC gc, int x, int y,
                  const char *text, Efont * f, Visual * vis __UNUSED__,
@@ -79,10 +94,17 @@
 Efont              *
 Efont_load(const char *file, int size)
 {
+   static char         ttfont_path_set = 0;
    char                s[4096];
    Efont              *f;
    Imlib_Font         *ff;
 
+   if (!ttfont_path_set)
+     {
+       EFonts_Init();
+       ttfont_path_set = 1;
+     }
+
    Esnprintf(s, sizeof(s), "%s/%d", file, size);
    ff = imlib_load_font(s);
    if (ff == NULL)




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to