X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FFont.cc;h=48b5ebd56d3930a84e2015d3ea3cd20d77a2b193;hb=137a0c4e596409a1d35f0f6ea1bd6e4fcd5a3831;hp=f377c5ebf330626104738a0386b4d6f36da37fc8;hpb=08d793bb796f608774d6fdefd1950df54477e2c6;p=chaz%2Fopenbox diff --git a/src/Font.cc b/src/Font.cc index f377c5eb..48b5ebd5 100644 --- a/src/Font.cc +++ b/src/Font.cc @@ -61,9 +61,7 @@ BFont::BFont(Display *d, BScreen *screen, const string &family, int size, #endif // XFT _font(0), _fontset(0), - _fontset_extents(0), - _cache(0), - _item(0) { + _fontset_extents(0) { _valid = init(); } @@ -76,9 +74,7 @@ BFont::BFont(Display *d, BScreen *screen, const string &xlfd) : #endif // XFT _font(0), _fontset(0), - _fontset_extents(0), - _cache(0), - _item(0) { + _fontset_extents(0) { string int_xlfd; if (xlfd.empty()) int_xlfd = _fallback_font; @@ -121,8 +117,8 @@ bool BFont::createFont(void) { if (_xftfont) return True; - cerr << "BFont::BFont(): couldn't load font '" << _name << "'" << endl << - "as an Xft font, trying as a standard X font." << endl; + cerr << "BFont::BFont(): couldn't load font '" << _name << + "' as an Xft font, trying as a standard X font." << endl; #endif if (i18n.multibyte()) { @@ -160,9 +156,6 @@ BFont::~BFont() { XFreeFontSet(_display, _fontset); if (_font) XFreeFont(_display, _font); - - if (_item) - _cache->release(_item); } @@ -262,10 +255,8 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, } #endif // XFT - if (! _cache) - _cache = color.display()->gcCache(); - if (! _item) - _item = _cache->find(color, _font, GXcopy, ClipByChildren); + BGCCache *_cache = color.display()->gcCache(); + BGCCacheItem *_item = _cache->find(color, _font, GXcopy, ClipByChildren); assert(_cache); assert(_item); @@ -278,6 +269,8 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, XDrawString(_display, d, _item->gc(), x, _font->ascent + y, string.c_str(), string.size()); + + _cache->release(_item); }