pango-list-typefaces.c 891 B

1234567891011121314151617181920212223242526272829303132
  1. // gcc -o pango-list-typefaces -Wall -g pango-list-typefaces.c `pkg-config --cflags --libs pango` `pkg-config --cflags --libs cairo` `pkg-config --cflags --libs pangocairo` `pkg-config --cflags --libs glib-2.0`
  2. #include <glib.h>
  3. #include <pango/pangocairo.h>
  4. static void
  5. list_fonts ()
  6. {
  7. int i;
  8. PangoFontFamily ** families;
  9. int n_families;
  10. PangoFontMap * fontmap;
  11. fontmap = pango_cairo_font_map_get_default();
  12. pango_font_map_list_families (fontmap, & families, & n_families);
  13. printf ("There are %d families\n", n_families);
  14. for (i = 0; i < n_families; i++) {
  15. PangoFontFamily * family = families[i];
  16. const char * family_name;
  17. family_name = pango_font_family_get_name (family);
  18. printf ("Family %d: %s\n", i, family_name);
  19. }
  20. g_free (families);
  21. }
  22. int main (int argc, char ** argv)
  23. {
  24. list_fonts ();
  25. return 0;
  26. }