all repos — fluxbox @ 04d58f1c2db4a192cd034f11876afab3267a0eb1

custom fork of the fluxbox windowmanager

fallback on fixed if the font before was loaded but the new one couldnt load it
fluxgen fluxgen
commit

04d58f1c2db4a192cd034f11876afab3267a0eb1

parent

a295efad66fc508a772732f74183d8fa66086f8a

1 files changed, 13 insertions(+), 8 deletions(-)

jump to
M src/Font.ccsrc/Font.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.cc,v 1.13 2002/10/15 10:56:49 fluxgen Exp $ +//$Id: Font.cc,v 1.14 2002/10/15 16:34:14 fluxgen Exp $ #include "Font.hh"

@@ -38,6 +38,8 @@ // standard font system

#include "XFontImp.hh" #include "XmbFontImp.hh" +#include "StringUtil.hh" + //use gnu extensions #ifndef _GNU_SOURCE #define _GNU_SOURCE

@@ -47,18 +49,16 @@ #ifndef __USE_GNU

#define __USE_GNU #endif //__USE_GNU -#include <cstdarg> #include <iostream> -#include <cassert> -#include <string> -#include <cstdio> -#include <string.h> +#include <cstring> +#include <cstdlib> +using namespace std; #ifdef HAVE_SETLOCALE #include <locale.h> #endif //HAVE_SETLOCALE -#include "StringUtil.hh" + namespace FbTk {

@@ -109,7 +109,7 @@

} void Font::setAntialias(bool flag) { - + bool loaded = m_fontimp->loaded(); #ifdef USE_XFT if (flag && !isAntialias()) { m_fontimp = std::auto_ptr<FontImp>(new XftFontImp(m_fontstr.c_str()));

@@ -121,6 +121,11 @@ m_fontimp = std::auto_ptr<FontImp>(new XmbFontImp(m_fontstr.c_str(), m_utf8mode));

else { m_fontimp = std::auto_ptr<FontImp>(new XFontImp(m_fontstr.c_str())); } + } + + if (m_fontimp->loaded() != loaded) { // if the new font failed to load, fall back to 'fixed' + if (!m_fontimp->load("fixed")) // if that failes too, output warning + cerr<<"Warning: can't load fallback font 'fixed'."<<endl; } m_antialias = flag;