Add ClutterActor::create_pango_context()
Sometimes an actor needs to set specific font rendering options on the PangoContext without changing settings for every other text-rendering actor. In order to do this, we need a new public method to create a Pango context object -- preset with all the default settings -- owned by the developer and not shared with the rest of Clutter. This new method is called clutter_actor_create_pango_context(); while it does not strictly depend on a ClutterActor, it is a good idea to have it inside the ClutterActor API to map the current get_pango_context() method and in case we start storing screen-specific data to the Actor itself during the 1.x API cycle.
This commit is contained in:
parent
d622a4dd89
commit
982a678053
@ -7606,8 +7606,9 @@ clutter_actor_grab_key_focus (ClutterActor *self)
|
||||
* is already configured using the appropriate font map, resolution
|
||||
* and font options.
|
||||
*
|
||||
* The returned #PangoContext will be updated each time the options
|
||||
* stored by the default #ClutterBackend change.
|
||||
* Unlike clutter_actor_create_pango_context(), this context is owend
|
||||
* by the #ClutterActor and it will be updated each time the options
|
||||
* stored by the #ClutterBackend change.
|
||||
*
|
||||
* You can use the returned #PangoContext to create a #PangoLayout
|
||||
* and render text using cogl_pango_render_layout() to reuse the
|
||||
@ -7633,8 +7634,37 @@ clutter_actor_get_pango_context (ClutterActor *self)
|
||||
return priv->pango_context;
|
||||
|
||||
ctx = CLUTTER_CONTEXT ();
|
||||
priv->pango_context = _clutter_context_create_pango_context (ctx);
|
||||
priv->pango_context = _clutter_context_get_pango_context (ctx);
|
||||
g_object_ref (priv->pango_context);
|
||||
|
||||
return priv->pango_context;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_create_pango_context:
|
||||
* @self: a #ClutterActor
|
||||
*
|
||||
* Creates a #PangoContext for the given actor. The #PangoContext
|
||||
* is already configured using the appropriate font map, resolution
|
||||
* and font options.
|
||||
*
|
||||
* See also clutter_actor_get_pango_context().
|
||||
*
|
||||
* Return value: the newly created #PangoContext. Use g_object_ref()
|
||||
* on the returned value to deallocate its resources
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
PangoContext *
|
||||
clutter_actor_create_pango_context (ClutterActor *self)
|
||||
{
|
||||
ClutterMainContext *ctx;
|
||||
PangoContext *retval;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
|
||||
|
||||
ctx = CLUTTER_CONTEXT ();
|
||||
retval = _clutter_context_create_pango_context (ctx);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -422,6 +422,8 @@ void clutter_actor_set_opacity (ClutterActor
|
||||
guint8 opacity);
|
||||
guint8 clutter_actor_get_opacity (ClutterActor *self);
|
||||
guint8 clutter_actor_get_paint_opacity (ClutterActor *self);
|
||||
gboolean clutter_actor_get_paint_visibility (ClutterActor *self);
|
||||
|
||||
|
||||
void clutter_actor_set_name (ClutterActor *self,
|
||||
const gchar *name);
|
||||
@ -561,11 +563,10 @@ void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
|
||||
const ClutterVertex *point,
|
||||
ClutterVertex *vertex);
|
||||
|
||||
gboolean clutter_actor_get_paint_visibility (ClutterActor *self);
|
||||
|
||||
void clutter_actor_grab_key_focus (ClutterActor *self);
|
||||
|
||||
PangoContext *clutter_actor_get_pango_context (ClutterActor *self);
|
||||
PangoContext *clutter_actor_create_pango_context (ClutterActor *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user