summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRyan Mulligan <ryan@ryantm.com>2014-06-01 12:09:37 -0700
committerRyan Mulligan <ryan@ryantm.com>2014-06-01 12:09:37 -0700
commite1e202ba27918069be2defc5c4881d5621ca3ce8 (patch)
tree2df87f768b6145f93ad0f5168b2c99784753f049
parent6dd945510c09ff65c0c9976e123279d264aa4d14 (diff)
downloadxmobar-e1e202ba27918069be2defc5c4881d5621ca3ce8.tar.gz
xmobar-e1e202ba27918069be2defc5c4881d5621ca3ce8.tar.bz2
fix vertical text alignment calculation
the baseline (valign) is now set so the font will render with equal vertical margin above and below the font extents
-rw-r--r--src/Xmobar.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index c126b7c..7befc18 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -315,7 +315,8 @@ printStrings dr gc fontst offs a sl@((s,c,l):xs) = do
let (conf,d) = (config &&& display) r
Rectangle _ _ wid ht = rect r
totSLen = foldr (\(_,_,len) -> (+) len) 0 sl
- valign = -1 + (fi ht + fi (as + ds)) `div` 2
+ verticalMargin = (fi ht) - fi (as + ds)
+ valign = (fi ht) - (fi ds) - (verticalMargin `div` 2)
remWidth = fi wid - fi totSLen
offset = case a of
C -> (remWidth + offs) `div` 2