[pardon me for resending this message, the original one seems to never
have made it to the list]

Attached is a patch version ion-2-20040207 which adds a xftde drawing
module which uses Xft for drawing antialiased fonts.

Based upon Tom Payne's (and mine) work. The patch is rather large as
fontset.[ch] is removed as it isn't needed for xftde.

Installation instructions:
cd $ion_directory
cp -r de xftde
cd xftde
patch -p1 < ./../ion-2-20040207_de_to_xftde.patch
make
make install

Alter a theme to use xftde instead of de.

--Andreas
diff -u -N -r de/brush.c xftde/brush.c
--- de/brush.c  2004-02-03 19:45:08.000000000 +0100
+++ xftde/brush.c       2004-02-13 10:10:58.000000000 +0100
@@ -204,6 +204,8 @@
 
 static bool destyle_init(DEStyle *style, WRootWin *rootwin, const char *name)
 {
+       DEColour black, white;
+
        style->style=scopy(name);
        if(style->style==NULL){
                warn_err();
@@ -227,11 +229,13 @@
 
        style->cgrp_alloced=FALSE;
        style->cgrp.spec=NULL;
-       style->cgrp.bg=DE_BLACK(rootwin);
-       style->cgrp.pad=DE_BLACK(rootwin);
-       style->cgrp.fg=DE_WHITE(rootwin);
-       style->cgrp.hl=DE_WHITE(rootwin);
-       style->cgrp.sh=DE_WHITE(rootwin);
+       de_alloc_colour(rootwin, &black, "black");
+       de_alloc_colour(rootwin, &white, "white");
+       style->cgrp.bg=black;
+       style->cgrp.pad=black;
+       style->cgrp.fg=white;
+       style->cgrp.hl=white;
+       style->cgrp.sh=white;
        
        style->font=NULL;
        
@@ -311,7 +315,7 @@
        for(style=styles; style!=NULL; style=next){
                next=style->next;
                if(style->usecount>1){
-                       warn_obj("DE module", "Style %s still in use [%d] but the 
module "
+                       warn_obj(modname, "Style %s still in use [%d] but the module "
                                         "is being unloaded!", style->style, 
style->usecount);
                }
                dump_style(style);
@@ -329,6 +333,7 @@
 {
        brush->d=style;
        style->usecount++;
+       brush->draw=NULL;
        
        if(!grbrush_init(&(brush->grbrush))){
                style->usecount--;
@@ -416,6 +421,8 @@
 {
        unref_style(brush->d);
        brush->d=NULL;
+       if(brush->draw!=NULL)
+               XftDrawDestroy(brush->draw);
        grbrush_deinit(&(brush->grbrush));
 }
 
@@ -536,6 +543,20 @@
 }
 
 
+XftDraw *debrush_get_draw(DEBrush *brush, Drawable d)
+{
+       if(brush->draw==NULL)
+               brush->draw=XftDrawCreate(wglobal.dpy, d,
+                                                                 
DefaultVisual(wglobal.dpy,
+                                                                                   
wglobal.active_screen->id),
+                                                                 
DefaultColormap(wglobal.dpy,
+                                                                                     
wglobal.active_screen->id));
+       else
+               XftDrawChange(brush->draw, d);
+
+       return brush->draw;
+}
+
 /*}}}*/
 
 
diff -u -N -r de/brush.h xftde/brush.h
--- de/brush.h  2004-01-03 01:27:28.000000000 +0100
+++ xftde/brush.h       2004-02-13 10:10:58.000000000 +0100
@@ -15,6 +15,7 @@
 #include <ioncore/common.h>
 #include <ioncore/gr.h>
 #include <ioncore/extl.h>
+#include <X11/Xft/Xft.h>
 
 
 #define MATCHES(S, A) (gr_stylespec_score(S, A)>0)
@@ -97,6 +98,7 @@
 DECLOBJ(DEBrush){
        GrBrush grbrush;
        DEStyle *d;
+       XftDraw *draw;
 };
 
 
@@ -226,6 +228,8 @@
 
 extern void debrush_get_extra_values(DEBrush *brush, ExtlTab *tab);
 
+XftDraw *debrush_get_draw(DEBrush *brush, Drawable d);
+
 
 /*}}}*/
 
diff -u -N -r de/colour.c xftde/colour.c
--- de/colour.c 2004-02-03 19:45:08.000000000 +0100
+++ xftde/colour.c      2004-02-13 10:16:12.000000000 +0100
@@ -15,60 +15,39 @@
 
 bool de_alloc_colour(WRootWin *rootwin, DEColour *ret, const char *name)
 {
-       XColor c;
-       bool ok=FALSE;
-
        if(name==NULL)
                return FALSE;
 
-       if(XParseColor(wglobal.dpy, rootwin->default_cmap, name, &c)){
-               ok=XAllocColor(wglobal.dpy, rootwin->default_cmap, &c);
-               if(ok)
-                       *ret=c.pixel;
-       }
-       
-       return ok;
+       return XftColorAllocName(wglobal.dpy,
+                                                        DefaultVisual(wglobal.dpy,
+                                                                                  
wglobal.active_screen->id),
+                                                        rootwin->default_cmap, name, 
ret);
 }
 
 
 bool de_duplicate_colour(WRootWin *rootwin, DEColour in, DEColour *out)
 {
-       XColor c;
-       c.pixel=in;
-       XQueryColor(wglobal.dpy, rootwin->default_cmap, &c);
-       if(XAllocColor(wglobal.dpy, rootwin->default_cmap, &c)){
-               *out=c.pixel;
-               return TRUE;
-       }
-       return FALSE;
+       return XftColorAllocValue(wglobal.dpy,
+                                                         DefaultVisual(wglobal.dpy,
+                                                                                      
 wglobal.active_screen->id),
+                                                         rootwin->default_cmap, 
&(in.color), out);
 }
 
 
 void de_free_colour_group(WRootWin *rootwin, DEColourGroup *cg)
 {
-       DEColour pixels[5];
-       
-       pixels[0]=cg->bg;
-       pixels[1]=cg->fg;
-       pixels[2]=cg->hl;
-       pixels[3]=cg->sh;
-       pixels[4]=cg->pad;
-       
-       XFreeColors(wglobal.dpy, rootwin->default_cmap, pixels, 5, 0);
-    
-    if(cg->spec!=NULL){
-        free(cg->spec);
-        cg->spec=NULL;
-    }
+       de_free_colour(rootwin, cg->bg);
+       de_free_colour(rootwin, cg->fg);
+       de_free_colour(rootwin, cg->hl);
+       de_free_colour(rootwin, cg->sh);
+       de_free_colour(rootwin, cg->pad);
 }
 
 
 void de_free_colour(WRootWin *rootwin, DEColour col)
 {
-       DEColour pixels[1];
-       
-       pixels[0]=col;
-       
-       XFreeColors(wglobal.dpy, rootwin->default_cmap, pixels, 1, 0);
+       XftColorFree(wglobal.dpy,
+                                DefaultVisual(wglobal.dpy, wglobal.active_screen->id),
+                                rootwin->default_cmap, &col);
 }
 
diff -u -N -r de/colour.h xftde/colour.h
--- de/colour.h 2004-02-05 10:10:38.000000000 +0100
+++ xftde/colour.h      2004-02-13 10:10:58.000000000 +0100
@@ -15,12 +15,13 @@
 #include <ioncore/common.h>
 #include <ioncore/global.h>
 #include <ioncore/rootwin.h>
+#include <X11/Xft/Xft.h>
 
 
 INTRSTRUCT(DEColourGroup);
 
 
-typedef unsigned long DEColour;
+typedef XftColor DEColour;
 
 
 DECLSTRUCT(DEColourGroup){
diff -u -N -r de/delib.lua xftde/delib.lua
--- de/delib.lua        2004-01-03 01:27:28.000000000 +0100
+++ xftde/delib.lua     1970-01-01 01:00:00.000000000 +0100
@@ -1,121 +0,0 @@
---
--- ion/share/delib.lua -- Helper functions for defining drawing engine 
--- styles
--- 
--- Copyright (c) Tuomo Valkonen 2004.
---
--- Ion is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
-
--- This is a slight abuse of the _LOADED variable perhaps, but library-like 
--- packages should handle checking if they're loaded instead of confusing 
--- the user with require/include differences.
-if _LOADED["delib"] then return end
-
-
-local stylecache={}
-
-local function lookup_substyle(list, pattern)
-    for k, v in ipairs(list) do
-        if type(v)=="table" then
-            if v.substyle_pattern and v.substyle_pattern==pattern then
-                return v
-            end
-        end
-    end
-end
-
-local function base_on(name, list)
-    if not stylecache[list.based_on] then
-        warn("Attempt to base style "..name.." on style "..list.based_on
-             .." that is not defined.")
-        return false
-    end
-
-    for k, v in stylecache[list.based_on] do
-        if type(k)=="number" then
-            if type(v)=="table" then
-                if v.substyle_pattern then
-                    if not lookup_substyle(list, v.substyle_pattern) then
-                        table.insert(list, v)
-                    end
-                end
-            end
-        elseif not list[k] then
-            list[k]=v
-        end
-    end
-    
-    return true
-end
-
-local translations={
-    ["frame-tab"] = "tab-frame",
-    ["frame-tab-ionframe"] = "tab-frame-ionframe",
-    ["frame-tab-floatframe"] = "tab-frame-floatframe",
-}
-
---DOC
--- Define a new style for the default drawing engine (that must've
--- been loaded with \fnref{gr_select_engine}.
-function de_define_style(name, list)
-    if translations[name] then
-        warn('The style "'..name..'" has been renamed to "'
-             ..translations[name]..'"')
-        name=translations[name]
-    end
-
-    if not list then
-        return function(list2)
-                   de_define_style(name, list2)
-               end
-    end
-    
-    if list.based_on then
-        if not base_on(name, list) then
-            return
-        end
-    end
-    
-    stylecache[name]=list
-    
-    for xscr, rootwin in root_windows() do
-        if not de_do_define_style(rootwin, name, list) then
-            break
-        end
-    end
-end
-
-
-local subtranslations={
-    ["cursor"]="*-cursor",
-    ["selection"]="*-selection",
-}
-    
---DOC 
--- Define a substyle for the default drawing engine. This function
--- is to be used in constructing style definitions for 
--- \fnref{de_define_style}.
-function de_substyle(pattern, list)
-    if subtranslations[pattern] then
-        warn('The substyle "'..pattern..'" has been renamed to "'
-             ..subtranslations[pattern]..'"')
-        pattern=subtranslations[pattern]
-    end
-    
-    if not list then
-        return function(list2)
-                   substyle(pattern, list2)
-               end
-    end    
-    
-    list.substyle_pattern=pattern
-    return list
-end
-
-
--- Mark ourselves loaded.
-_LOADED["delib"]=true
diff -u -N -r de/draw.c xftde/draw.c
--- de/draw.c   2004-01-03 01:27:28.000000000 +0100
+++ xftde/draw.c        2004-02-13 10:11:10.000000000 +0100
@@ -72,7 +72,7 @@
        w--;
        h--;
 
-       XSetForeground(wglobal.dpy, gc, tlc);
+       XSetForeground(wglobal.dpy, gc, tlc.pixel);
 
        
        a=(br!=0);
@@ -92,7 +92,7 @@
        }
 
        
-       XSetForeground(wglobal.dpy, gc, brc);
+       XSetForeground(wglobal.dpy, gc, brc.pixel);
 
        a=(tl!=0);
        b=0;
@@ -214,7 +214,7 @@
        }
        
        if(MATCHES2("*-*-tagged", a1, a2)){
-               XSetForeground(wglobal.dpy, d->copy_gc, cg->fg);
+               XSetForeground(wglobal.dpy, d->copy_gc, cg->fg.pixel);
                        
                copy_masked(brush, d->tag_pixmap, win, 0, 0,
                                        d->tag_pixmap_w, d->tag_pixmap_h,
@@ -266,7 +266,7 @@
        GC gc=brush->d->normal_gc;
        
        if(TRUE/*needfill*/){
-               XSetForeground(wglobal.dpy, gc, cg->bg);
+               XSetForeground(wglobal.dpy, gc, cg->bg.pixel);
                XFillRectangle(wglobal.dpy, win, gc, geom->x, geom->y, 
                                           geom->w, geom->h);
        }
@@ -499,7 +499,7 @@
                attr.background_pixmap=ParentRelative;
        }else{
                attrflags=CWBackPixel;
-               attr.background_pixel=brush->d->cgrp.bg;
+               attr.background_pixel=brush->d->cgrp.bg.pixel;
        }
        
        XChangeWindowAttributes(wglobal.dpy, win, attrflags, &attr);
@@ -516,7 +516,7 @@
        if(cg==NULL)
                return;
        
-       XSetForeground(wglobal.dpy, gc, cg->bg);
+       XSetForeground(wglobal.dpy, gc, cg->bg.pixel);
        XFillRectangle(wglobal.dpy, win, gc, geom->x, geom->y, geom->w, geom->h);
 }
 
diff -u -N -r de/font.c xftde/font.c
--- de/font.c   2004-01-03 01:27:28.000000000 +0100
+++ xftde/font.c        2004-02-13 10:11:10.000000000 +0100
@@ -13,7 +13,6 @@
 
 #include <ioncore/common.h>
 #include "font.h"
-#include "fontset.h"
 #include "brush.h"
 
 
@@ -23,8 +22,7 @@
 DECLSTRUCT(DEFont){
        char *pattern;
        int refcount;
-       XFontSet fontset;
-       XFontStruct *fontstruct;
+       XftFont *font;
        DEFont *next, *prev;
 };
 
@@ -41,8 +39,7 @@
 DEFont *de_load_font(const char *fontname)
 {
        DEFont *fnt;
-       XFontSet fontset=NULL;
-       XFontStruct *fontstruct=NULL;
+       XftFont *font=NULL;
        
        if(fontname==NULL){
                warn("Attempt to load NULL as font");
@@ -57,20 +54,14 @@
                }
        }
        
-       if(wglobal.use_mb){
-               fontset=de_create_font_set(fontname);
-               if(fontset!=NULL){
-                       if(XContextDependentDrawing(fontset)){
-                               warn("Fontset for font pattern '%s' implements context 
"
-                                        "dependent drawing, which is unsupported. 
Expect "
-                                        "clutter.", fontname);
-                       }
-               }
+       if(strncmp(fontname, "xft:", 4)==0){
+               font=XftFontOpenName(wglobal.dpy, DefaultScreen(wglobal.dpy),
+                                                        fontname+4);
        }else{
-               fontstruct=XLoadQueryFont(wglobal.dpy, fontname);
+               font=XftFontOpenXlfd(wglobal.dpy, DefaultScreen(wglobal.dpy), 
fontname);
        }
        
-       if(fontstruct==NULL && fontset==NULL){
+       if(font==NULL){
                if(strcmp(fontname, CF_FALLBACK_FONT_NAME)!=0){
                        warn("Could not load font \"%s\", trying \"%s\"",
                                 fontname, CF_FALLBACK_FONT_NAME);
@@ -86,8 +77,7 @@
                return NULL;
        }
        
-       fnt->fontset=fontset;
-       fnt->fontstruct=fontstruct;
+       fnt->font=font;
        fnt->pattern=scopy(fontname);
        fnt->next=NULL;
        fnt->prev=NULL;
@@ -106,11 +96,6 @@
        if(style->font==NULL)
                return FALSE;
        
-       if(style->font->fontstruct!=NULL){
-               XSetFont(wglobal.dpy, style->normal_gc, 
-                                style->font->fontstruct->fid);
-       }
-       
        return TRUE;
 }
 
@@ -120,10 +105,8 @@
        if(--font->refcount!=0)
                return;
        
-       if(font->fontset!=NULL)
-               XFreeFontSet(wglobal.dpy, font->fontset);
-       if(font->fontstruct!=NULL)
-               XFreeFont(wglobal.dpy, font->fontstruct);
+       if(font->font!=NULL)
+               XftFontClose(wglobal.dpy, font->font);
        if(font->pattern!=NULL)
                free(font->pattern);
        
@@ -151,19 +134,10 @@
 
 void defont_get_font_extents(DEFont *font, GrFontExtents *fnte)
 {
-       if(font->fontset!=NULL){
-               XFontSetExtents *ext=XExtentsOfFontSet(font->fontset);
-               if(ext==NULL)
-                       goto fail;
-               fnte->max_height=ext->max_logical_extent.height;
-               fnte->max_width=ext->max_logical_extent.width;
-               fnte->baseline=-ext->max_logical_extent.y;
-               return;
-       }else if(font->fontstruct!=NULL){
-               XFontStruct *fnt=font->fontstruct;
-        fnte->max_height=fnt->ascent+fnt->descent;
-               fnte->max_width=fnt->max_bounds.width;
-               fnte->baseline=fnt->ascent;
+       if(font->font!=NULL){
+               fnte->max_height=font->font->ascent+font->font->descent;
+               fnte->max_width=font->font->max_advance_width;
+               fnte->baseline=font->font->ascent;
                return;
        }
        
@@ -183,17 +157,15 @@
 
 uint defont_get_text_width(DEFont *font, const char *text, uint len)
 {
-       if(font->fontset!=NULL){
-               XRectangle lext;
-#ifdef CF_DE_USE_XUTF8
+       if(font->font!=NULL){
+               XGlyphInfo extents;
                if(wglobal.enc_utf8)
-                       Xutf8TextExtents(font->fontset, text, len, NULL, &lext);
+                       XftTextExtentsUtf8(wglobal.dpy, font->font, (XftChar8 *)text, 
len,
+                                                          &extents);
                else
-#endif
-                       XmbTextExtents(font->fontset, text, len, NULL, &lext);
-               return lext.width;
-       }else if(font->fontstruct!=NULL){
-               return XTextWidth(font->fontstruct, text, len);
+                       XftTextExtents8(wglobal.dpy, font->font, (XftChar8 *)text, len,
+                                                       &extents);
+               return extents.xOff;
        }else{
                return 0;
        }
@@ -211,40 +183,30 @@
                                                        DEColourGroup *colours)
 {
        GC gc=brush->d->normal_gc;
+       XftFont *font=brush->d->font->font;
+       XftDraw *draw;
 
        if(brush->d->font==NULL)
                return;
        
-       XSetForeground(wglobal.dpy, gc, colours->fg);
-       
-       if(!needfill){
-               if(brush->d->font->fontset!=NULL){
-#ifdef CF_DE_USE_XUTF8
-                       if(wglobal.enc_utf8)
-                               Xutf8DrawString(wglobal.dpy, win, 
brush->d->font->fontset,
-                                                               gc, x, y, str, len);
-                       else
-#endif
-                               XmbDrawString(wglobal.dpy, win, 
brush->d->font->fontset,
-                                                         gc, x, y, str, len);
-               }else if(brush->d->font->fontstruct!=NULL){
-                       XDrawString(wglobal.dpy, win, gc, x, y, str, len);
-               }
-       }else{
-               XSetBackground(wglobal.dpy, gc, colours->bg);
-               if(brush->d->font->fontset!=NULL){
-#ifdef CF_DE_USE_XUTF8
-                       if(wglobal.enc_utf8)
-                               Xutf8DrawImageString(wglobal.dpy, win, 
brush->d->font->fontset,
-                                                                        gc, x, y, 
str, len);
-                       else
-#endif
-                               XmbDrawImageString(wglobal.dpy, win, 
brush->d->font->fontset,
-                                                                  gc, x, y, str, len);
-               }else if(brush->d->font->fontstruct!=NULL){
-                       XDrawImageString(wglobal.dpy, win, gc, x, y, str, len);
-               }
+       draw=debrush_get_draw(brush, win);
+
+       if(TRUE/*needfill*/){
+               XGlyphInfo extents;
+               if(wglobal.enc_utf8)
+                       XftTextExtentsUtf8(wglobal.dpy, font, (XftChar8 *)str, len,
+                                                          &extents);
+               else
+                       XftTextExtents8(wglobal.dpy, font, (XftChar8 *)str, len, 
&extents);
+               XftDrawRect(draw, &(colours->bg), x-extents.x, y-extents.y,
+                                       extents.width, extents.height);
        }
+
+       if(wglobal.enc_utf8)
+               XftDrawStringUtf8(draw, &(colours->fg), font, x, y, (XftChar8 *)str,
+                                                 len);
+       else
+               XftDrawString8(draw, &(colours->fg), font, x, y, (XftChar8 *)str, len);
 }
 
 
diff -u -N -r de/font.h xftde/font.h
--- de/font.h   2004-01-03 01:27:28.000000000 +0100
+++ xftde/font.h        2004-02-13 10:11:10.000000000 +0100
@@ -14,6 +14,7 @@
 
 #include <ioncore/common.h>
 #include <ioncore/gr.h>
+#include <X11/Xft/Xft.h>
 
 INTRSTRUCT(DEFont);
 
diff -u -N -r de/fontset.c xftde/fontset.c
--- de/fontset.c        2003-11-19 22:39:21.000000000 +0100
+++ xftde/fontset.c     1970-01-01 01:00:00.000000000 +0100
@@ -1,196 +0,0 @@
-/*
- * ion/de/fontset.c
- * 
- * This file contains routines to attempt to add fonts to a font pattern
- * so that XCreateFontSet will not fail because the given font(s) do not
- * contain all the characters required by the locale. The original code
- * was apparently written by Tomohiro Kubota; see
- * <http://www.debian.org/doc/manuals/intro-i18n/ch-examples.en.html#s13.4.5>.
- * 
- */
-
-#include <string.h>
-#include <ctype.h>
-#include <locale.h>
-
-#include <ioncore/common.h>
-#include <ioncore/global.h>
-
-#ifndef CF_FONT_ELEMENT_SIZE
-#define CF_FONT_ELEMENT_SIZE 50
-#endif
-
-#define FNT_D(X) /*X*/
-
-static const char *mystrcasestr(const char *str, const char *ptn) 
-{
-       const char *s2, *p2;
-       for(; *str; str++) {
-               for(s2=str,p2=ptn; ; s2++,p2++) {
-                       if (!*p2) return str;
-                       if (toupper(*s2) != toupper(*p2)) break;
-               }
-       }
-       return NULL;
-}
-
-
-static const char *get_font_element(const char *pattern, char *buf,
-                                                                       int bufsiz, 
...) 
-{
-       const char *p, *v;
-       char *p2;
-       va_list va;
-       
-       va_start(va, bufsiz);
-       buf[bufsiz-1] = 0;
-       buf[bufsiz-2] = '*';
-       while((v = va_arg(va, char *)) != NULL) {
-               p = mystrcasestr(pattern, v);
-               if (p) {
-                       strncpy(buf, p+1, bufsiz-2);
-                       p2 = strchr(buf, '-');
-                       if (p2) *p2=0;
-                       va_end(va);
-                       return p;
-               }
-       }
-       va_end(va);
-       strncpy(buf, "*", bufsiz);
-       return NULL;
-}
-
-
-static const char *get_font_size(const char *pattern, int *size) 
-{
-       const char *p;
-       const char *p2=NULL;
-       int n=0;
-       
-       for (p=pattern; 1; p++) {
-               if (!*p) {
-                       if (p2!=NULL && n>1 && n<72) {
-                               *size = n; return p2+1;
-                       } else {
-                               *size = 16; return NULL;
-                       }
-               } else if (*p=='-') {
-                       if (n>1 && n<72 && p2!=NULL) {
-                               *size = n;
-                               return p2+1;
-                       }
-                       p2=p; n=0;
-               } else if (*p>='0' && *p<='9' && p2!=NULL) {
-                       n *= 10;
-                       n += *p-'0';
-               } else {
-                       p2=NULL; n=0;
-               }
-       }
-}
-
-
-XFontSet de_create_font_set(const char *fontname) 
-{
-       XFontSet fs;
-       char **missing, *def = "-";
-       int nmissing, pixel_size = 0;
-       char weight[CF_FONT_ELEMENT_SIZE], slant[CF_FONT_ELEMENT_SIZE];
-       const char *nfontname = fontname;
-       char *pattern2 = NULL;
-       
-    FNT_D(fprintf(stderr, "FNTRQ: %s\n", fontname));
-       
-       fs = XCreateFontSet(wglobal.dpy, fontname, &missing, &nmissing, &def);
-       
-       if (fs && (! nmissing))
-               return fs;
-       
-       /* Not a warning, nothing serious */
-       FNT_D(fprintf(stderr, "Failed to load fonset.\n"));
-       
-       if (! fs) {
-               char *lcc=NULL;
-               const char *lc;
-               if (nmissing) 
-                       XFreeStringList(missing);
-               
-               lc=setlocale(LC_CTYPE, NULL);
-               if(lc!=NULL && strcmp(lc, "POSIX")!=0 && strcmp(lc, "C")!=0)
-                       lcc=scopy(lc);
-               
-               setlocale(LC_CTYPE, "C");
-               
-               fs = XCreateFontSet(wglobal.dpy, fontname, &missing, &nmissing, &def);
-               
-               if(lcc!=NULL){
-                       setlocale(LC_CTYPE, lcc);
-                       free(lcc);
-               }
-       }
-       
-       if (fs) {
-               XFontStruct **fontstructs;
-               char **fontnames;
-               XFontsOfFontSet(fs, &fontstructs, &fontnames);
-               nfontname = fontnames[0];
-       }
-
-    /*if(fs){
-               XFontStruct **fontstructs;
-               char **fontnames;
-               int i, n=XFontsOfFontSet(fs, &fontstructs, &fontnames);
-               for(i=0; fontnames[i] && i<n; i++)
-                       fprintf(stderr, "%s\n", fontnames[i]);
-       }*/
-       
-       get_font_element(nfontname, weight, CF_FONT_ELEMENT_SIZE,
-                                        "-medium-", "-bold-", "-demibold-", 
"-regular-", NULL);
-       get_font_element(nfontname, slant, CF_FONT_ELEMENT_SIZE,
-                                        "-r-", "-i-", "-o-", "-ri-", "-ro-", NULL);
-       get_font_size(nfontname, &pixel_size);
-       
-       if (! strcmp(weight, "*"))
-               strncpy(weight, "medium", CF_FONT_ELEMENT_SIZE);
-       if (! strcmp(slant, "*"))
-               strncpy(slant, "r", CF_FONT_ELEMENT_SIZE);
-       if (pixel_size < 3)
-               pixel_size = 3;
-       else if (pixel_size > 97)
-               pixel_size = 97;
-       
-       libtu_asprintf(&pattern2,
-                                  "%s,"
-                                  "-*-*-%s-%s-*-*-%d-*-*-*-*-*-*-*,"
-                                  "-*-*-*-*-*-*-%d-*-*-*-*-*-*-*,*",
-                                  fontname, weight, slant, pixel_size, pixel_size);
-       
-       if(pattern2==NULL)
-               return NULL;
-       
-       FNT_D(fprintf(stderr, "NRQ: %s\n", pattern2));
-       
-       nfontname = pattern2;
-       
-       if (nmissing)
-               XFreeStringList(missing);
-       if (fs)
-               XFreeFontSet(wglobal.dpy, fs);
-
-       FNT_D(if(fs) fprintf(stderr, "Trying '%s'.\n", nfontname));
-       
-       fs = XCreateFontSet(wglobal.dpy, nfontname, &missing, &nmissing, &def);
-       
-       free(pattern2);
-       
-    /*if(fs){
-               XFontStruct **fontstructs;
-               char **fontnames;
-               int i, n=XFontsOfFontSet(fs, &fontstructs, &fontnames);
-               for(i=0; fontnames[i] && i<n; i++)
-                       fprintf(stderr, "%s\n", fontnames[i]);
-       }*/
-
-
-       return fs;
-}
diff -u -N -r de/fontset.h xftde/fontset.h
--- de/fontset.h        2004-01-03 01:27:28.000000000 +0100
+++ xftde/fontset.h     1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-/*
- * ion/de/fontset.h
- *
- * Copyright (c) Tuomo Valkonen 1999-2004. 
- *
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef ION_DE_FONTSET_H
-#define ION_DE_FONTSET_H
-
-#include <ioncore/common.h>
-#include <ioncore/gr.h>
-
-extern XFontSet de_create_font_set(const char *fontname);
-
-#endif /* ION_DE_FONTSET_H */
diff -u -N -r de/init.c xftde/init.c
--- de/init.c   2004-01-03 01:27:28.000000000 +0100
+++ xftde/init.c        2004-02-13 10:11:10.000000000 +0100
@@ -105,14 +105,14 @@
 static void get_colour_group(WRootWin *rootwin, DEColourGroup *cg, 
                                                         ExtlTab tab)
 {
-       get_colour(rootwin, &(cg->hl), tab, "highlight_colour",
-                          DE_WHITE(rootwin));
-       get_colour(rootwin, &(cg->sh), tab, "shadow_colour",
-                          DE_WHITE(rootwin));
-       get_colour(rootwin, &(cg->bg), tab, "background_colour",
-                          DE_BLACK(rootwin));
-       get_colour(rootwin, &(cg->fg), tab, "foreground_colour",
-                          DE_WHITE(rootwin));
+       DEColour black, white;
+
+       de_alloc_colour(rootwin, &black, "black");
+       de_alloc_colour(rootwin, &white, "white");
+       get_colour(rootwin, &(cg->hl), tab, "highlight_colour", white);
+       get_colour(rootwin, &(cg->sh), tab, "shadow_colour", white);
+       get_colour(rootwin, &(cg->bg), tab, "background_colour", black);
+       get_colour(rootwin, &(cg->fg), tab, "foreground_colour", white);
        get_colour(rootwin, &(cg->pad), tab, "padding_colour", cg->bg);
 }
 
@@ -253,29 +253,30 @@
 /*{{{ Module initialisation */
 
 
-#include "../version.h"
+#include "version.h"
 
-char de_module_ion_api_version[]=ION_API_VERSION;
+char xftde_module_ion_api_version[]=ION_API_VERSION;
+const char *modname="xftde";
 
 
-extern bool de_module_register_exports();
-extern void de_module_unregister_exports();
+extern bool xftde_module_register_exports();
+extern void xftde_module_unregister_exports();
 
 
-bool de_module_init()
+bool xftde_module_init()
 {
        WRootWin *rootwin;
        DEStyle *style;
-       
-       if(!de_module_register_exports())
+
+       if(!xftde_module_register_exports())
                return FALSE;
        
        if(!read_config("delib"))
                goto fail;
        
-       if(!gr_register_engine("de", (GrGetBrushFn*)&de_get_brush,
+       if(!gr_register_engine(modname, (GrGetBrushFn*)&de_get_brush,
                                                   
(GrGetValuesFn*)&de_get_brush_values)){
-               warn("DE module", "Failed to register the drawing engine");
+               warn(modname, "Failed to register the drawing engine");
                goto fail;
        }
        
@@ -283,7 +284,7 @@
        FOR_ALL_ROOTWINS(rootwin){
                style=de_create_style(rootwin, "*");
                if(style==NULL){
-                       warn_obj("DE module", "Could not initialise fallback style for 
"
+                       warn_obj(modname, "Could not initialise fallback style for "
                                         "root window %d.\n", rootwin->xscr);
                }else{
                        style->is_fallback=TRUE;
@@ -294,15 +295,15 @@
        return TRUE;
        
 fail:
-       de_module_unregister_exports();
+       xftde_module_unregister_exports();
        return FALSE;
 }
 
 
-void de_module_deinit()
+void xftde_module_deinit()
 {
-       gr_unregister_engine("de");
-       de_module_unregister_exports();
+       gr_unregister_engine(modname);
+       xftde_module_unregister_exports();
        de_deinit_styles();
 }
 
diff -u -N -r de/Makefile xftde/Makefile
--- de/Makefile 2004-02-07 16:37:01.000000000 +0100
+++ xftde/Makefile      2004-02-13 10:25:52.000000000 +0100
@@ -8,16 +8,18 @@
 
 ######################################
 
-INCLUDES += -I../libtu/include $(X11_INCLUDES) -I..
+INCLUDES += -I../libtu/include $(X11_INCLUDES) -I.. `xft-config --cflags`
 CFLAGS += $(XOPEN_SOURCE) $(C99_SOURCE)
 
-SOURCES=init.c draw.c font.c colour.c brush.c fontset.c
+SOURCES=init.c draw.c font.c colour.c brush.c
 
-LUA_SOURCES=delib.lua
+#LUA_SOURCES=delib.lua
 
-MODULE=de
+MODULE=xftde
 
-MAKE_EXPORTS=de_module
+MAKE_EXPORTS=xftde_module
+
+LIBS += `xft-config --libs`
 
 ######################################
 
@@ -25,6 +27,6 @@
 
 ######################################
 
-_install: module_install
-       $(INSTALLDIR) $(SHAREDIR)
-       $(INSTALL) -m $(DATA_MODE) delib.lua delib.lc $(SHAREDIR)
+_install:
+       $(INSTALLDIR) $(LIBDIR)
+       $(INSTALL) -m $(DATA_MODE) .libs/xftde.a .libs/xftde.la .libs/xftde.lai 
.libs/xftde.so $(LIBDIR)/ion
diff -u -N -r de/misc.h xftde/misc.h
--- de/misc.h   2004-01-03 01:27:28.000000000 +0100
+++ xftde/misc.h        2004-02-13 10:11:14.000000000 +0100
@@ -15,4 +15,6 @@
 #define DE_SUB_IND " ->"
 #define DE_SUB_IND_LEN 3
 
+extern const char *modname;
+
 #endif /* ION_DE_MISC_H */

Reply via email to