diff options
author | Noah Levitt <nlevitt@columbia.edu> | 2004-02-23 22:39:26 +0000 |
---|---|---|
committer | Noah Levitt <nlevitt@src.gnome.org> | 2004-02-23 22:39:26 +0000 |
commit | e697bf3ac234b070f3ef269142b94bdefb353640 (patch) | |
tree | 2182fc24801330465036bd2c15d8080af1ee4ae5 /pango/fonts.c | |
parent | d234d2a87811f893069d383f45b6365030aa2188 (diff) | |
download | pango-e697bf3ac234b070f3ef269142b94bdefb353640.tar.gz |
New API pango_font_family_is_monospace. (#108728)
2003-02-23 Noah Levitt <nlevitt@columbia.edu>
* pango/pangowin32-fontmap.c:
* pango/pangofc-fontmap.c:
* pango/pango-font.h:
* pango/fonts.c: New API pango_font_family_is_monospace. (#108728)
Diffstat (limited to 'pango/fonts.c')
-rw-r--r-- | pango/fonts.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index b6515fca..aaa8c812 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -1361,6 +1361,36 @@ pango_font_family_list_faces (PangoFontFamily *family, PANGO_FONT_FAMILY_GET_CLASS (family)->list_faces (family, faces, n_faces); } +/** + * pango_font_family_is_monospace: + * @family: a #PangoFontFamily + * + * A monospace font is a font designed for text display where the the + * characters form a regular grid. For Western languages this would + * mean that the advance width of all characters are the same, but + * this categorization also includes Asian fonts which include + * double-width characters: characters that occupy two grid cells. + * g_unichar_iswide() returns a result that indicates whether a + * character is typically double-width in a monospace font. + * + * The best way to find out the grid-cell size is to call + * pango_font_metrics_get_approximate_digit_width(), since the results + * of pango_font_metrics_get_approximate_char_width() may be affected + * by double-width characters. + * + * Return value: TRUE if the family is monospace. + **/ +gboolean +pango_font_family_is_monospace (PangoFontFamily *family) +{ + g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), FALSE); + + if (PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace) + return PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace (family); + else + return FALSE; +} + /* * PangoFontFace */ |