summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlan Gilbert <alanhgilbert@gmail.com>2015-05-03 21:09:45 +0300
committerAlan Gilbert <alanhgilbert@gmail.com>2015-05-03 21:09:45 +0300
commitf182c43ceab950cea54a968af5d57470aadbec15 (patch)
treee562ee85e95094bcb2422565a68966ee8421d682
parentd4634e681a123d57a76312b1b65f44172e44266c (diff)
downloadxmobar-f182c43ceab950cea54a968af5d57470aadbec15.tar.gz
xmobar-f182c43ceab950cea54a968af5d57470aadbec15.tar.bz2
Explanatory warning when xft font is requsted but not supported
-rw-r--r--src/XUtil.hsc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/XUtil.hsc b/src/XUtil.hsc
index 9cb1def..e37d419 100644
--- a/src/XUtil.hsc
+++ b/src/XUtil.hsc
@@ -33,6 +33,7 @@ import Control.Concurrent
import Control.Monad (when)
import Control.Monad.Trans
import Control.Exception (SomeException, handle)
+import Data.List
import Foreign
import Graphics.X11.Xlib hiding (textExtents, textWidth)
import qualified Graphics.X11.Xlib as Xlib (textExtents, textWidth)
@@ -49,7 +50,6 @@ import qualified System.IO as UTF8 (readFile,hGetLine)
# endif
#endif
#if defined XFT
-import Data.List
import MinXft
import Graphics.X11.Xrender
#endif
@@ -81,12 +81,18 @@ data XFont = Core FontStruct
-- to the Xft backend Example: 'xft:Sans-10'
initFont :: Display ->String -> IO XFont
initFont d s =
-#ifdef XFT
let xftPrefix = "xft:" in
if xftPrefix `isPrefixOf` s then
+#ifdef XFT
fmap Xft $ initXftFont d s
- else
+#else
+ do
+ hPutStrLn stderr $ "Warning: Xmobar must be built with "
+ ++ "the with_xft flag to support font '" ++ s
+ ++ ".' Falling back on default."
+ initFont d miscFixedFont
#endif
+ else
#if defined UTF8 || __GLASGOW_HASKELL__ >= 612
fmap Utf8 $ initUtf8Font d s
#else