antoyo / relm

Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust
MIT License
2.43k stars 78 forks source link

Change Label font size #198

Closed MGlolenstine closed 4 years ago

MGlolenstine commented 4 years ago

How to change Label's fontsize? There's no method I can see for setting the font or it's size.

This page, for example, uses modify_font, but that's an old version and it doesn't exist anymore

emmanueltouzery commented 4 years ago

i know of two ways:

  1. set markup for the label instead of plain text, then use pango markup (like <big> or things like that)

  2. more flexible: use CSS. you can assign a CSS class to the label like so:

    self.header_label
        .get_style_context()
        .add_class("event_header_label");

And then set CSS for that label. You can find examples in the relm repo and projects using relm (I had lots of luck with https://github.com/sanpii/effitask ).

MGlolenstine commented 4 years ago

Oooh, thanks! and I was here, looking for a method call to font_size :sweat_smile: