--- /dev/null
+diff -ur fluxbox-0.9.9_20040713.orig/src/FbTk/XmbFontImp.cc fluxbox-0.9.9_20040713/src/FbTk/XmbFontImp.cc
+--- fluxbox-0.9.9_20040713.orig/src/FbTk/XmbFontImp.cc 2004-02-10 20:03:42.000000000 +0100
++++ fluxbox-0.9.9_20040713/src/FbTk/XmbFontImp.cc 2004-07-14 00:46:07.017261128 +0200
+@@ -133,6 +148,7 @@
+ if (nmissing) XFreeStringList(missing);
+
+ setlocale(LC_CTYPE, "C");
++ cerr << "nmissing! defaulting to C Locale" << endl;
+ fs = XCreateFontSet(display, fontname,
+ &missing, &nmissing, &def);
+ setlocale(LC_CTYPE, "");
+@@ -185,7 +201,23 @@
+ };
+ namespace FbTk {
+
+-XmbFontImp::XmbFontImp(const char *filename, bool utf8):m_fontset(0), m_utf8mode(utf8) {
++std::map <std::string, XmbFontImp::mbFontInfo *> XmbFontImp::fontDict;
++
++void XmbFontImp::freeFont(const std::string &fontname) {
++ std::map <std::string, XmbFontImp::mbFontInfo *>::iterator i;
++ mbFontInfo *font;
++ if ((i = XmbFontImp::fontDict.find(fontname)) != fontDict.end()) {
++ font = i->second;
++ font->refcount--;
++ if (font->refcount == 0) {
++ XFreeFontSet(App::instance()->display(), font->set);
++ delete font;
++ XmbFontImp::fontDict.erase(i);
++ }
++ }
++}
++
++XmbFontImp::XmbFontImp(const char *filename, bool utf8):m_font(0), m_utf8mode(utf8) {
+ #ifdef DEBUG
+ #ifdef X_HAVE_UTF8_STRING
+ cerr<<"Using utf8 = "<<utf8<<endl;
+@@ -198,20 +230,36 @@
+ }
+
+ XmbFontImp::~XmbFontImp() {
+- if (m_fontset != 0)
+- XFreeFontSet(App::instance()->display(), m_fontset);
++ if (m_font != 0)
++ freeFont(m_font->name);
+ }
+
+ bool XmbFontImp::load(const std::string &fontname) {
++ std::map <std::string, XmbFontImp::mbFontInfo *>::iterator i;
++ XmbFontImp::mbFontInfo *font;
++
+ if (fontname.size() == 0)
+ return false;
+- XFontSet set = createFontSet(fontname.c_str());
+- if (set == 0)
+- return false;
+- if (m_fontset != 0)
+- XFreeFontSet(App::instance()->display(), m_fontset);
+- m_fontset = set;
+- m_setextents = XExtentsOfFontSet(m_fontset);
++ if ( (i = XmbFontImp::fontDict.find(fontname)) != XmbFontImp::fontDict.end() ) {
++ /* we"ve already got the font. rock */
++ font = i->second;
++ font->refcount++;
++ m_font = &(*font);
++ } else {
++ /* we have to load it anew. */
++ XFontSet set;
++ if ( (set = createFontSet(fontname.c_str())) == 0)
++ return false;
++ font = new mbFontInfo;
++ font->set = set;
++ font->extents = XExtentsOfFontSet(set);
++ font->name = fontname;
++ font->refcount = 1;
++
++ XmbFontImp::fontDict.insert(std::map <std::string, XmbFontImp::mbFontInfo*>::value_type(fontname, font));
++ if (m_font) freeFont(m_font->name);
++ m_font = font;
++ }
+
+ return true;
+ }
+@@ -219,34 +267,34 @@
+ void XmbFontImp::drawText(Drawable w, int screen, GC gc, const char *text,
+ size_t len, int x, int y) const {
+
+- if (text == 0 || len == 0 || w == 0 || m_fontset == 0)
++ if (text == 0 || len == 0 || w == 0 || m_font == 0)
+ return;
+ #ifdef X_HAVE_UTF8_STRING
+ if (m_utf8mode) {
+- Xutf8DrawString(App::instance()->display(), w, m_fontset,
++ Xutf8DrawString(App::instance()->display(), w, m_font->set,
+ gc, x, y,
+ text, len);
+ } else
+ #endif //X_HAVE_UTF8_STRING
+ {
+- XmbDrawString(App::instance()->display(), w, m_fontset,
++ XmbDrawString(App::instance()->display(), w, m_font->set,
+ gc, x, y,
+ text, len);
+ }
+ }
+
+ unsigned int XmbFontImp::textWidth(const char * const text, unsigned int len) const {
+- if (m_fontset == 0)
++ if (m_font == 0)
+ return 0;
+ XRectangle ink, logical;
+ #ifdef X_HAVE_UTF8_STRING
+ if (m_utf8mode) {
+- Xutf8TextExtents(m_fontset, text, len,
++ Xutf8TextExtents(m_font->set, text, len,
+ &ink, &logical);
+ } else
+ #endif // X_HAVE_UTF8_STRING
+ {
+- XmbTextExtents(m_fontset, text, len,
++ XmbTextExtents(m_font->set, text, len,
+ &ink, &logical);
+ }
+
+@@ -254,9 +302,9 @@
+ }
+
+ unsigned int XmbFontImp::height() const {
+- if (m_fontset == 0)
++ if (m_font == 0)
+ return 0;
+- return m_setextents->max_ink_extent.height;
++ return m_font->extents->max_ink_extent.height;
+ }
+
+ }; // end namespace FbTk
+diff -ur fluxbox-0.9.9_20040713.orig/src/FbTk/XmbFontImp.hh fluxbox-0.9.9_20040713/src/FbTk/XmbFontImp.hh
+--- fluxbox-0.9.9_20040713.orig/src/FbTk/XmbFontImp.hh 2003-12-16 18:06:52.000000000 +0100
++++ fluxbox-0.9.9_20040713/src/FbTk/XmbFontImp.hh 2004-07-14 00:52:19.028706792 +0200
+@@ -26,6 +26,7 @@
+
+ #include "FontImp.hh"
+
++#include <map>
+ #include <X11/Xlib.h>
+
+ namespace FbTk {
+@@ -39,12 +40,19 @@
+ virtual void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const;
+ unsigned int textWidth(const char * const text, unsigned int len) const;
+ unsigned int height() const;
+- int ascent() const { return m_setextents ? -m_setextents->max_ink_extent.y : 0; }
+- int descent() const { return m_setextents ? m_setextents->max_ink_extent.height + m_setextents->max_ink_extent.y : 0; }
+- bool loaded() const { return m_fontset != 0; }
++ int ascent() const { return m_font ? -m_font->extents->max_ink_extent.y : 0; }
++ int descent() const { return m_font ? m_font->extents->max_ink_extent.height + m_font->extents->max_ink_extent.y : 0; }
++ bool loaded() const { return m_font != 0; }
+ private:
+- XFontSet m_fontset;
+- XFontSetExtents *m_setextents;
++ struct mbFontInfo {
++ std::string name;
++ XFontSet set;
++ XFontSetExtents *extents;
++ int refcount;
++ };
++ static std::map <std::string, mbFontInfo *> fontDict;
++ static void freeFont(const std::string &foo);
++ mbFontInfo *m_font;
+ const bool m_utf8mode;
+ };
+