aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/ThemeItems.cc
diff options
context:
space:
mode:
authormathias <mathias>2005-06-03 07:25:48 (GMT)
committermathias <mathias>2005-06-03 07:25:48 (GMT)
commitef76b45ab1857af1b12f0c336bfb8c0f19140aeb (patch)
treee380d87f9e4c5e1b27f7aeb8d3aa8acbe0e09d2c /src/FbTk/ThemeItems.cc
parent9c27e2e7993c9ccd604f77219a1f07c1be22e75a (diff)
downloadfluxbox-ef76b45ab1857af1b12f0c336bfb8c0f19140aeb.zip
fluxbox-ef76b45ab1857af1b12f0c336bfb8c0f19140aeb.tar.bz2
- Usage of xft-fonts is prefered, except a font-description starts with '-'
- Removed "antialias"-option completly, to enable/disable "antialias" use either <fontname>:antialias=<bool> in the style or use Xft.antialias: <bool> in your .Xdefaults - Added new styleresources: *.font.effect: <halo|shadow> *.font.shadow.x : <int> - shadow x offset *.font.shadow.y : <int> - shadow y offset *.font.shadow.color : <color> - color of shadow *.font.halo.color : <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: <font1>|<font2>|<font3> if loading of font1 fails, fluxbox probes <font2>, 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)
Diffstat (limited to 'src/FbTk/ThemeItems.cc')
-rw-r--r--src/FbTk/ThemeItems.cc60
1 files changed, 53 insertions, 7 deletions
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 @@
26#ifndef THEMEITEMS_HH 26#ifndef THEMEITEMS_HH
27#define THEMEITEMS_HH 27#define THEMEITEMS_HH
28 28
29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif // HAVE_CONFIG_H
32
29#include "Theme.hh" 33#include "Theme.hh"
30#include "Color.hh" 34#include "Color.hh"
31#include "Texture.hh" 35#include "Texture.hh"
@@ -98,9 +102,40 @@ void FbTk::ThemeItem<bool>::setFromString(char const *strval) {
98} 102}
99 103
100template <> 104template <>
105void ThemeItem<unsigned int>::setDefaultValue() {
106 m_value = 0;
107}
108
109template <>
110void ThemeItem<unsigned int>::setFromString(const char *str) {
111 sscanf(str, "%d", &m_value);
112}
113
114template <>
115void ThemeItem<unsigned int>::load(const std::string *name, const std::string *altname) {
116}
117
118
101void ThemeItem<Font>::setDefaultValue() { 119void ThemeItem<Font>::setDefaultValue() {
102 if (!m_value.load("fixed")) { 120 if (!m_value.load("fixed")) {
103 cerr<<"ThemeItem<Font>: Warning! Failed to load default value 'fixed'"<<endl; 121 cerr<<"ThemeItem<Font>: Warning! Failed to load default value 'fixed'"<<endl;
122 } else {
123 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect"));
124 if (effect == "halo") {
125 m_value.setHalo(true);
126 FbTk::Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(),
127 theme().screenNum());
128 m_value.setHaloColor(halo_color);
129
130 } else if (effect == "shadow" ) {
131 FbTk::Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str(),
132 theme().screenNum());
133
134 m_value.setShadow(true);
135 m_value.setShadowColor(shadow_color);
136 m_value.setShadowOffX(atoi(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str()));
137 m_value.setShadowOffY(atoi(ThemeManager::instance().resourceValue(name()+".shadow.y", altName()+".Shadow.Y").c_str()));
138 }
104 } 139 }
105} 140}
106 141
@@ -110,19 +145,30 @@ void ThemeItem<Font>::setFromString(const char *str) {
110 if (str == 0 || m_value.load(str) == false) { 145 if (str == 0 || m_value.load(str) == false) {
111 if (ThemeManager::instance().verbose()) { 146 if (ThemeManager::instance().verbose()) {
112 cerr<<"Theme: Error loading font "<< 147 cerr<<"Theme: Error loading font "<<
113 ((m_value.isAntialias() || m_value.utf8()) ? "(" : "")<< 148 ((m_value.utf8()) ? "(utf8)" : "")<<
114
115 (m_value.isAntialias() ? "antialias" : "")<<
116 (m_value.utf8() ? " utf8" : "")<<
117
118 ((m_value.isAntialias() || m_value.utf8()) ? ") " : "")<<
119 "for \""<<name()<<"\" or \""<<altName()<<"\": "<<str<<endl; 149 "for \""<<name()<<"\" or \""<<altName()<<"\": "<<str<<endl;
120 150
121 cerr<<"Theme: Setting default value"<<endl; 151 cerr<<"Theme: Setting default value"<<endl;
122 } 152 }
123 setDefaultValue(); 153 setDefaultValue();
154 } else {
155 string effect(ThemeManager::instance().resourceValue(name()+".effect", altName()+".Effect"));
156 if (effect == "halo") {
157 m_value.setHalo(true);
158 FbTk::Color halo_color(ThemeManager::instance().resourceValue(name()+".halo.color", altName()+".Halo.Color").c_str(),
159 theme().screenNum());
160 m_value.setHaloColor(halo_color);
161
162 } else if (effect == "shadow" ) {
163 FbTk::Color shadow_color(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str(),
164 theme().screenNum());
165
166 m_value.setShadow(true);
167 m_value.setShadowColor(shadow_color);
168 m_value.setShadowOffX(atoi(ThemeManager::instance().resourceValue(name()+".shadow.x", altName()+".Shadow.X").c_str()));
169 m_value.setShadowOffY(atoi(ThemeManager::instance().resourceValue(name()+".shadow.y", altName()+".Shadow.Y").c_str()));
170 }
124 } 171 }
125
126} 172}
127 173
128// do nothing 174// do nothing