Beispiel #1
0
void
gimp_font_list_restore (GimpFontList *list)
{
  PangoFontMap *fontmap;
  PangoContext *context;

  g_return_if_fail (GIMP_IS_FONT_LIST (list));

  fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
  if (! fontmap)
    g_error ("You are using a Pango that has been built against a cairo "
             "that lacks the Freetype font backend");

  pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (fontmap),
                                       list->yresolution);
  context = pango_font_map_create_context (fontmap);
  g_object_unref (fontmap);

  gimp_container_freeze (GIMP_CONTAINER (list));

  gimp_font_list_load_names (list, PANGO_FONT_MAP (fontmap), context);
  g_object_unref (context);

  gimp_list_sort_by_name (GIMP_LIST (list));

  gimp_container_thaw (GIMP_CONTAINER (list));
}
Beispiel #2
0
void
gimp_font_list_restore (GimpFontList *list)
{
  PangoFontMap *fontmap;
  PangoContext *context;

  g_return_if_fail (GIMP_IS_FONT_LIST (list));

  if (font_desc_to_string == NULL)
    {
      PangoFontDescription *desc;
      gchar                *name;
      gchar                 last_char;

      desc = pango_font_description_new ();
      pango_font_description_set_family (desc, "Wilber 12");

      name = pango_font_description_to_string (desc);
      last_char = name[strlen (name) - 1];

      g_free (name);
      pango_font_description_free (desc);

      if (last_char != ',')
        font_desc_to_string = &gimp_font_util_pango_font_description_to_string;
      else
        font_desc_to_string = &pango_font_description_to_string;
    }

  fontmap = pango_ft2_font_map_new ();
  pango_ft2_font_map_set_resolution (PANGO_FT2_FONT_MAP (fontmap),
                                     list->xresolution, list->yresolution);

  context = pango_ft2_font_map_create_context (PANGO_FT2_FONT_MAP (fontmap));
  g_object_unref (fontmap);

  gimp_container_freeze (GIMP_CONTAINER (list));

  gimp_font_list_load_names (list, fontmap, context);
  g_object_unref (context);

  gimp_list_sort_by_name (GIMP_LIST (list));

  gimp_container_thaw (GIMP_CONTAINER (list));
}