mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-09 08:21:51 -07:00
Use Xft automatically if available
This commit is contained in:
@@ -85,7 +85,7 @@ initXMF s =
|
|||||||
do
|
do
|
||||||
dpy <- asks display
|
dpy <- asks display
|
||||||
xftdraw <- io $ xftFontOpen dpy (defaultScreenOfDisplay dpy) (drop (length xftPrefix) s)
|
xftdraw <- io $ xftFontOpen dpy (defaultScreenOfDisplay dpy) (drop (length xftPrefix) s)
|
||||||
return (Right xftdraw)
|
return (Xft xftdraw)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
(initCoreFont s >>= (return . Core))
|
(initCoreFont s >>= (return . Core))
|
||||||
@@ -104,7 +104,7 @@ releaseXMF (Xft xftfont) = do
|
|||||||
textWidthXMF :: Display -> XMonadFont -> String -> IO Int
|
textWidthXMF :: Display -> XMonadFont -> String -> IO Int
|
||||||
textWidthXMF _ (Core fs) s = return $ fi $ textWidth fs s
|
textWidthXMF _ (Core fs) s = return $ fi $ textWidth fs s
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
textWidthXMF dpy (Right xftdraw) s = do
|
textWidthXMF dpy (Xft xftdraw) s = do
|
||||||
gi <- xftTextExtents dpy xftdraw s
|
gi <- xftTextExtents dpy xftdraw s
|
||||||
return $ xglyphinfo_width gi
|
return $ xglyphinfo_width gi
|
||||||
#endif
|
#endif
|
||||||
@@ -112,7 +112,7 @@ textWidthXMF dpy (Right xftdraw) s = do
|
|||||||
textExtentsXMF :: Display -> XMonadFont -> String -> IO (FontDirection,Int32,Int32,CharStruct)
|
textExtentsXMF :: Display -> XMonadFont -> String -> IO (FontDirection,Int32,Int32,CharStruct)
|
||||||
textExtentsXMF _ (Core fs) s = return $ textExtents fs s
|
textExtentsXMF _ (Core fs) s = return $ textExtents fs s
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
textExtentsXMF _ (Right xftfont) _ = do
|
textExtentsXMF _ (Xft xftfont) _ = do
|
||||||
ascent <- xftfont_ascent xftfont
|
ascent <- xftfont_ascent xftfont
|
||||||
descent <- xftfont_descent xftfont
|
descent <- xftfont_descent xftfont
|
||||||
return (error "Font direction touched", fi ascent, fi descent, error "Font overall size touched")
|
return (error "Font direction touched", fi ascent, fi descent, error "Font overall size touched")
|
||||||
@@ -146,7 +146,7 @@ printStringXMF d p (Core fs) gc fc bc x y s = do
|
|||||||
io $ drawImageString d p gc x y s
|
io $ drawImageString d p gc x y s
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
printStringXMF dpy drw (Right font) _ fc _ x y s = do
|
printStringXMF dpy drw (Xft font) _ fc _ x y s = do
|
||||||
let screen = defaultScreenOfDisplay dpy;
|
let screen = defaultScreenOfDisplay dpy;
|
||||||
colormap = defaultColormapOfScreen screen;
|
colormap = defaultColormapOfScreen screen;
|
||||||
visual = defaultVisualOfScreen screen;
|
visual = defaultVisualOfScreen screen;
|
||||||
|
@@ -20,13 +20,20 @@ cabal-version: >= 1.2
|
|||||||
flag small_base
|
flag small_base
|
||||||
description: Choose the new smaller, split-up base package.
|
description: Choose the new smaller, split-up base package.
|
||||||
|
|
||||||
|
flag use_xft
|
||||||
|
description: Use Xft to render text
|
||||||
|
|
||||||
library
|
library
|
||||||
if flag(small_base)
|
if flag(small_base)
|
||||||
build-depends: base >= 3, containers, directory, process, random
|
build-depends: base >= 3, containers, directory, process, random
|
||||||
else
|
else
|
||||||
build-depends: base < 3
|
build-depends: base < 3
|
||||||
|
|
||||||
build-depends: mtl, unix, X11==1.3.0.20071111, xmonad==0.4, utf8-string, X11-xft
|
if flag(use_xft)
|
||||||
|
build-depends: X11-xft
|
||||||
|
ghc-options: -DXFT
|
||||||
|
|
||||||
|
build-depends: mtl, unix, X11==1.3.0.20071111, xmonad==0.4, utf8-string
|
||||||
ghc-options: -Wall -Werror
|
ghc-options: -Wall -Werror
|
||||||
exposed-modules: Documentation
|
exposed-modules: Documentation
|
||||||
XMonad.Actions.Commands
|
XMonad.Actions.Commands
|
||||||
|
Reference in New Issue
Block a user