# HG changeset patch # User mhessling@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1051613567 0 # Node ID 2e5f3cb38d197ffed6dacd6bec7ce73406457e4f # Parent 12b3980a41a2c6a7fc475ecbc05b8781457d88e2 Fix calculations of font heights under GTK 1.2. Unsure full ascent and descent are determined even if the string to be rendered doesn't have an ascent/descent. diff -r 12b3980a41a2 -r 2e5f3cb38d19 gtk/dw.c --- a/gtk/dw.c Sun Apr 27 23:01:55 2003 +0000 +++ b/gtk/dw.c Tue Apr 29 10:52:47 2003 +0000 @@ -5422,10 +5422,16 @@ font = gdk_font_load("fixed"); if(font) { - gint ascent, descent, width; + gint ascent, descent, width, junk_ascent, junk_descent, junk_width; int index = _find_thread_index(dw_thread_id()); - gdk_text_extents(font, text, strlen(text), NULL, NULL, &width, &ascent, &descent); + /* gdk_text_extents() calculates ascent and descent based on the string, so + * a string without a character with a descent or without an ascent will have + * incorrect ascent/descent values + */ + gdk_text_extents(font, text, strlen(text), NULL, NULL, &width, &junk_ascent, &junk_descent); + /* force ascent/descent to be maximum values */ + gdk_text_extents(font, "Xg", 2, NULL, NULL, &junk_width, &ascent, &descent); if(!_transparent[index]) { GdkGC *gc2 = NULL;