2008-06-13 Emmanuele Bassi <ebassi@openedhand.com>

Bug #960 - PangoContext creation code should not be duplicated

	* clutter/clutter-private.h:
	* clutter/clutter-main.c:
	(_clutter_context_create_pango_context): Abstract the creation
	of the PangoContext inside its own function, to avoid code and
	bugs duplication. (Tommi Komulainen)

	* clutter/clutter-entry.c (clutter_entry_init): Use the newly
	added PangoContext creation function.

	* clutter/clutter-label.c (clutter_label_init): Ditto as above.
This commit is contained in:
Emmanuele Bassi
2008-06-13 09:10:39 +00:00
parent d1006ca506
commit be0711b88b
5 changed files with 40 additions and 31 deletions

View File

@ -414,6 +414,27 @@ clutter_context_free (ClutterMainContext *context)
g_free (context);
}
PangoContext *
_clutter_context_create_pango_context (ClutterMainContext *self)
{
PangoContext *context;
gdouble resolution;
cairo_font_options_t *font_options;
resolution = clutter_backend_get_resolution (self->backend);
if (resolution < 0)
resolution = 96.0; /* fall back */
context = pango_clutter_font_map_create_context (self->font_map);
pango_cairo_context_set_resolution (context, resolution);
font_options = clutter_backend_get_font_options (self->backend);
pango_cairo_context_set_font_options (context, font_options);
return context;
}
/**
* clutter_main_quit:
*