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
|
* is already configured using the appropriate font map, resolution
|
||||||
* and font options.
|
* and font options.
|
||||||
*
|
*
|
||||||
* The returned #PangoContext will be updated each time the options
|
* Unlike clutter_actor_create_pango_context(), this context is owend
|
||||||
* stored by the default #ClutterBackend change.
|
* 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
|
* You can use the returned #PangoContext to create a #PangoLayout
|
||||||
* and render text using cogl_pango_render_layout() to reuse the
|
* 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;
|
return priv->pango_context;
|
||||||
|
|
||||||
ctx = CLUTTER_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);
|
g_object_ref (priv->pango_context);
|
||||||
|
|
||||||
return 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 opacity);
|
||||||
guint8 clutter_actor_get_opacity (ClutterActor *self);
|
guint8 clutter_actor_get_opacity (ClutterActor *self);
|
||||||
guint8 clutter_actor_get_paint_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,
|
void clutter_actor_set_name (ClutterActor *self,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
@ -547,25 +549,24 @@ gboolean clutter_actor_is_rotated (ClutterActor *self);
|
|||||||
gboolean clutter_actor_is_scaled (ClutterActor *self);
|
gboolean clutter_actor_is_scaled (ClutterActor *self);
|
||||||
gboolean clutter_actor_should_pick_paint (ClutterActor *self);
|
gboolean clutter_actor_should_pick_paint (ClutterActor *self);
|
||||||
|
|
||||||
void clutter_actor_box_get_from_vertices (ClutterVertex vtx[4],
|
void clutter_actor_box_get_from_vertices (ClutterVertex vtx[4],
|
||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
|
|
||||||
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
|
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
|
||||||
ClutterVertex verts[4]);
|
ClutterVertex verts[4]);
|
||||||
|
|
||||||
void clutter_actor_apply_transform_to_point (ClutterActor *self,
|
void clutter_actor_apply_transform_to_point (ClutterActor *self,
|
||||||
const ClutterVertex *point,
|
const ClutterVertex *point,
|
||||||
ClutterVertex *vertex);
|
ClutterVertex *vertex);
|
||||||
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
|
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
|
||||||
ClutterActor *ancestor,
|
ClutterActor *ancestor,
|
||||||
const ClutterVertex *point,
|
const ClutterVertex *point,
|
||||||
ClutterVertex *vertex);
|
ClutterVertex *vertex);
|
||||||
|
|
||||||
gboolean clutter_actor_get_paint_visibility (ClutterActor *self);
|
void clutter_actor_grab_key_focus (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);
|
||||||
PangoContext *clutter_actor_get_pango_context (ClutterActor *self);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user