implemented gimp_font_list_restore().

2003-03-26  Sven Neumann  <sven@gimp.org>

	* app/text/gimpfontlist.c: implemented gimp_font_list_restore().
This commit is contained in:
Sven Neumann
2003-03-25 23:41:01 +00:00
committed by Sven Neumann
parent 6763591e98
commit dec7cae03e
2 changed files with 23 additions and 11 deletions

View File

@ -1,6 +1,6 @@
2003-03-26 Sven Neumann <sven@gimp.org>
* app/text/gimpfontlist.c: first draft of gimp_font_list_restore().
* app/text/gimpfontlist.c: implemented gimp_font_list_restore().
2003-03-26 Sven Neumann <sven@gimp.org>

View File

@ -135,8 +135,10 @@ gimp_font_list_restore (GimpFontList *list)
{
PangoContext *pango_context;
PangoFontFamily **families;
PangoFontFace **faces;
gint n_families;
gint i;
gint n_faces;
gint i, j;
g_return_if_fail (GIMP_IS_FONT_LIST (list));
@ -146,17 +148,27 @@ gimp_font_list_restore (GimpFontList *list)
for (i = 0; i < n_families; i++)
{
GimpFont *font;
const gchar *name;
pango_font_family_list_faces (families[i], &faces, &n_faces);
for (j = 0; j < n_faces; j++)
{
PangoFontDescription *desc;
GimpFont *font;
gchar *name;
name = pango_font_family_get_name (families[i]);
desc = pango_font_face_describe (faces[j]);
name = pango_font_description_to_string (desc);
pango_font_description_free (desc);
font = g_object_new (GIMP_TYPE_FONT,
"name", name,
"pango-context", pango_context,
NULL);
gimp_container_add (GIMP_CONTAINER (list), GIMP_OBJECT (font));
g_object_unref (font);
font = g_object_new (GIMP_TYPE_FONT,
"name", name,
"pango-context", pango_context,
NULL);
g_free (name);
gimp_container_add (GIMP_CONTAINER (list), GIMP_OBJECT (font));
g_object_unref (font);
}
}
g_free (families);