From ef76b45ab1857af1b12f0c336bfb8c0f19140aeb Mon Sep 17 00:00:00 2001 From: mathias Date: Fri, 3 Jun 2005 07:25:48 +0000 Subject: - Usage of xft-fonts is prefered, except a font-description starts with '-' - Removed "antialias"-option completly, to enable/disable "antialias" use either :antialias= in the style or use Xft.antialias: in your .Xdefaults - Added new styleresources: *.font.effect: *.font.shadow.x : - shadow x offset *.font.shadow.y : - shadow y offset *.font.shadow.color : - color of shadow *.font.halo.color : - color of halo - Removed 'shadow' and 'halo' options from fontdefinitions: !! Style authors have to update their styles !! - Simplified XmbFontImp to not try all possible fonts to match locale - Style authors may specify multiple fonts: || if loading of font1 fails, fluxbox probes , etc. The last font is "fixed". Hints for style authors: - if xft tries to load a font it will _ALWAYS_ return a valid font, it doesnt have to look like the one you want to have, read more about it: http://fontconfig.org/fontconfig-user.html - export XFT_DEBUG=1 before running fluxbox helps to see which fonts are picked. eg: *.font: Verdana,Arial-12:antialias=true|-artwiz-snap-*- if fluxbox is compiled with xft this will NEVER try to load "-artwiz-snap-*-" since xft gives for sure a font, most likely Verdana or Arial but noone knows. So, if fluxbox has no xft support the first fontpattern fails and fluxbox tries the next one, which might be successful. if everything fails, it will use "fixed" - Added caching of fonts, fonts are only loaded once. - Fixed #1090902 (slow utf8 start) --- ChangeLog | 38 +++++++ src/FbTk/Font.cc | 261 ++++++++++++++++++------------------------------- src/FbTk/Font.hh | 40 ++++---- src/FbTk/MenuTheme.cc | 15 --- src/FbTk/Texture.cc | 12 +-- src/FbTk/ThemeItems.cc | 60 ++++++++++-- src/FbTk/XftFontImp.cc | 8 +- src/FbTk/XftFontImp.hh | 3 +- src/IconbarTheme.cc | 5 - src/Screen.cc | 29 +----- src/Screen.hh | 2 - src/TextTheme.cc | 9 +- src/TextTheme.hh | 2 - src/ToolFactory.cc | 4 - src/tests/menutest.cc | 4 +- src/tests/testFont.cc | 19 ++-- util/fbrun/FbRun.hh | 2 +- util/fbrun/main.cc | 6 +- 18 files changed, 239 insertions(+), 280 deletions(-) diff --git a/ChangeLog b/ChangeLog index 578ebe9..f32d2ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,43 @@ (Format: Year/Month/Day) Changes for 0.9.14: +*05/06/03: + * Massive change of font handling (Mathias) + - Usage of xft-fonts is prefered, except a font-description starts with '-' + - Removed "antialias"-option completly, to enable/disable "antialias" + use either :antialias= in the style or use + Xft.antialias: in your .Xdefaults + - Added new styleresources: + *.font.effect: + *.font.shadow.x : - shadow x offset + *.font.shadow.y : - shadow y offset + *.font.shadow.color : - color of shadow + *.font.halo.color : - color of halo + - Removed 'shadow' and 'halo' options from fontdefinitions: + !! Style authors have to update their styles !! + - Simplified XmbFontImp to not try all possible fonts to match locale + - Style authors may specify multiple fonts: + || + if loading of font1 fails, fluxbox probes , etc. The last font is + "fixed". Hints for style authors: + - if xft tries to load a font it will _ALWAYS_ return a valid font, + it doesnt have to look like the one you want to have, read more + about it: http://fontconfig.org/fontconfig-user.html + - export XFT_DEBUG=1 before running fluxbox helps to see + which fonts are picked. + eg: + *.font: Verdana,Arial-12:antialias=true|-artwiz-snap-*- + if fluxbox is compiled with xft this will NEVER try to + load "-artwiz-snap-*-" since xft gives for sure a font, + most likely Verdana or Arial but noone knows. So, if + fluxbox has no xft support the first fontpattern fails + and fluxbox tries the next one, which might be successful. + if everything fails, it will use "fixed" + - Added caching of fonts, fonts are only loaded once. + - Fixed #1090902 + ToolFactory.cc TextTheme.hh/cc IconbarTheme.cc Screen.hh/cc + FbTk/Font.hh/cc FbTk/XftFontImp.cc FbTk/XmbFontImp.cc + FbTk/MenuTheme.cc FbTk/Texture.cc FbTk/ThemeItems.cc + fbrun/main.cc fbrun/FbRun.cc *05/06/02: * Fixed _BLACKBOX_NOTIFY_WINDOW_ADD issue (thanx Vadim) _BLACKBOX_NOTIFY_WINDOW_ADD was emited before _NET_CLIENT_LIST diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc index 05dae54..365637d 100644 --- a/src/FbTk/Font.cc +++ b/src/FbTk/Font.cc @@ -27,6 +27,7 @@ #include "Font.hh" #include "FontImp.hh" #include "I18n.hh" +#include "App.hh" #ifdef HAVE_CONFIG_H #include "config.h" @@ -67,6 +68,7 @@ #include #endif #include +#include #include #include @@ -148,69 +150,15 @@ char *recode(int cd, } #endif // HAVE_ICONV -int extract_halo_options(const std::string& opts, std::string& color) { - std::list< std::string > tokens; - size_t sep= opts.find_first_of(':'); +// use to map || => +typedef std::map StringMap; +typedef StringMap::iterator StringMapIt; +StringMap lookup_map; - if ( sep == std::string::npos ) - return 1; - - FbTk::StringUtil::stringtok(tokens, opts.substr(sep + 1, opts.length()), ";"); - tokens.unique(); - std::list< std::string >::const_iterator token; - - for ( token= tokens.begin(); token != tokens.end(); token++ ) { - if ( (*token).find("color=", 0) != std::string::npos ) { - size_t s= (*token).find_first_of('='); - std::string c= (*token).substr(s + 1, (*token).length()); - if ( !c.empty() ) - std::swap(color, c); - } - } - - return 1; -} - -int extract_shadow_options(const std::string& opts, - std::string& color, - int& offx, int& offy) { - - std::list< std::string > tokens; - size_t sep= opts.find_first_of(':'); - - if ( sep == std::string::npos ) - return 1; - - FbTk::StringUtil::stringtok(tokens, opts.substr(sep + 1, opts.length()), ";"); - tokens.unique(); - std::list< std::string >::const_iterator token; - - for ( token= tokens.begin(); token != tokens.end(); token++ ) { - if ( (*token).find("color=", 0) != std::string::npos ) { - size_t s= (*token).find_first_of('='); - std::string c= (*token).substr(s + 1, (*token).length()); - if ( !c.empty() ) - std::swap(color, c); - } - else if ( (*token).find("offsetx=", 0) != std::string::npos ) { - size_t s= (*token).find_first_of('='); - FbTk_istringstream o((*token).substr(s + 1, (*token).length()).c_str()); - if ( !o.eof() ) { - o >> offx; - } - } - else if ( (*token).find("offsety=", 0) != std::string::npos ) { - size_t s= (*token).find_first_of('='); - FbTk_istringstream o((*token).substr(s + 1, (*token).length()).c_str()); - if ( !o.eof() ) { - o >> offy; - } - } - } - - return 1; - -}; +// stores FontCache; +typedef FontCache::iterator FontCacheIt; +FontCache font_cache; }; // end nameless namespace @@ -218,8 +166,8 @@ int extract_shadow_options(const std::string& opts, namespace FbTk { -bool Font::m_multibyte = false; -bool Font::m_utf8mode = false; +bool Font::s_multibyte = false; +bool Font::s_utf8mode = false; void Font::init() { @@ -229,24 +177,34 @@ void Font::init() { void Font::shutdown() { + FontCacheIt fit; + for (fit = font_cache.begin(); fit != font_cache.end(); fit++) { + FontImp* font = fit->second; + if (font) { + FontCacheIt it; + for (it = fit; it != font_cache.end(); it++) + if (it->second == font) + it->second = 0; + delete font; + } + } } -Font::Font(const char *name, bool antialias): +Font::Font(const char *name): m_fontimp(0), - m_antialias(false), m_rotated(false), - m_shadow(false), m_shadow_color("#000000"), - m_shadow_offx(1), m_shadow_offy(1), - m_halo(false), m_halo_color("#ffffff"), + m_rotated(false), + m_shadow(false), m_shadow_color("black", DefaultScreen(App::instance()->display())), + m_shadow_offx(2), m_shadow_offy(2), + m_halo(false), m_halo_color("white", DefaultScreen(App::instance()->display())), #ifdef HAVE_ICONV m_iconv((iconv_t)(-1)) #else m_iconv(-1) #endif // HAVE_ICONV { - // MB_CUR_MAX returns the size of a char in the current locale if (MB_CUR_MAX > 1) // more than one byte, then we're multibyte - m_multibyte = true; + s_multibyte = true; // check for utf-8 mode #ifdef CODESET @@ -256,7 +214,7 @@ Font::Font(const char *name, bool antialias): #endif // CODESET if (locale_codeset && strcmp("UTF-8", locale_codeset) == 0) { - m_utf8mode = true; + s_utf8mode = true; } else if (locale_codeset != 0) { // if locale isn't UTF-8 we try to // create a iconv pointer so we can @@ -272,13 +230,13 @@ Font::Font(const char *name, bool antialias): cerr<<"FbTk::Font: code error: from "< extract 'halo' and 'shadow' and - // load remaining fname - size_t sep= name.find_first_of(':'); - - if ( sep != std::string::npos ) { - - std::list< std::string > tokens; - std::string fname; - - fname= std::string(name.c_str(), sep); - - FbTk::StringUtil::stringtok(tokens, name.substr(sep + 1), ","); - - tokens.unique(); - bool firstone= true; - std::list< std::string >::const_iterator token; - - // check tokens and extract extraoptions for halo and shadow - for( token= tokens.begin(); token != tokens.end(); token++ ) { - if ( (*token).find("halo",0) != std::string::npos ) { - m_halo= true; - extract_halo_options(*token, m_halo_color); - } - else if ( (*token).find("shadow", 0) != std::string::npos ) { - m_shadow= true; - extract_shadow_options(*token, m_shadow_color, m_shadow_offx, m_shadow_offy); - } - else { - if ( !firstone ) - fname+= ", "; - else - firstone= false; - fname= fname + ":" + *token; - } + + StringMapIt lookup_entry; + FontCacheIt cache_entry; + + // check if one of || is already there + if ((lookup_entry = lookup_map.find(name)) != lookup_map.end() && + (cache_entry = font_cache.find(lookup_entry->second)) != font_cache.end()) { + m_fontstr = cache_entry->first; + m_fontimp = cache_entry->second; + return true; + } + + // split up the namelist + typedef std::list StringList; + typedef StringList::iterator StringListIt; + StringList names; + FbTk::StringUtil::stringtok(names, name, "|"); + + StringListIt name_it; + for (name_it = names.begin(); name_it != names.end(); name_it++) { + FbTk::StringUtil::removeTrailingWhitespace(*name_it); + FbTk::StringUtil::removeFirstWhitespace(*name_it); + + if ((cache_entry = font_cache.find(*name_it)) != font_cache.end()) { + m_fontstr = cache_entry->first; + m_fontimp = cache_entry->second; + lookup_map[name] = m_fontstr; + return true; } - m_fontstr = fname; - } else - m_fontstr = name; + FontImp* tmp_font(0); + +#ifdef USE_XFT + if ((*name_it)[0] != '-') + tmp_font = new XftFontImp(0, s_utf8mode); +#endif // USE_XFT + + if (!tmp_font) { +#ifdef USE_XMB + if (s_multibyte || s_utf8mode) + tmp_font = new XmbFontImp(0, s_utf8mode); + else // basic font implementation +#endif // USE_XMB + tmp_font = new XFontImp(); + } + + if (tmp_font && tmp_font->load((*name_it).c_str())) { + lookup_map[name] = (*name_it); + m_fontimp = tmp_font; + font_cache[(*name_it)] = tmp_font; + m_fontstr = name; + return true; + } + + delete tmp_font; + } - return m_fontimp->load(m_fontstr.c_str()); + return false;; } unsigned int Font::textWidth(const char * const text, unsigned int size) const { @@ -449,14 +376,14 @@ void Font::drawText(const FbDrawable &w, int screen, GC gc, if (first_run) { if (m_shadow) { FbTk::GContext shadow_gc(w); - shadow_gc.setForeground(FbTk::Color(m_shadow_color.c_str(), screen)); + shadow_gc.setForeground(m_shadow_color); first_run = false; drawText(w, screen, shadow_gc.gc(), real_text, len, x + m_shadow_offx, y + m_shadow_offy, rotate); first_run = true; } else if (m_halo) { FbTk::GContext halo_gc(w); - halo_gc.setForeground(FbTk::Color(m_halo_color.c_str(), screen)); + halo_gc.setForeground(m_halo_color); first_run = false; drawText(w, screen, halo_gc.gc(), real_text, len, x + 1, y + 1, rotate); drawText(w, screen, halo_gc.gc(), real_text, len, x - 1, y + 1, rotate); @@ -473,7 +400,7 @@ void Font::drawText(const FbDrawable &w, int screen, GC gc, // Using dynamic_cast just temporarly until there's a better solution // to put in FontImp try { - XFontImp *font = dynamic_cast(m_fontimp.get()); + XFontImp *font = dynamic_cast(m_fontimp); font->setRotate(false); // disable rotation temporarly font->drawText(w, screen, gc, real_text, len, x, y); @@ -492,15 +419,16 @@ void Font::drawText(const FbDrawable &w, int screen, GC gc, } void Font::rotate(float angle) { +/* TODO: reimplement rotated text #ifdef USE_XFT // if we are rotated and we are changing to horiz text // and we were antialiased before we rotated then change to XftFontImp - if (isRotated() && angle == 0 && isAntialias()) - m_fontimp.reset(new XftFontImp(m_fontstr.c_str(), m_utf8mode)); + if (isRotated() && angle == 0 && !m_xftfontstr.empty()) + m_fontimp.reset(new XftFontImp(m_fontstr.c_str(),s_utf8mode)); #endif // USE_XFT // change to a font imp that handles rotated fonts (i.e just XFontImp at the moment) // if we're going to rotate this font - if (angle != 0 && isAntialias() && !isRotated()) { + if (angle != 0 && !isRotated()) { m_fontimp.reset(new XFontImp(m_fontstr.c_str())); if (!m_fontimp->loaded()) // if it failed to load font, try default font fixed m_fontimp->load("fixed"); @@ -511,6 +439,7 @@ void Font::rotate(float angle) { m_rotated = (angle == 0 ? false : true); m_angle = angle; + */ } diff --git a/src/FbTk/Font.hh b/src/FbTk/Font.hh index d8f0f46..d322097 100644 --- a/src/FbTk/Font.hh +++ b/src/FbTk/Font.hh @@ -28,7 +28,6 @@ #include #include -#include #ifdef HAVE_CONFIG_H #include "config.h" @@ -38,6 +37,8 @@ #include #endif // HAVE_ICONV +#include "Color.hh" + namespace FbTk { class FontImp; @@ -56,13 +57,13 @@ public: static void shutdown(); /// @return true if multibyte is enabled, else false - static bool multibyte() { return m_multibyte; } + static bool multibyte() { return s_multibyte; } /// @return true if utf-8 mode is enabled, else false - static bool utf8() { return m_utf8mode; } + static bool utf8() { return s_utf8mode; } - Font(const char *name=0, bool antialias = false); + Font(const char *name = "fixed"); virtual ~Font(); /** Load a font @@ -70,10 +71,15 @@ public: loaded font */ bool load(const std::string &name); - - void setAntialias(bool flag); - inline void setShadow(bool flag) { m_shadow = flag; if (m_shadow) setHalo(false); } - inline void setHalo(bool flag) { m_halo = flag; if (m_halo) setShadow(false); } + + void setHalo(bool flag) { m_halo = flag; if (m_halo) setShadow(false); } + void setHaloColor(const Color& color) { m_halo_color = color; } + + void setShadow(bool flag) { m_shadow = flag; if (m_shadow) setHalo(false); } + void setShadowColor(const Color& color) { m_shadow_color = color; } + void setShadowOffX(int offx) { m_shadow_offx = offx; } + void setShadowOffY(int offy) { m_shadow_offy = offy; } + /** @param text text to check size @param size length of text in bytes @@ -103,28 +109,28 @@ public: void drawText(const FbDrawable &w, int screen, GC gc, const char *text, size_t len, int x, int y, bool rotate=true) const; - bool isAntialias() const { return m_antialias; } /// @return true if the font is rotated, else false bool isRotated() const { return m_rotated; } /// @return rotated angle float angle() const { return m_angle; } - bool shadow() const { return m_shadow; } - bool halo() const { return m_halo; } + bool hasShadow() const { return m_shadow; } + bool hasHalo() const { return m_halo; } private: - std::auto_ptr m_fontimp; ///< font implementation + FbTk::FontImp* m_fontimp; ///< font implementation std::string m_fontstr; ///< font name - static bool m_multibyte; ///< if the fontimp should be a multibyte font - static bool m_utf8mode; ///< should the font use utf8 font imp - bool m_antialias; ///< is font antialias + + static bool s_multibyte; ///< if the fontimp should be a multibyte font + static bool s_utf8mode; ///< should the font use utf8 font imp + bool m_rotated; ///< wheter we're rotated or not float m_angle; ///< rotation angle bool m_shadow; ///< shadow text - std::string m_shadow_color; ///< shadow color + Color m_shadow_color; ///< shadow color int m_shadow_offx; ///< offset y for shadow int m_shadow_offy; ///< offset x for shadow bool m_halo; ///< halo text - std::string m_halo_color; ///< halo color + Color m_halo_color; ///< halo color #ifdef HAVE_ICONV iconv_t m_iconv; #else diff --git a/src/FbTk/MenuTheme.cc b/src/FbTk/MenuTheme.cc index 1e02f63..01f951e 100644 --- a/src/FbTk/MenuTheme.cc +++ b/src/FbTk/MenuTheme.cc @@ -171,19 +171,4 @@ void ThemeItem::load(const std::string *name, const std:: // do nothing, we don't have anything extra to load } -template <> -void ThemeItem::setDefaultValue() { - m_value = 0; -} - -template <> -void ThemeItem::setFromString(const char *str) { - sscanf(str, "%d", &m_value); -} - -template <> -void ThemeItem::load(const std::string *name, const std::string *altname) { -} - - }; // end namespace FbTk diff --git a/src/FbTk/Texture.cc b/src/FbTk/Texture.cc index 44df2cb..0bb91dc 100644 --- a/src/FbTk/Texture.cc +++ b/src/FbTk/Texture.cc @@ -57,9 +57,7 @@ void Texture::setFromString(const char * const texture_str) { } else { setType(Texture::NONE); - if (strstr(ts, "solid")) - addType(Texture::SOLID); - else if (strstr(ts, "gradient")) { + if (strstr(ts, "gradient")) { addType(Texture::GRADIENT); if (strstr(ts, "crossdiagonal")) addType(Texture::CROSSDIAGONAL); @@ -79,17 +77,15 @@ void Texture::setFromString(const char * const texture_str) { addType(Texture::VERTICAL); else addType(Texture::DIAGONAL); - } else + } else // default is "solid", according to ThemeItems.cc addType(Texture::SOLID); if (strstr(ts, "raised")) addType(Texture::RAISED); else if (strstr(ts, "sunken")) addType(Texture::SUNKEN); - else if (strstr(ts, "flat")) - addType(Texture::FLAT); - else - addType(Texture::RAISED); + else // default us "flat", according to ThemeItems.cc + addType(Texture::FLAT); if (! (type() & Texture::FLAT)) if (strstr(ts, "bevel2")) diff --git a/src/FbTk/ThemeItems.cc b/src/FbTk/ThemeItems.cc index 6b24baf..ccbe3a3 100644 --- a/src/FbTk/ThemeItems.cc +++ b/src/FbTk/ThemeItems.cc @@ -26,6 +26,10 @@ #ifndef THEMEITEMS_HH #define THEMEITEMS_HH +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // HAVE_CONFIG_H + #include "Theme.hh" #include "Color.hh" #include "Texture.hh" @@ -98,9 +102,40 @@ void FbTk::ThemeItem::setFromString(char const *strval) { } template <> +void ThemeItem::setDefaultValue() { + m_value = 0; +} + +template <> +void ThemeItem::setFromString(const char *str) { + sscanf(str, "%d", &m_value); +} + +template <> +void ThemeItem::load(const std::string *name, const std::string *altname) { +} + + void ThemeItem::setDefaultValue() { if (!m_value.load("fixed")) { cerr<<"ThemeItem: Warning! Failed to load default value 'fixed'"<::setFromString(const char *str) { if (str == 0 || m_value.load(str) == false) { if (ThemeManager::instance().verbose()) { cerr<<"Theme: Error loading font "<< - ((m_value.isAntialias() || m_value.utf8()) ? "(" : "")<< - - (m_value.isAntialias() ? "antialias" : "")<< - (m_value.utf8() ? " utf8" : "")<< - - ((m_value.isAntialias() || m_value.utf8()) ? ") " : "")<< + ((m_value.utf8()) ? "(utf8)" : "")<< "for \""<display(); - XftFont *newxftfont = XftFontOpenName(disp, 0, name.c_str()); - if (newxftfont == 0) { // failed to open font, lets test with XLFD - newxftfont = XftFontOpenXlfd(disp, 0, name.c_str()); + XftFont *newxftfont = XftFontOpenXlfd(disp, 0, name.c_str()); + if (newxftfont == 0) { + newxftfont = XftFontOpenName(disp, 0, name.c_str()); if (newxftfont == 0) return false; } + // destroy old font and set new if (m_xftfont != 0) XftFontClose(disp, m_xftfont); diff --git a/src/FbTk/XftFontImp.hh b/src/FbTk/XftFontImp.hh index c221d79..21a80b6 100644 --- a/src/FbTk/XftFontImp.hh +++ b/src/FbTk/XftFontImp.hh @@ -24,9 +24,8 @@ #ifndef FBTK_XFTFONTIMP_HH #define FBTK_XFTFONTIMP_HH -#include "FontImp.hh" - #include +#include "FontImp.hh" namespace FbTk { diff --git a/src/IconbarTheme.cc b/src/IconbarTheme.cc index 33c97fa..2fd0852 100644 --- a/src/IconbarTheme.cc +++ b/src/IconbarTheme.cc @@ -53,11 +53,6 @@ void IconbarTheme::reconfigTheme() { m_unfocused_text.update(); } -void IconbarTheme::setAntialias(bool value) { - m_focused_text.setAntialias(value); - m_unfocused_text.setAntialias(value); -} - // fallback resources bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) { using namespace FbTk; diff --git a/src/Screen.cc b/src/Screen.cc index 7996587..8de0345 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -310,14 +310,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, imageControl().setDither(*resource.image_dither); - // setup windowtheme for antialias - // before we load the theme - - winFrameTheme().font().setAntialias(*resource.antialias); - menuTheme().titleFont().setAntialias(*resource.antialias); - menuTheme().frameFont().setAntialias(*resource.antialias); - - winFrameTheme().reconfigSig().attach(this);// for geom window @@ -343,7 +335,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, // own resources we must do this. fluxbox->load_rc(*this); - m_configmenu.reset(createMenu(_FBTEXT(Menu, Configuration, "Configuration", "Title of configuration menu"))); + m_configmenu.reset(createMenu(_FBTEXT(Menu, Configuration, + "Configuration", "Title of configuration menu"))); setupConfigmenu(*m_configmenu.get()); m_configmenu->setInternalMenu(); @@ -673,11 +666,6 @@ void BScreen::reconfigure() { m_menutheme->setDelayOpen(*resource.menu_delay); m_menutheme->setDelayClose(*resource.menu_delay_close); - // setup windowtheme, toolbartheme for antialias - winFrameTheme().font().setAntialias(*resource.antialias); - m_menutheme->titleFont().setAntialias(*resource.antialias); - m_menutheme->frameFont().setAntialias(*resource.antialias); - renderGeomWindow(); renderPosWindow(); @@ -849,13 +837,6 @@ void BScreen::removeClient(WinClient &client) { } -void BScreen::setAntialias(bool value) { - if (*resource.antialias == value) - return; - resource.antialias = value; - reconfigure(); -} - int BScreen::addWorkspace() { bool save_name = getNameOfWorkspace(m_workspaces_list.size()) != "" ? false : true; @@ -1812,12 +1793,6 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { _BOOLITEM(Configmenu, ClickRaises, "Click Raises", "Click Raises", *resource.click_raises, saverc_cmd); -#ifdef USE_XFT - // setup antialias cmd to reload style and save resource on toggle - _BOOLITEM(Configmenu, AntiAlias, - "AntiAlias", "Use Anti-aliased fonts", - *resource.antialias, save_and_reconfigure); -#endif // USE_XFT #ifdef HAVE_XRENDER if (FbTk::Transparent::haveRender() || diff --git a/src/Screen.hh b/src/Screen.hh index e7f2366..cb18cdd 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -218,8 +218,6 @@ public: void saveMenu(FbTk::Menu &menu) { m_rootmenu_list.push_back(&menu); } - void setAntialias(bool value); - inline FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); } inline const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); } inline MenuTheme &menuTheme() { return *m_menutheme.get(); } diff --git a/src/TextTheme.cc b/src/TextTheme.cc index da5b371..94b428a 100644 --- a/src/TextTheme.cc +++ b/src/TextTheme.cc @@ -34,6 +34,9 @@ TextTheme::TextTheme(FbTk::Theme &theme, m_text_color(theme, name + ".textColor", altname + ".TextColor"), m_justify(theme, name + ".justify", altname + ".Justify"), m_text_gc(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) { + *m_justify = FbTk::LEFT; + // set default values + m_text_color->setFromString("white", theme.screenNum()); update(); } @@ -45,9 +48,3 @@ TextTheme::~TextTheme() { void TextTheme::update() { m_text_gc.setForeground(*m_text_color); } - - -void TextTheme::setAntialias(bool value) { - font().setAntialias(value); - FbTk::ThemeManager::instance().loadItem(m_font); -} diff --git a/src/TextTheme.hh b/src/TextTheme.hh index 80064f6..c8f3910 100644 --- a/src/TextTheme.hh +++ b/src/TextTheme.hh @@ -38,8 +38,6 @@ public: void update(); - void setAntialias(bool value); - FbTk::Font &font() { return *m_font; } const FbTk::Font &font() const { return *m_font; } const FbTk::Color &textColor() const { return *m_text_color; } diff --git a/src/ToolFactory.cc b/src/ToolFactory.cc index 90dd70e..92569ba 100644 --- a/src/ToolFactory.cc +++ b/src/ToolFactory.cc @@ -152,13 +152,9 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow & } void ToolFactory::updateThemes() { - m_clock_theme.setAntialias(screen().antialias()); m_clock_theme.reconfigTheme(); - m_iconbar_theme.setAntialias(screen().antialias()); m_iconbar_theme.reconfigTheme(); - m_button_theme->setAntialias(screen().antialias()); m_button_theme->reconfigTheme(); - m_workspace_theme->setAntialias(screen().antialias()); m_workspace_theme->reconfigTheme(); } diff --git a/src/tests/menutest.cc b/src/tests/menutest.cc index c54289f..65a1c52 100644 --- a/src/tests/menutest.cc +++ b/src/tests/menutest.cc @@ -73,8 +73,8 @@ public: m_menu_theme(DefaultScreen(display())), m_menu(m_menu_theme, m_image_ctrl) { - m_menu_theme.frameFont().setAntialias(true); - m_menu_theme.titleFont().setAntialias(true); + //m_menu_theme.frameFont().setAntialias(true); + //m_menu_theme.titleFont().setAntialias(true); cerr<<"Loading menu: "<"<"<"<