cogl/pango: Remove font map helper
It only calls into pangocairo API and only used inside clutter so just call pangocairo API directly Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
This commit is contained in:
parent
f5a4309f3c
commit
cdc43065e0
@ -482,6 +482,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <gobject/gvaluecollector.h>
|
#include <gobject/gvaluecollector.h>
|
||||||
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
#include "cogl/cogl.h"
|
#include "cogl/cogl.h"
|
||||||
|
|
||||||
@ -13112,7 +13113,7 @@ clutter_actor_create_pango_context (ClutterActor *self)
|
|||||||
|
|
||||||
font_map = clutter_context_get_pango_fontmap (context);
|
font_map = clutter_context_get_pango_fontmap (context);
|
||||||
|
|
||||||
pango_context = cogl_pango_font_map_create_context (font_map);
|
pango_context = pango_font_map_create_context (PANGO_FONT_MAP (font_map));
|
||||||
update_pango_context (clutter_context_get_backend (context), pango_context);
|
update_pango_context (clutter_context_get_backend (context), pango_context);
|
||||||
pango_context_set_language (pango_context, pango_language_get_default ());
|
pango_context_set_language (pango_context, pango_language_get_default ());
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
#include "clutter/clutter-backend-private.h"
|
#include "clutter/clutter-backend-private.h"
|
||||||
#include "clutter/clutter-context-private.h"
|
#include "clutter/clutter-context-private.h"
|
||||||
#include "clutter/clutter-debug.h"
|
#include "clutter/clutter-debug.h"
|
||||||
@ -152,7 +154,8 @@ clutter_backend_real_resolution_changed (ClutterBackend *backend)
|
|||||||
resolution = dpi / 1024.0;
|
resolution = dpi / 1024.0;
|
||||||
|
|
||||||
if (context->font_map != NULL)
|
if (context->font_map != NULL)
|
||||||
cogl_pango_font_map_set_resolution (context->font_map, resolution);
|
pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (context->font_map),
|
||||||
|
resolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "clutter/clutter-context-private.h"
|
#include "clutter/clutter-context-private.h"
|
||||||
|
|
||||||
#include <hb-glib.h>
|
#include <hb-glib.h>
|
||||||
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
#include "clutter/clutter-accessibility-private.h"
|
#include "clutter/clutter-accessibility-private.h"
|
||||||
#include "clutter/clutter-backend-private.h"
|
#include "clutter/clutter-backend-private.h"
|
||||||
@ -319,7 +320,8 @@ clutter_context_get_pango_fontmap (ClutterContext *context)
|
|||||||
font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new (cogl_context));
|
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);
|
pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (font_map),
|
||||||
|
resolution);
|
||||||
|
|
||||||
context->font_map = font_map;
|
context->font_map = font_map;
|
||||||
|
|
||||||
|
@ -74,14 +74,6 @@ cogl_pango_font_map_new (CoglContext *context)
|
|||||||
return fm;
|
return fm;
|
||||||
}
|
}
|
||||||
|
|
||||||
PangoContext *
|
|
||||||
cogl_pango_font_map_create_context (CoglPangoFontMap *fm)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (fm), NULL);
|
|
||||||
|
|
||||||
return pango_font_map_create_context (PANGO_FONT_MAP (fm));
|
|
||||||
}
|
|
||||||
|
|
||||||
PangoRenderer *
|
PangoRenderer *
|
||||||
cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm)
|
cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm)
|
||||||
{
|
{
|
||||||
@ -92,15 +84,6 @@ cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm)
|
|||||||
return priv->renderer;
|
return priv->renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
|
|
||||||
double dpi)
|
|
||||||
{
|
|
||||||
g_return_if_fail (COGL_PANGO_IS_FONT_MAP (font_map));
|
|
||||||
|
|
||||||
pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (font_map), dpi);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GQuark
|
static GQuark
|
||||||
cogl_pango_font_map_get_priv_key (void)
|
cogl_pango_font_map_get_priv_key (void)
|
||||||
{
|
{
|
||||||
|
@ -65,34 +65,6 @@ typedef void (* CoglPangoPipelineSetup) (CoglPipeline *pipeline,
|
|||||||
COGL_EXPORT PangoFontMap *
|
COGL_EXPORT PangoFontMap *
|
||||||
cogl_pango_font_map_new (CoglContext *context);
|
cogl_pango_font_map_new (CoglContext *context);
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_pango_font_map_create_context:
|
|
||||||
* @font_map: a #CoglPangoFontMap
|
|
||||||
*
|
|
||||||
* Create a [class@Pango.Context] for the given @font_map.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): the newly created context: free with [method@GObject.Object.unref].
|
|
||||||
*/
|
|
||||||
COGL_EXPORT PangoContext *
|
|
||||||
cogl_pango_font_map_create_context (CoglPangoFontMap *font_map);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_pango_font_map_set_resolution:
|
|
||||||
* @font_map: a #CoglPangoFontMap
|
|
||||||
* @dpi: The resolution in "dots per inch". (Physical inches aren't
|
|
||||||
* actually involved; the terminology is conventional.)
|
|
||||||
*
|
|
||||||
* Sets the resolution for the @font_map.
|
|
||||||
*
|
|
||||||
* This is a scale factor between points specified in a
|
|
||||||
* [struct@Pango.FontDescription] and Cogl units.
|
|
||||||
* The default value is %96, meaning that a 10 point font will be 13
|
|
||||||
* units high. (10 * 96. / 72. = 13.3).
|
|
||||||
*/
|
|
||||||
COGL_EXPORT void
|
|
||||||
cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
|
|
||||||
double dpi);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_pango_ensure_glyph_cache_for_layout:
|
* cogl_pango_ensure_glyph_cache_for_layout:
|
||||||
* @layout: A #PangoLayout
|
* @layout: A #PangoLayout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user