diff options
author | fluxgen <fluxgen> | 2002-10-15 16:34:14 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-10-15 16:34:14 (GMT) |
commit | 04d58f1c2db4a192cd034f11876afab3267a0eb1 (patch) | |
tree | 63d778dc8e5f42999ed7c55eaaad906e9ff0e0d9 /src | |
parent | a295efad66fc508a772732f74183d8fa66086f8a (diff) | |
download | fluxbox-04d58f1c2db4a192cd034f11876afab3267a0eb1.zip fluxbox-04d58f1c2db4a192cd034f11876afab3267a0eb1.tar.bz2 |
fallback on fixed if the font before was loaded but the new one couldnt load it
Diffstat (limited to 'src')
-rw-r--r-- | src/Font.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Font.cc b/src/Font.cc index cb169ac..4d03345 100644 --- a/src/Font.cc +++ b/src/Font.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | //$Id: Font.cc,v 1.13 2002/10/15 10:56:49 fluxgen Exp $ | 22 | //$Id: Font.cc,v 1.14 2002/10/15 16:34:14 fluxgen Exp $ |
23 | 23 | ||
24 | 24 | ||
25 | #include "Font.hh" | 25 | #include "Font.hh" |
@@ -38,6 +38,8 @@ | |||
38 | #include "XFontImp.hh" | 38 | #include "XFontImp.hh" |
39 | #include "XmbFontImp.hh" | 39 | #include "XmbFontImp.hh" |
40 | 40 | ||
41 | #include "StringUtil.hh" | ||
42 | |||
41 | //use gnu extensions | 43 | //use gnu extensions |
42 | #ifndef _GNU_SOURCE | 44 | #ifndef _GNU_SOURCE |
43 | #define _GNU_SOURCE | 45 | #define _GNU_SOURCE |
@@ -47,18 +49,16 @@ | |||
47 | #define __USE_GNU | 49 | #define __USE_GNU |
48 | #endif //__USE_GNU | 50 | #endif //__USE_GNU |
49 | 51 | ||
50 | #include <cstdarg> | ||
51 | #include <iostream> | 52 | #include <iostream> |
52 | #include <cassert> | 53 | #include <cstring> |
53 | #include <string> | 54 | #include <cstdlib> |
54 | #include <cstdio> | 55 | using namespace std; |
55 | #include <string.h> | ||
56 | 56 | ||
57 | #ifdef HAVE_SETLOCALE | 57 | #ifdef HAVE_SETLOCALE |
58 | #include <locale.h> | 58 | #include <locale.h> |
59 | #endif //HAVE_SETLOCALE | 59 | #endif //HAVE_SETLOCALE |
60 | 60 | ||
61 | #include "StringUtil.hh" | 61 | |
62 | 62 | ||
63 | namespace FbTk { | 63 | namespace FbTk { |
64 | 64 | ||
@@ -109,7 +109,7 @@ Font::~Font() { | |||
109 | } | 109 | } |
110 | 110 | ||
111 | void Font::setAntialias(bool flag) { | 111 | void Font::setAntialias(bool flag) { |
112 | 112 | bool loaded = m_fontimp->loaded(); | |
113 | #ifdef USE_XFT | 113 | #ifdef USE_XFT |
114 | if (flag && !isAntialias()) { | 114 | if (flag && !isAntialias()) { |
115 | m_fontimp = std::auto_ptr<FontImp>(new XftFontImp(m_fontstr.c_str())); | 115 | m_fontimp = std::auto_ptr<FontImp>(new XftFontImp(m_fontstr.c_str())); |
@@ -123,6 +123,11 @@ void Font::setAntialias(bool flag) { | |||
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | if (m_fontimp->loaded() != loaded) { // if the new font failed to load, fall back to 'fixed' | ||
127 | if (!m_fontimp->load("fixed")) // if that failes too, output warning | ||
128 | cerr<<"Warning: can't load fallback font 'fixed'."<<endl; | ||
129 | } | ||
130 | |||
126 | m_antialias = flag; | 131 | m_antialias = flag; |
127 | } | 132 | } |
128 | 133 | ||