diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-02-11 06:14:28 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-02-11 06:14:28 +0000 |
commit | b1c021842d26d5674a51f802f29e2a8496767c55 (patch) | |
tree | 58e8cf4cbaa464eaf728fc38e7aa1bbfb1cb24c3 /pango/fonts.c | |
parent | 11884d20295c2aea6dfeb8a915dd02b48ec60d9c (diff) | |
download | pango-b1c021842d26d5674a51f802f29e2a8496767c55.tar.gz |
Add style selector, rewrite family selector to use list_families().
Thu Feb 10 19:57:27 2000 Owen Taylor <otaylor@redhat.com>
* examples/viewer.c: Add style selector, rewrite family
selector to use list_families().
* libpango/pango-context.[ch] libpango/pango-font.h libpango/pangox.c
libpango/fonts.c: Add calls to list families, modify list_fonts()
call to take an optional "family" parameter for the purpose of
listing the fonts within a family.
Diffstat (limited to 'pango/fonts.c')
-rw-r--r-- | pango/fonts.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index a519daee..b52742aa 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -290,20 +290,62 @@ pango_font_map_load_font (PangoFontMap *fontmap, /** * pango_font_map_list_fonts: * @fontmap: a #PangoFontMap + * @family: the family for which to list the fonts, or %NULL + * to list fonts in all families. * @descs: location to store a pointer to an array of pointers to * #PangoFontDescription. This array should be freed * with pango_font_descriptions_free(). * @n_descs: location to store the number of elements in @descs * - * List all fonts in a fontmap. + * List all fonts in a fontmap, or the fonts in a particular family. **/ void pango_font_map_list_fonts (PangoFontMap *fontmap, + const char *family, PangoFontDescription ***descs, int *n_descs) { g_return_if_fail (fontmap != NULL); - fontmap->klass->list_fonts (fontmap, descs, n_descs); + fontmap->klass->list_fonts (fontmap, family, descs, n_descs); } +/** + * pango_font_map_list_families: + * @fontmap: a #PangoFontMap + * @families: location to store a pointer to an array of strings. + * This array should be freed with pango_font_map_free_families(). + * @n_families: location to store the number of elements in @descs + * + * List all families for a fontmap. + **/ +void +pango_font_map_list_families (PangoFontMap *fontmap, + gchar ***families, + int *n_families) +{ + g_return_if_fail (fontmap != NULL); + + fontmap->klass->list_families (fontmap, families, n_families); +} + +/** + * pango_font_map_free_families: + * @families: a list of families + * @n_families: number of elements in @families + * + * Free a list of families returned from pango_font_map_list_families() + **/ +void +pango_font_map_free_families (gchar **families, + int n_families) +{ + int i; + + g_return_if_fail (n_families == 0 || families != NULL); + + for (i=0; i<n_families; i++) + g_free (families[i]); + + g_free (families); +} |