문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top