* @backend: a #ClutterBackend
* @options: Cairo font options for the backend, or %NULL
*
- * Sets the new font options for @backend. If @options is %NULL,
- * the first following call to clutter_backend_get_font_options()
- * will return the default font options for @backend.
+ * Sets the new font options for @backend. The #ClutterBackend will
+ * copy the #cairo_font_options_t.
+ *
+ * If @options is %NULL, the first following call to
+ * clutter_backend_get_font_options() will return the default font
+ * options for @backend.
*
* This function is intended for actors creating a Pango layout
* using the PangoCairo API.
*/
void
clutter_backend_set_font_options (ClutterBackend *backend,
- cairo_font_options_t *options)
+ const cairo_font_options_t *options)
{
ClutterBackendPrivate *priv;
*
* Retrieves the font options for @backend.
*
- * Return value: (transfer none): the font options of the #ClutterBackend
+ * Return value: (transfer none): the font options of the #ClutterBackend.
+ * The returned #cairo_font_options_t is owned by the backend and should
+ * not be modified or freed
*
* Since: 0.8
*/
-cairo_font_options_t *
+const cairo_font_options_t *
clutter_backend_get_font_options (ClutterBackend *backend)
{
ClutterBackendPrivate *priv;
ClutterBackend *clutter_get_default_backend (void);
-void clutter_backend_set_resolution (ClutterBackend *backend,
- gdouble dpi);
-gdouble clutter_backend_get_resolution (ClutterBackend *backend);
-void clutter_backend_set_double_click_time (ClutterBackend *backend,
- guint msec);
-guint clutter_backend_get_double_click_time (ClutterBackend *backend);
-void clutter_backend_set_double_click_distance (ClutterBackend *backend,
- guint distance);
-guint clutter_backend_get_double_click_distance (ClutterBackend *backend);
-void clutter_backend_set_font_options (ClutterBackend *backend,
- cairo_font_options_t *options);
-cairo_font_options_t *clutter_backend_get_font_options (ClutterBackend *backend);
-void clutter_backend_set_font_name (ClutterBackend *backend,
- const gchar *font_name);
-G_CONST_RETURN gchar *clutter_backend_get_font_name (ClutterBackend *backend);
+void clutter_backend_set_resolution (ClutterBackend *backend,
+ gdouble dpi);
+gdouble clutter_backend_get_resolution (ClutterBackend *backend);
+void clutter_backend_set_double_click_time (ClutterBackend *backend,
+ guint msec);
+guint clutter_backend_get_double_click_time (ClutterBackend *backend);
+void clutter_backend_set_double_click_distance (ClutterBackend *backend,
+ guint distance);
+guint clutter_backend_get_double_click_distance (ClutterBackend *backend);
+void clutter_backend_set_font_options (ClutterBackend *backend,
+ const cairo_font_options_t *options);
+const cairo_font_options_t *clutter_backend_get_font_options (ClutterBackend *backend);
+void clutter_backend_set_font_name (ClutterBackend *backend,
+ const gchar *font_name);
+G_CONST_RETURN gchar * clutter_backend_get_font_name (ClutterBackend *backend);
G_END_DECLS
PangoContext *context)
{
PangoFontDescription *font_desc;
- cairo_font_options_t *font_options;
+ const cairo_font_options_t *font_options;
const gchar *font_name;
gdouble resolution;
clutter_set_font_flags (ClutterFontFlags flags)
{
ClutterFontFlags old_flags, changed_flags;
- cairo_font_options_t *font_options;
+ const cairo_font_options_t *font_options;
+ cairo_font_options_t *new_font_options;
+ ClutterBackend *backend;
+
+ backend = clutter_get_default_backend ();
if (CLUTTER_CONTEXT ()->font_map)
cogl_pango_font_map_set_use_mipmapping (CLUTTER_CONTEXT ()->font_map,
old_flags = clutter_get_font_flags ();
- font_options = clutter_backend_get_font_options (CLUTTER_CONTEXT ()->backend);
- font_options = cairo_font_options_copy (font_options);
+ font_options = clutter_backend_get_font_options (backend);
+ new_font_options = cairo_font_options_copy (font_options);
/* Only set the font options that have actually changed so we don't
override a detailed setting from the backend */
changed_flags = old_flags ^ flags;
if ((changed_flags & CLUTTER_FONT_HINTING))
- cairo_font_options_set_hint_style (font_options,
+ cairo_font_options_set_hint_style (new_font_options,
(flags & CLUTTER_FONT_HINTING)
? CAIRO_HINT_STYLE_FULL
: CAIRO_HINT_STYLE_NONE);
- clutter_backend_set_font_options (CLUTTER_CONTEXT ()->backend, font_options);
+ clutter_backend_set_font_options (backend, new_font_options);
- cairo_font_options_destroy (font_options);
+ cairo_font_options_destroy (new_font_options);
if (CLUTTER_CONTEXT ()->pango_context)
- update_pango_context (CLUTTER_CONTEXT ()->backend,
- CLUTTER_CONTEXT ()->pango_context);
+ update_pango_context (backend, CLUTTER_CONTEXT ()->pango_context);
}
/**
{
ClutterMainContext *ctxt = CLUTTER_CONTEXT ();
CoglPangoFontMap *font_map = NULL;
- cairo_font_options_t *font_options;
+ const cairo_font_options_t *font_options;
ClutterFontFlags flags = 0;
font_map = CLUTTER_CONTEXT ()->font_map;