diff options
author | Tor Lillqvist <tml@iki.fi> | 2000-11-19 21:09:07 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2000-11-19 21:09:07 +0000 |
commit | 4cd0ea80ed9b8d768eb4e736403ae195f18eaccd (patch) | |
tree | 282d90f7d521354b3dce213695a802d9a87aa0da /pango/fonts.c | |
parent | ad9f543f410a0e7bbdbadafa42c75bc04ff2be58 (diff) | |
download | pango-4cd0ea80ed9b8d768eb4e736403ae195f18eaccd.tar.gz |
New file.
2000-11-19 Tor Lillqvist <tml@iki.fi>
* README.win32: New file.
* pango/fonts.c (pango_font_description_to_filename): New
function. As pango_font_description_to_string, but with result
that is better suitable as a filename: No spaces or other strange
characters, all in lowercase.
(pango_font_describe): Implement this function, call the
corresponding method.
* pango/pango-font.h: Declare pango_font_description_to_filename.
* pango/pangowin32.c (pango_win32_font_describe)
* pango/pangoft2.c (pango_ft2_font_describe): Implement these.
* pango/pangoft2-fontmap.c (pango_ft2_font_entry_get_coverage)
* pango/pangowin32-fontmap.c (pango_win32_font_entry_get_coverage):
Implement file-based persistent caching of coverages.
* pango/pangoft2-private.h (struct _PangoFT2FontEntry)
* pango/pangowin32-private.h (struct _PangoWin32FontEntry): Move
struct definition here from the -fontmap files.
* pango/pango.def: Updates.
Diffstat (limited to 'pango/fonts.c')
-rw-r--r-- | pango/fonts.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index ed27e646..d0bee3d3 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -365,6 +365,35 @@ pango_font_description_to_string (const PangoFontDescription *desc) return str; } +/** + * pango_font_description_to_filename: + * @desc: a #PangoFontDescription + * + * Create a filename representation of a font description. The + * filename is identical to the result from calling + * pango_font_description_to_string(), but with underscores instead of + * characters that are untypical in filenames, and in lower case only. + * + * Return value: a new string that must be freed with g_free(). + **/ +char * +pango_font_description_to_filename (const PangoFontDescription *desc) +{ + char *result = pango_font_description_to_string (desc); + char *p; + + g_strdown (result); + p = result; + while (*p) + { + if (strchr ("-_.", *p) == NULL && !isalnum (*p)) + *p = '_'; + p++; + } + + return result; +} + GType pango_font_get_type (void) { @@ -394,6 +423,22 @@ pango_font_get_type (void) } /** + * pango_font_describe: + * @font: a #PangoFont + * + * Return a description of the font. + * + * Return value: a newly allocated #PangoFontDescription object. + **/ +PangoFontDescription * +pango_font_describe (PangoFont *font) +{ + g_return_val_if_fail (font != NULL, NULL); + + return PANGO_FONT_GET_CLASS (font)->describe (font); +} + +/** * pango_font_get_coverage: * @font: a #PangoFont * @lang: the language tag (in the form of "en_US") |