aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Font.cc
diff options
context:
space:
mode:
authormathias <mathias>2005-06-15 06:18:03 (GMT)
committermathias <mathias>2005-06-15 06:18:03 (GMT)
commitacaa58309364238371dec1c30d8fe5097843fd57 (patch)
tree482997846d6602d2fcd6c4c16e8917e95a60c1ca /src/FbTk/Font.cc
parent5324a82b01c3d15bcb6a0a96bbe6010a4fbca75d (diff)
downloadfluxbox-acaa58309364238371dec1c30d8fe5097843fd57.zip
fluxbox-acaa58309364238371dec1c30d8fe5097843fd57.tar.bz2
Fixes #1216020, *.font.effect wont get cleared if not defined in style
Diffstat (limited to 'src/FbTk/Font.cc')
-rw-r--r--src/FbTk/Font.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc
index 365637d..6aa17ea 100644
--- a/src/FbTk/Font.cc
+++ b/src/FbTk/Font.cc
@@ -160,6 +160,16 @@ typedef std::map<std::string, FbTk::FontImp* > FontCache;
160typedef FontCache::iterator FontCacheIt; 160typedef FontCache::iterator FontCacheIt;
161FontCache font_cache; 161FontCache font_cache;
162 162
163
164void resetEffects(FbTk::Font* font) {
165 font->setHalo(false);
166 font->setHaloColor(FbTk::Color("white", DefaultScreen(FbTk::App::instance()->display())));
167 font->setShadow(false);
168 font->setShadowColor(FbTk::Color("black", DefaultScreen(FbTk::App::instance()->display())));
169 font->setShadowOffY(2);
170 font->setShadowOffX(2);
171}
172
163}; // end nameless namespace 173}; // end nameless namespace
164 174
165 175
@@ -263,6 +273,7 @@ bool Font::load(const std::string &name) {
263 if (name.size() == 0) 273 if (name.size() == 0)
264 return false; 274 return false;
265 275
276 bool ret = false;
266 StringMapIt lookup_entry; 277 StringMapIt lookup_entry;
267 FontCacheIt cache_entry; 278 FontCacheIt cache_entry;
268 279
@@ -271,6 +282,7 @@ bool Font::load(const std::string &name) {
271 (cache_entry = font_cache.find(lookup_entry->second)) != font_cache.end()) { 282 (cache_entry = font_cache.find(lookup_entry->second)) != font_cache.end()) {
272 m_fontstr = cache_entry->first; 283 m_fontstr = cache_entry->first;
273 m_fontimp = cache_entry->second; 284 m_fontimp = cache_entry->second;
285 resetEffects(this);
274 return true; 286 return true;
275 } 287 }
276 288
@@ -289,6 +301,7 @@ bool Font::load(const std::string &name) {
289 m_fontstr = cache_entry->first; 301 m_fontstr = cache_entry->first;
290 m_fontimp = cache_entry->second; 302 m_fontimp = cache_entry->second;
291 lookup_map[name] = m_fontstr; 303 lookup_map[name] = m_fontstr;
304 resetEffects(this);
292 return true; 305 return true;
293 } 306 }
294 307
@@ -313,13 +326,14 @@ bool Font::load(const std::string &name) {
313 m_fontimp = tmp_font; 326 m_fontimp = tmp_font;
314 font_cache[(*name_it)] = tmp_font; 327 font_cache[(*name_it)] = tmp_font;
315 m_fontstr = name; 328 m_fontstr = name;
329 resetEffects(this);
316 return true; 330 return true;
317 } 331 }
318 332
319 delete tmp_font; 333 delete tmp_font;
320 } 334 }
321 335
322 return false;; 336 return false;
323} 337}
324 338
325unsigned int Font::textWidth(const char * const text, unsigned int size) const { 339unsigned int Font::textWidth(const char * const text, unsigned int size) const {