How to set font size of a GTK label with gi-gtk-declarative?

128 Views Asked by At

I want larger text but am not sure how. (I found Label has an attributes attribute of type PangoAttrList but can't figure out how to construct the latter (if indeed that is how one sets the font size) in a context where it can be set on the Label widget.)

A minimal example follows:

#!/usr/bin/env cabal
{- cabal:
build-depends:
  , base ^>= 4.13
  , gi-gtk
  , gi-gtk-declarative
  , gi-gtk-declarative-app-simple
ghc-options:
  -Wall
  -threaded
-}

{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}

import Data.Void (absurd)

import qualified GI.Gtk as Gtk hiding ((:=), on)
import qualified GI.Gtk.Declarative as Gtk
import qualified GI.Gtk.Declarative.App.Simple as Gtk

main :: IO ()
main = () <$ Gtk.run Gtk.App
  { Gtk.view = \ () ->
        Gtk.bin Gtk.Window [#title Gtk.:= "example"] $
        Gtk.widget Gtk.Label [#label Gtk.:= "foobar" {- What should be here? -}]
  , Gtk.update = \ () -> absurd
  , Gtk.inputs = []
  , Gtk.initialState = ()
  }
0

There are 0 best solutions below