aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Font.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2007-01-05 13:01:19 (GMT)
committersimonb <simonb>2007-01-05 13:01:19 (GMT)
commit3a79de034f87df155f540af2186c5d87dc187b3b (patch)
tree9352aebc02ecc46ec475e1a2764c8f39cd732453 /src/FbTk/Font.cc
parent87b8626793e25a8ab4b1e077fcf29cb06ff7f71c (diff)
downloadfluxbox-3a79de034f87df155f540af2186c5d87dc187b3b.zip
fluxbox-3a79de034f87df155f540af2186c5d87dc187b3b.tar.bz2
change default Xft font so that it works properly with rotation (see
notes in ChangeLog or FbTk/Font.cc)
Diffstat (limited to 'src/FbTk/Font.cc')
-rw-r--r--src/FbTk/Font.cc33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc
index 47883e1..156c812 100644
--- a/src/FbTk/Font.cc
+++ b/src/FbTk/Font.cc
@@ -197,21 +197,44 @@ bool Font::load(const string &name) {
197 197
198 FontImp* tmp_font(0); 198 FontImp* tmp_font(0);
199 199
200 // Xft and X/Xmb fonts have different defaults
201 // (fixed doesn't really work right with Xft, especially rotated)
202
203 // HOWEVER, note that if a Xft-style font is requested (not start with "-"), and
204 // it turns out to be a bitmapped XFont, then Xft will load it, BUT it does not
205 // currently (5jan2007) rotate bitmapped fonts (ok-ish), nor adjust the baseline for its
206 // lack of rotation (not ok: messes up placement). I can't see a neat way around this,
207 // other than the user re-specifying their font explicitly in XFont form so we don't use the
208 // Xft backend.
209
210 std::string realname = *name_it;
211
200#ifdef USE_XFT 212#ifdef USE_XFT
201 if ((*name_it)[0] != '-') 213 if ((*name_it)[0] != '-') {
214
215 if (*name_it == "__DEFAULT__")
216 realname = "monospace";
217
202 tmp_font = new XftFontImp(0, s_utf8mode); 218 tmp_font = new XftFontImp(0, s_utf8mode);
203#endif // USE_XFT 219#endif // USE_XFT
220 }
204 221
205 if (!tmp_font) { 222 if (!tmp_font) {
223 if (*name_it == "__DEFAULT__")
224 realname = "fixed";
225
206#ifdef USE_XMB 226#ifdef USE_XMB
207 if (s_multibyte || s_utf8mode) 227
228 if (s_multibyte || s_utf8mode) {
208 tmp_font = new XmbFontImp(0, s_utf8mode); 229 tmp_font = new XmbFontImp(0, s_utf8mode);
209 else // basic font implementation 230 } else // basic font implementation
210#endif // USE_XMB 231#endif // USE_XMB
211 tmp_font = new XFontImp(); 232 {
233 tmp_font = new XFontImp();
234 }
212 } 235 }
213 236
214 if (tmp_font && tmp_font->load((*name_it).c_str())) { 237 if (tmp_font && tmp_font->load(realname.c_str())) {
215 lookup_map[name] = (*name_it); 238 lookup_map[name] = (*name_it);
216 m_fontimp = tmp_font; 239 m_fontimp = tmp_font;
217 font_cache[(*name_it)] = tmp_font; 240 font_cache[(*name_it)] = tmp_font;