cogl/pango: Take a context as a param when constructing a font map
Avoids using the get_context macro Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
This commit is contained in:
parent
1b5766b5a1
commit
24f46448ce
@ -301,11 +301,15 @@ clutter_context_get_pango_fontmap (ClutterContext *context)
|
|||||||
CoglPangoFontMap *font_map;
|
CoglPangoFontMap *font_map;
|
||||||
gdouble resolution;
|
gdouble resolution;
|
||||||
gboolean use_mipmapping;
|
gboolean use_mipmapping;
|
||||||
|
ClutterBackend *backend;
|
||||||
|
CoglContext *cogl_context;
|
||||||
|
|
||||||
if (G_LIKELY (context->font_map != NULL))
|
if (G_LIKELY (context->font_map != NULL))
|
||||||
return context->font_map;
|
return context->font_map;
|
||||||
|
|
||||||
font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
|
backend = clutter_context_get_backend (context);
|
||||||
|
cogl_context = clutter_backend_get_cogl_context (backend);
|
||||||
|
font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new (cogl_context));
|
||||||
|
|
||||||
resolution = clutter_backend_get_resolution (context->backend);
|
resolution = clutter_backend_get_resolution (context->backend);
|
||||||
cogl_pango_font_map_set_resolution (font_map, resolution);
|
cogl_pango_font_map_set_resolution (font_map, resolution);
|
||||||
|
@ -57,13 +57,11 @@ free_priv (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PangoFontMap *
|
PangoFontMap *
|
||||||
cogl_pango_font_map_new (void)
|
cogl_pango_font_map_new (CoglContext *context)
|
||||||
{
|
{
|
||||||
PangoFontMap *fm = pango_cairo_font_map_new ();
|
PangoFontMap *fm = pango_cairo_font_map_new ();
|
||||||
g_autofree CoglPangoFontMapPriv *priv = g_new0 (CoglPangoFontMapPriv, 1);
|
g_autofree CoglPangoFontMapPriv *priv = g_new0 (CoglPangoFontMapPriv, 1);
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (context, NULL);
|
|
||||||
|
|
||||||
priv->ctx = g_object_ref (context);
|
priv->ctx = g_object_ref (context);
|
||||||
|
|
||||||
/* XXX: The public pango api doesn't let us sub-class
|
/* XXX: The public pango api doesn't let us sub-class
|
||||||
|
@ -73,7 +73,7 @@ typedef PangoCairoFontMap CoglPangoFontMap;
|
|||||||
* Return value: (transfer full): the newly created #PangoFontMap
|
* Return value: (transfer full): the newly created #PangoFontMap
|
||||||
*/
|
*/
|
||||||
COGL_EXPORT PangoFontMap *
|
COGL_EXPORT PangoFontMap *
|
||||||
cogl_pango_font_map_new (void);
|
cogl_pango_font_map_new (CoglContext *context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pango_font_map_create_context:
|
* cogl_pango_font_map_create_context:
|
||||||
@ -92,9 +92,9 @@ cogl_pango_font_map_create_context (CoglPangoFontMap *font_map);
|
|||||||
* @dpi: The resolution in "dots per inch". (Physical inches aren't
|
* @dpi: The resolution in "dots per inch". (Physical inches aren't
|
||||||
* actually involved; the terminology is conventional.)
|
* actually involved; the terminology is conventional.)
|
||||||
*
|
*
|
||||||
* Sets the resolution for the @font_map.
|
* Sets the resolution for the @font_map.
|
||||||
*
|
*
|
||||||
* This is a scale factor between points specified in a
|
* This is a scale factor between points specified in a
|
||||||
* [struct@Pango.FontDescription] and Cogl units.
|
* [struct@Pango.FontDescription] and Cogl units.
|
||||||
* The default value is %96, meaning that a 10 point font will be 13
|
* The default value is %96, meaning that a 10 point font will be 13
|
||||||
* units high. (10 * 96. / 72. = 13.3).
|
* units high. (10 * 96. / 72. = 13.3).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user