From 7b891200c17a501ed1641a1300164785f5898a22 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 13 Apr 2015 03:33:54 +0200 Subject: A bit more experimentation with alignment --- src/XUtil.hsc | 4 ++-- src/Xmobar.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/XUtil.hsc b/src/XUtil.hsc index 914ebdd..41ba087 100644 --- a/src/XUtil.hsc +++ b/src/XUtil.hsc @@ -184,8 +184,8 @@ printString dpy drw fs@(Xft fonts) _ fc bc x y s al = do when (al == 255) $ do (a,d) <- textExtents fs s gi <- xftTxtExtents' dpy fonts s - drawXftRect draw bc' x (y - a) (xglyphinfo_xOff gi) (a + d + 1) - drawXftString' draw fc' fonts (toInteger x) (toInteger (y - 1)) s + drawXftRect draw bc' x (y - a + 1) (xglyphinfo_xOff gi) (a + d + 1) + drawXftString' draw fc' fonts (toInteger x) (toInteger y) s #endif diff --git a/src/Xmobar.hs b/src/Xmobar.hs index 680dd89..723dab2 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -322,8 +322,8 @@ verticalOffset ht (Text t) fontst conf | textOffset conf > -1 = return $ fi (textOffset conf) | otherwise = do (as,ds) <- io $ textExtents fontst t - let margin = (fi ht - fi (as + ds)) `div` 2 - return $ fi ht - margin - fi ds - 1 + let margin = (fi ht - fi ds - fi as) `div` 2 + return $ fi as + margin - 1 verticalOffset ht (Icon _) _ conf | iconOffset conf > -1 = return $ fi (iconOffset conf) | otherwise = return $ fi (ht `div` 2) - 1 -- cgit v1.2.3