[librsvg] measure_text(): Don't frob the ctx->render->pango_context here
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] measure_text(): Don't frob the ctx->render->pango_context here
- Date: Thu, 7 Dec 2017 00:57:52 +0000 (UTC)
commit 205cf3bb96cf4123ca93f6281980d1d157d5ed5d
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Dec 6 10:39:29 2017 -0600
measure_text(): Don't frob the ctx->render->pango_context here
rsvg-text.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/rsvg-text.c b/rsvg-text.c
index df94f93..e0d56c9 100644
--- a/rsvg-text.c
+++ b/rsvg-text.c
@@ -704,19 +704,20 @@ rsvg_text_render_text (RsvgDrawingCtx * ctx, const char *text, gdouble * x, gdou
static gdouble
measure_text (RsvgDrawingCtx * ctx, const char *text)
{
+ PangoContext *context;
PangoLayout *layout;
gint width;
gdouble scaled_width;
- if (ctx->pango_context == NULL)
- ctx->pango_context = ctx->render->get_pango_context (ctx);
+ context = ctx->render->get_pango_context (ctx);
- layout = rsvg_text_create_layout (ctx, text, ctx->pango_context);
+ layout = rsvg_text_create_layout (ctx, text, context);
pango_layout_get_size (layout, &width, NULL);
scaled_width = width / (double)PANGO_SCALE;
g_object_unref (layout);
+ g_object_unref (context);
return scaled_width;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]