xmonad-contrib-0.18.0: Community-maintained extensions for xmonad

Copyright | (c) 2007 Andrea Rossato and Spencer Janssen
License | BSD-style (see xmonad/LICENSE)
Maintainer | andrea.rossato@unibz.it
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Util.Font

Contents

- Usage:

Description

A module for abstracting a font facility over Core fonts and Xft

Synopsis

- data XMonadFont
  - = Core FontStruct
  - | Utf8 FontSet
  - | Xft (NonEmpty XftFont)
- initXMF :: String -> X XMonadFont
- releaseXMF :: XMonadFont -> X ()
- initCoreFont :: String -> X FontStruct
- releaseCoreFont :: FontStruct -> X ()
- initUtf8Font :: String -> X FontSet
- releaseUtf8Font :: FontSet -> X ()
- data Align
  - = AlignCenter
  - | AlignRight
  - | AlignLeft
  - | AlignRightOffset Int
- stringPosition :: (Functor m, MonadIO m) => Display -> XMonadFont -> Rectangle -> Align -> String -> m (Position, Position)
- textWidthXMF :: MonadIO m => Display -> XMonadFont -> String -> m Int
- textExtentsXMF :: MonadIO m => XMonadFont -> String -> m (Int32, Int32)
- printStringXMF :: (Functor m, MonadIO m) => Display -> Drawable -> XMonadFont -> GC -> String -> String -> Position -> Position -> String -> m ()
- stringToPixel :: (Functor m, MonadIO m) => Display -> String -> m Pixel
- pixelToString :: MonadIO m => Display -> Pixel -> m String
- fi :: (Integral a, Num b) => a -> b

# Usage:

See XMonad.Layout.Tabbed or XMonad.Prompt for usage examples

data XMonadFont #

Constructors

Core FontStruct |
Utf8 FontSet |
Xft (NonEmpty XftFont) |

initXMF :: String -> X XMonadFont #

When initXMF gets a font name that starts with 'xft:' it switches to the Xft backend Example: 'xft: Sans-10'

releaseXMF :: XMonadFont -> X () #

initCoreFont :: String -> X FontStruct #

Given a fontname returns the font structure. If the font name is not valid the default font will be loaded and returned.

releaseCoreFont :: FontStruct -> X () #

initUtf8Font :: String -> X FontSet #

releaseUtf8Font :: FontSet -> X () #

data Align #

String position

Constructors

AlignCenter |
AlignRight |
AlignLeft |
AlignRightOffset Int |

#### Instances

Instances details

Read Align # |
Instance details Defined in XMonad.Util.Font Methods readsPrec :: Int -> ReadS Align # readList :: ReadS [Align] # readPrec :: ReadPrec Align # readListPrec :: ReadPrec [Align] #
Show Align # |
Instance details Defined in XMonad.Util.Font Methods showsPrec :: Int -> Align -> ShowS # show :: Align -> String # showList :: [Align] -> ShowS #

stringPosition :: (Functor m, MonadIO m) => Display -> XMonadFont -> Rectangle -> Align -> String -> m (Position, Position) #

Return the string x and y `Position` in a `Rectangle`, given a `FontStruct` and the `Align`ment

textWidthXMF :: MonadIO m => Display -> XMonadFont -> String -> m Int #

textExtentsXMF :: MonadIO m => XMonadFont -> String -> m (Int32, Int32) #

printStringXMF :: (Functor m, MonadIO m) => Display -> Drawable -> XMonadFont -> GC -> String -> String -> Position -> Position -> String -> m () #

stringToPixel :: (Functor m, MonadIO m) => Display -> String -> m Pixel #

Get the Pixel value for a named color: if an invalid name is given the black pixel will be returned.

pixelToString :: MonadIO m => Display -> Pixel -> m String #

Convert a `Pixel` into a `String`.

This function removes any alpha channel from the `Pixel`, because X11 mishandles alpha channels and produces black.

fi :: (Integral a, Num b) => a -> b #

Short for `fromIntegral`.