[glabels] Embed the text in the printstream as text rather that as an outline
- From: Jim Evins <jimevins src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glabels] Embed the text in the printstream as text rather that as an outline
- Date: Sat, 22 Jun 2013 18:35:05 +0000 (UTC)
commit 063afbdeece38750044f2462837246bb1c8346c6
Author: James Cloos <cloos jhcloos com>
Date: Sat Jun 22 14:29:13 2013 -0400
Embed the text in the printstream as text rather that as an outline
Fixes bug #702783. Render text directly using pango-cairo API instead of
filling text outline path. Original patch modified to still use path to test
for selection.
src/label-text.c | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/src/label-text.c b/src/label-text.c
index 287d3cc..f2216ed 100644
--- a/src/label-text.c
+++ b/src/label-text.c
@@ -145,10 +145,11 @@ static gdouble get_text_line_spacing (glLabelObject *object);
static glColorNode* get_text_color (glLabelObject *object);
-static void set_text_path (glLabelText *this,
+static void layout_text (glLabelText *this,
cairo_t *cr,
gboolean screen_flag,
- glMergeRecord *record);
+ glMergeRecord *record,
+ gboolean path_only_flag);
static void draw_object (glLabelObject *object,
cairo_t *cr,
@@ -1100,10 +1101,11 @@ auto_shrink_font_size (cairo_t *cr,
/* Update pango layout. */
/*****************************************************************************/
static void
-set_text_path (glLabelText *this,
- cairo_t *cr,
- gboolean screen_flag,
- glMergeRecord *record)
+layout_text (glLabelText *this,
+ cairo_t *cr,
+ gboolean screen_flag,
+ glMergeRecord *record,
+ gboolean path_only_flag)
{
gint iw, ih, y;
gdouble object_w, object_h;
@@ -1203,7 +1205,14 @@ set_text_path (glLabelText *this,
}
cairo_move_to (cr, GL_LABEL_TEXT_MARGIN/scale_x, y);
- pango_cairo_layout_path (cr, layout);
+ if ( path_only_flag )
+ {
+ pango_cairo_layout_path (cr, layout);
+ }
+ else
+ {
+ pango_cairo_show_layout (cr, layout);
+ }
g_object_unref (layout);
gl_text_node_lines_free (&lines);
@@ -1294,10 +1303,8 @@ draw_text_real (glLabelObject *object,
{
gl_debug (DEBUG_LABEL, "START");
- set_text_path (GL_LABEL_TEXT (object), cr, screen_flag, record);
-
cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (color));
- cairo_fill (cr);
+ layout_text (GL_LABEL_TEXT (object), cr, screen_flag, record, FALSE);
gl_debug (DEBUG_LABEL, "END");
}
@@ -1320,7 +1327,7 @@ object_at (glLabelObject *object,
if ( (x >= 0) && (x <= w) && (y >= 0) && (y <= h) )
{
cairo_new_path (cr);
- set_text_path (GL_LABEL_TEXT (object), cr, TRUE, NULL);
+ layout_text (GL_LABEL_TEXT (object), cr, TRUE, NULL, TRUE);
if (cairo_in_fill (cr, x, y))
{
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]