[patch] bug in gdk_text_extents()



As Chi-Deok Hwang pointed out before, there is a bug in
gdk_text_extents(). This bug make GtkLabel put an underline
in a wrong place when a fontset is supplied. Please apply
the following patch.

( As a side note, in the patch Chi-Deok Hwang posted before,
the line '*lbearling = -ink.x;' was not touched. But I think
lbearling should be ink.x instead. Am I misunderstanding? )

--- gdkfont.c.old	Fri Dec 11 21:54:11 1998
+++ gdkfont.c	Fri Dec 11 22:00:59 1998
@@ -489,15 +489,15 @@
       fontset = (XFontSet) private->xfont;
       XmbTextExtents (fontset, text, text_length, &ink, &logical);
       if (lbearing)
-	*lbearing = -ink.x;
+	*lbearing = ink.x;
       if (rbearing)
-	*rbearing = ink.y;
+	*rbearing = ink.width + ink.x;
       if (width)
 	*width = logical.width;
       if (ascent)
-	*ascent = ink.height;
+	*ascent = -ink.y;
       if (descent)
-	*descent = -ink.y;
+	*descent = ink.height + ink.y;
       break;
     }
 
--------------------------------------
Akira Higuchi
Dept. of Mathematics, Hokkaido Univ.
Hokkaido, Japan
Email: a-higuti@math.sci.hokudai.ac.jp



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