summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xmobar/Text')
-rw-r--r--src/Xmobar/Text/Pango.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Xmobar/Text/Pango.hs b/src/Xmobar/Text/Pango.hs
index 30ec76f..609e3b1 100644
--- a/src/Xmobar/Text/Pango.hs
+++ b/src/Xmobar/Text/Pango.hs
@@ -35,13 +35,14 @@ withPangoColor (fg, bg) s =
printf fmt (xmlEscape fg) (xmlEscape bg) (xmlEscape s)
where fmt = "<span foreground=\"%s\" background=\"%s\">%s</span>"
+fixXft :: String -> String
+fixXft font = if "xft:" `isPrefixOf` font then drop 4 font else font
+
withPangoFont :: String -> String -> String
-withPangoFont font txt = printf fmt pfn (xmlEscape txt)
+withPangoFont font txt = printf fmt (fixXft font) (xmlEscape txt)
where fmt = "<span font=\"%s\">%s</span>"
- pfn = if "xft:" `isPrefixOf` font then drop 4 font else font
withPangoMarkup :: String -> String -> String -> String -> String
withPangoMarkup fg bg font txt =
- printf fmt pfn (xmlEscape fg) (xmlEscape bg) (xmlEscape txt)
- where pfn = if isPrefixOf "xft:" font then drop 4 font else font
- fmt = "<span font=\"%s\" foreground=\"%s\" background=\"%s\">%s</span>"
+ printf fmt (fixXft font) (xmlEscape fg) (xmlEscape bg) (xmlEscape txt)
+ where fmt = "<span font=\"%s\" foreground=\"%s\" background=\"%s\">%s</span>"