Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/dox


Modified Files:
        dox.h format.c text.c 


Log Message:
edox: Deactivate use of XFontStruct (use XFontSet).

===================================================================
RCS file: /cvs/e/e16/e/dox/dox.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- dox.h       21 Oct 2007 13:14:10 -0000      1.43
+++ dox.h       22 Dec 2007 11:46:39 -0000      1.44
@@ -56,8 +56,6 @@
 #define EAllocColor(pxc) \
        XAllocColor(disp, VRoot.cmap, pxc)
 
-#define FILEPATH_LEN_MAX 4096
-
 #ifndef MAX
 #define MAX(a,b)  ((a)>(b)?(a):(b))
 #endif
@@ -66,6 +64,8 @@
 #define USE_WORD_MB
 #endif
 
+#define USE_XFONT 0
+
 typedef struct _efont Efont;
 
 typedef struct _root
@@ -85,7 +85,9 @@
    XColor              bg_col;
    int                 effect;
    Efont              *efont;
+#if USE_XFONT
    XFontStruct        *xfont;
+#endif
    XFontSet            xfontset;
    int                 xfontset_ascent;
    int                 height;
===================================================================
RCS file: /cvs/e/e16/e/dox/format.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- format.c    21 Oct 2007 13:14:10 -0000      1.23
+++ format.c    22 Dec 2007 11:46:39 -0000      1.24
@@ -569,15 +569,7 @@
    Imlib_Image         im;
    int                 wastext = 0;
 
-   ts.fontname = NULL;
-   ESetColor(&ts.fg_col, 0, 0, 0);
-   ESetColor(&ts.bg_col, 0, 0, 0);
-   ts.effect = 0;
-   ts.efont = NULL;
-   ts.xfont = NULL;
-   ts.xfontset = 0;
-   ts.xfontset_ascent = 0;
-   ts.height = 0;
+   memset(&ts, 0, sizeof(ts));
    pg = &(page[page_num]);
    x = pg->padding;
    y = pg->padding;
@@ -649,9 +641,11 @@
             if (ts.efont)
                Efont_free(ts.efont);
             ts.efont = NULL;
+#if USE_XFONT
             if (ts.xfont)
                XFreeFont(disp, ts.xfont);
             ts.xfont = NULL;
+#endif
             if (ts.xfontset)
                XFreeFontSet(disp, ts.xfontset);
             ts.xfontset = NULL;
@@ -1040,8 +1034,10 @@
 
    if (ts.efont)
       Efont_free(ts.efont);
+#if USE_XFONT
    if (ts.xfont)
       XFreeFont(disp, ts.xfont);
+#endif
    if (ts.xfontset)
       XFreeFontSet(disp, ts.xfontset);
 
===================================================================
RCS file: /cvs/e/e16/e/dox/text.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- text.c      21 Oct 2007 13:14:10 -0000      1.23
+++ text.c      22 Dec 2007 11:46:39 -0000      1.24
@@ -57,7 +57,11 @@
 void
 TextStateLoadFont(TextState * ts)
 {
+#if USE_XFONT
    if ((ts->efont) || (ts->xfont) || (ts->xfontset))
+#else
+   if ((ts->efont) || (ts->xfontset))
+#endif
       return;
 
    if (!ts->fontname)
@@ -89,46 +93,48 @@
          }
        if (s2)
           free(s2);
+       if (ts->efont)
+          return;
      }
 
-   if (!ts->efont)
+#if USE_XFONT
+   if ((!ts->xfont) && (strchr(ts->fontname, ',') == NULL))
      {
-       if ((!ts->xfont) && (strchr(ts->fontname, ',') == NULL))
+       ts->xfont = XLoadQueryFont(disp, ts->fontname);
+       if (ts->xfont)
          {
-            ts->xfont = XLoadQueryFont(disp, ts->fontname);
-            if (ts->xfont)
-              {
-                 ts->xfontset_ascent = ts->xfont->ascent;
-                 ts->height = ts->xfont->ascent + ts->xfont->descent;
-              }
-         }
-       else if (!ts->xfontset)
-         {
-            int                 i, missing_cnt, font_cnt;
-            int                 descent;
-            char              **missing_list, *def_str, **fn;
-            XFontStruct       **fs;
-
-            ts->xfontset = XCreateFontSet(disp, ts->fontname, &missing_list,
-                                          &missing_cnt, &def_str);
-            if (missing_cnt)
-              {
-                 XFreeStringList(missing_list);
-                 return;
-              }
-            if (!ts->xfontset)
-               return;
-            font_cnt = XFontsOfFontSet(ts->xfontset, &fs, &fn);
-            ts->xfontset_ascent = 0;
-            for (i = 0; i < font_cnt; i++)
-               ts->xfontset_ascent = MAX(fs[i]->ascent, ts->xfontset_ascent);
-            descent = 0;
-            for (i = 0; i < font_cnt; i++)
-               descent = MAX(fs[i]->descent, descent);
-            ts->height = ts->xfontset_ascent + descent;
+            ts->xfontset_ascent = ts->xfont->ascent;
+            ts->height = ts->xfont->ascent + ts->xfont->descent;
+            return;
          }
      }
-   return;
+#endif
+
+   if (!ts->xfontset)
+     {
+       int                 i, missing_cnt, font_cnt;
+       int                 descent;
+       char              **missing_list, *def_str, **fn;
+       XFontStruct       **fs;
+
+       ts->xfontset = XCreateFontSet(disp, ts->fontname, &missing_list,
+                                     &missing_cnt, &def_str);
+       if (missing_cnt)
+         {
+            XFreeStringList(missing_list);
+            return;
+         }
+       if (!ts->xfontset)
+          return;
+       font_cnt = XFontsOfFontSet(ts->xfontset, &fs, &fn);
+       ts->xfontset_ascent = 0;
+       for (i = 0; i < font_cnt; i++)
+          ts->xfontset_ascent = MAX(fs[i]->ascent, ts->xfontset_ascent);
+       descent = 0;
+       for (i = 0; i < font_cnt; i++)
+          descent = MAX(fs[i]->descent, descent);
+       ts->height = ts->xfontset_ascent + descent;
+     }
 }
 
 void
@@ -175,6 +181,7 @@
                *width = ret2.width;
          }
      }
+#if USE_XFONT
    else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) &&
            (ts->xfont->max_byte1 == 0))
      {
@@ -201,6 +208,7 @@
                *width = wid;
          }
      }
+#endif /* USE_XFONT */
    freestrlist(lines, num_lines);
    return;
    fsize = 0;
@@ -306,6 +314,7 @@
             yy += ret2.height;
          }
      }
+#if USE_XFONT
    else if ((ts->xfont) && (ts->xfont->min_byte1 == 0) &&
            (ts->xfont->max_byte1 == 0))
      {
@@ -383,6 +392,7 @@
             yy += ts->xfont->ascent + ts->xfont->descent;
          }
      }
+#endif /* USE_XFONT */
    freestrlist(lines, num_lines);
    return;
    h = fsize = 0;



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to