Question

I have a PangoFontDescription and I want to know whether it describes a monospace font.

I have seen the function pango_font_family_is_monospace() in the Pango API documentation but after several hours of puzzling it is still not clear to me what the relationships are between PangoFontFamily, PangoFontMap, PangoFont, PangoFontset, PangoContext, and PangoFontDescription and whether I need any or all of these to achieve what I want. So far, PangoFontDescription is the only part of Pango I've needed to use, as GTK manages to abstract everything else away.

Can anyone who has done this before help me out?

Was it helpful?

Solution

You can use pango_font_description_get_family() and after that call pango_font_family_is_monospace() on the result.

EDIT:

Since pango_font_description_get_family() returns only a name you can do this: call pango_context_list_families() and search for a family object that has that name. After that, call pango_font_family_is_monospace() on the found object. Not sure what to do if no family object with that name is found, though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top