[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: font problem in 1.6.0



On Wed, 2010-05-12 at 00:35 +0100, Peter Clifton wrote:
> On Tue, 2010-05-11 at 17:49 -0400, Dave McGuire wrote:
> > Peter, in reference to my DocBook problem: I believe I've got the 
> > DocBook stuff installed properly...will try again with the git head 
> > pango after a break.
> 
> If that doesn't help, could you try this test as well, to rule out
> (some) of my custom code..
> 
> in gschem/src/o_text.c
> 
> Search for the single instance:
> 
>   gschem_pango_show_layout (cr, w_current->pl);
> 
> and replace with:
> 
>   pango_cairo_show_layout (cr, w_current->pl);
> 
> 
> (Will break rendering underlines in gschem, but I'd like to rule out my
> code!).

And another possible test.. try the attached patch. Shouldn't fix
anything, but let me know if it does. (Applies _without_ the above
replacement, so you might want to try it first).

NB: Patch untested by me - sorry.

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index 596b81b..d68810d 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -379,6 +379,7 @@ static void o_text_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
   PangoFontMetrics *font_metrics;
   PangoRectangle logical_rect;
   PangoRectangle inked_rect;
+  PangoLayout *layout;
 
   g_return_if_fail (o_current != NULL);
   g_return_if_fail (o_current->text != NULL);
@@ -390,12 +391,14 @@ static void o_text_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
   if (o_current->text->disp_string == NULL)
     return;
 
+  layout = pango_cairo_create_layout (cr);
+
   font_metrics =
-    setup_pango_return_metrics (w_current, w_current->pl,
+    setup_pango_return_metrics (w_current, layout,
                                 toplevel->page_current->to_screen_x_constant,
                                 o_current);
 
-  pango_layout_get_pixel_extents (w_current->pl, &inked_rect, &logical_rect);
+  pango_layout_get_pixel_extents (layout, &inked_rect, &logical_rect);
   calculate_position (o_current, font_metrics, logical_rect, inked_rect, &x, &y);
 
   cairo_save (cr);
@@ -416,13 +419,14 @@ static void o_text_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
    *     the grid lines, and ensures consistency with other lines when the
    *     page view is zoomed out. */
   cairo_move_to (cr, x + 0.5, y + 0.5);
-  gschem_pango_show_layout (cr, w_current->pl);
+  gschem_pango_show_layout (cr, layout);
 
 #ifdef DEBUG_TEXT
   draw_construction_lines (w_current, x, y, font_metrics, logical_rect);
 #endif
 
   pango_font_metrics_unref (font_metrics);
+  g_object_unref (layout);
   cairo_restore (cr);
 }
 

_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user