File: Fonts.hs

package info (click to toggle)
haskell-gtk 0.15.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,964 kB
  • sloc: haskell: 3,346; ansic: 826; makefile: 161
file content (19 lines) | stat: -rw-r--r-- 575 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Example of an drawing graphics onto a canvas.
import Graphics.UI.Gtk
import Data.List ( intersperse )

main = do
  initGUI
  fm <- cairoFontMapGetDefault
  ffs <- pangoFontMapListFamilies fm
  mapM_ (\ff -> do
    putStrLn (show ff++": ")
    fcs <- pangoFontFamilyListFaces ff
    mapM_ (\fc -> do
      sizes <- pangoFontFaceListSizes fc
      let showSize Nothing = "all sizes"
          showSize (Just sz) = concat (intersperse ", " (map show sz))++
                               " points"
      putStrLn ("  "++show fc++" in "++showSize sizes)
      ) fcs
    ) ffs