What is the correct way to tell if Pango has found the right font?

Posted by Thedward on Stack Overflow See other posts from Stack Overflow or by Thedward
Published on 2011-01-03T22:49:58Z Indexed on 2011/01/03 22:54 UTC
Read the original article Hit count: 215

Filed under:
|

I create a font description with:

pango_font_description_from_string()

Then load a font with:

pango_context_load_font()

This process seems to result in some default font regardless of the string I give it.

Is there any sane way for me to determine if the returned font is the result of an alias (e.g. "Sans", "Monospace") or just the last chance default font?

For example, if I request the font "Monospace" and get back "DejaVu Sans Mono" then I should be able to declare that a good match. However, if I request "OquieZee" and get back "DejaVu Sans" then I'd like to know that I just got back the default font because the font I requested doesn't actually exist on the system.

When I first saw pango_font_description_better_match() I thought it might be of help, but it turned out to be a dead end.

© Stack Overflow or respective owner

Related posts about fonts

Related posts about pango