How to check if a font exists in Cairo and Pango?
Ken Resander <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
My application should check if a font exists and if it does not try the next font preference obtained from the user, a bit like processing a font-choice list in CSS. Cairo: const char * str = "nosuchfont"; cairo_font_face_t * ff = cairo_toy_font_face_create ( str , CAIRO_FONT_SLANT_NORMAL , CAIRO_FONT_WEIGHT_NORMAL ) ; const char * toyfamilyis = cairo_toy_font_face_get_family ( ff ); The toyfamilyis was returned as 'nosuchfont'. The manual mentions that toy_font_face_create and the cairo_font_select_face do not report back whether the font exists or not. A pity. If it returned NULL for a non-existent choice then my program could loop through the user preferences. I also tried pango: PangoFontDescription * pfd = pango_font_description_from_string ( str ); const char * familyis = pango_font_description_get_family(pfd); This time familyis was also returned as 'nosuchfont'. I have read somewhere that pango can tell if a font exists. How can I make it return this information? Ken -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo