Getting and using installed system font family members

Godot Version

4.3

Question

I’m trying to build a font selector where the user can use pick between installed systems fonts to use.

Using OS.get_system_fonts() I can get a list of all installed font family names on the system. However, the issue I’m running into is that this is just the first step to picking a font. Each such font family usually has a number of style variations (from 1 up to 12), like Bold, Italic, This, Regular, Roman, Semi-Bold etc. And to identify and select a specific font you need to know both the font family name and the style name. For example “Roboto Light Italic”. However, I’ve found no way of finding what style members each font family has.

Given a font family name from the OS.get_system_fonts() list (like “Roboto”), is there a way to get what style variations are available for this font family?

The way to use a system font is then via the SystemFont class, which works sort of like a query where you can assign a number of font_names (family names) and traits (like font_italic and font_weight values). But it works with fallbacks, so if no match is found you get the closest fallback instead of nothing. And there seems to be no way of getting them by their style name (like “Thin”, “Roman” or “Semi-bold”)? So if you were able to get the names of the style members of a font family, how would you get that specific system font?

After a little more research it seems this is not currently possible to do in Godot. So I’ve added a proposal for an addition to SystemFont to support specifying font style names and getting a list of available such styles per font family.

You can support the proposal or contribute to the discussion here: