mirror of
https://github.com/brl/mutter.git
synced 2025-02-23 16:34:10 +00:00
Lazily create the Pango fontmap
The Pango fontmap needed by Clutter should be initialized the first time we need a PangoContext, not on initialization.
This commit is contained in:
parent
6fbed66add
commit
38f26634ee
@ -738,7 +738,7 @@ _clutter_context_get_pango_context (ClutterMainContext *self)
|
|||||||
{
|
{
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
|
|
||||||
context = cogl_pango_font_map_create_context (self->font_map);
|
context = _clutter_context_create_pango_context (self);
|
||||||
self->pango_context = context;
|
self->pango_context = context;
|
||||||
|
|
||||||
g_signal_connect (self->backend, "resolution-changed",
|
g_signal_connect (self->backend, "resolution-changed",
|
||||||
@ -748,8 +748,8 @@ _clutter_context_get_pango_context (ClutterMainContext *self)
|
|||||||
G_CALLBACK (update_pango_context),
|
G_CALLBACK (update_pango_context),
|
||||||
self->pango_context);
|
self->pango_context);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
update_pango_context (self->backend, self->pango_context);
|
update_pango_context (self->backend, self->pango_context);
|
||||||
|
|
||||||
return self->pango_context;
|
return self->pango_context;
|
||||||
}
|
}
|
||||||
@ -759,6 +759,19 @@ _clutter_context_create_pango_context (ClutterMainContext *self)
|
|||||||
{
|
{
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
|
|
||||||
|
if (self->font_map == NULL)
|
||||||
|
{
|
||||||
|
gdouble resolution;
|
||||||
|
|
||||||
|
self->font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
|
||||||
|
|
||||||
|
resolution = clutter_backend_get_resolution (self->backend);
|
||||||
|
cogl_pango_font_map_set_resolution (self->font_map, resolution);
|
||||||
|
|
||||||
|
if (G_LIKELY (!clutter_disable_mipmap_text))
|
||||||
|
cogl_pango_font_map_set_use_mipmapping (self->font_map, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
context = cogl_pango_font_map_create_context (self->font_map);
|
context = cogl_pango_font_map_create_context (self->font_map);
|
||||||
update_pango_context (self->backend, context);
|
update_pango_context (self->backend, context);
|
||||||
pango_context_set_language (context, pango_language_get_default ());
|
pango_context_set_language (context, pango_language_get_default ());
|
||||||
@ -1480,7 +1493,6 @@ clutter_init_real (GError **error)
|
|||||||
{
|
{
|
||||||
ClutterMainContext *ctx;
|
ClutterMainContext *ctx;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
gdouble resolution;
|
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
|
|
||||||
/* Note, creates backend if not already existing, though parse args will
|
/* Note, creates backend if not already existing, though parse args will
|
||||||
@ -1522,20 +1534,6 @@ clutter_init_real (GError **error)
|
|||||||
_clutter_profile_suspend ();
|
_clutter_profile_suspend ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Resolution requires display to be open, so can only be queried after
|
|
||||||
* the post_parse hooks run.
|
|
||||||
*
|
|
||||||
* NB: cogl_pango requires a Cogl context.
|
|
||||||
*/
|
|
||||||
ctx->font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
|
|
||||||
|
|
||||||
resolution = clutter_backend_get_resolution (ctx->backend);
|
|
||||||
cogl_pango_font_map_set_resolution (ctx->font_map, resolution);
|
|
||||||
|
|
||||||
if (!clutter_disable_mipmap_text)
|
|
||||||
cogl_pango_font_map_set_use_mipmapping (ctx->font_map, TRUE);
|
|
||||||
|
|
||||||
clutter_text_direction = clutter_get_text_direction ();
|
clutter_text_direction = clutter_get_text_direction ();
|
||||||
|
|
||||||
/* Figure out framebuffer masks used for pick */
|
/* Figure out framebuffer masks used for pick */
|
||||||
@ -1573,7 +1571,6 @@ clutter_init_real (GError **error)
|
|||||||
clutter_stage_set_title (CLUTTER_STAGE (stage), g_get_prgname ());
|
clutter_stage_set_title (CLUTTER_STAGE (stage), g_get_prgname ());
|
||||||
|
|
||||||
clutter_actor_realize (stage);
|
clutter_actor_realize (stage);
|
||||||
|
|
||||||
if (!CLUTTER_ACTOR_IS_REALIZED (stage))
|
if (!CLUTTER_ACTOR_IS_REALIZED (stage))
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user