How to load a ttf font

Hi all,
I’d like to change the default font used by the GTK application (sans) to the Montserrat font.
I own a set of files of this font (all the variants).
How can I point to the font?
My first try was by the CSS file (on window tag to be global) but if I add the ‘font-family: Montserrat-Regular’ directive I see the following error in the console window (run by glade tool):

(glade.exe:17660): Pango-WARNING **: 09:02:15.036: couldn't load font "Montserrat-Regular 9", falling back to "Sans 9", expect ugly output.

If I add the directive:

    font-family: Montserrat-Regular;
    src: url('Montserrat-Regular.ttf');

I see the error:

GladeUI-Message: 09:04:45.873: CSS parsing failed: lockrecharge.css:4:7'src' is not a valid property name

Do I need to handle the font file from the C code?


gtk does not support all features of css.

Gtk – 4.0: GTK CSS Properties

In order to be able to find fonts, fonts should be installed. If you don’t want to install fonts, you can use fontconfig

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.