Re: PATCH: ascent and descent of fontset
- From: Owen Taylor <owt1 cornell edu>
- To: Chi-Deok Hwang <cdhwang sr hei co kr>
- Cc: gtk-list redhat com
- Subject: Re: PATCH: ascent and descent of fontset
- Date: 27 Mar 1998 15:54:11 -0500
Chi-Deok Hwang <cdhwang@sr.hei.co.kr> writes:
> hello!
>
> a quick tiny patch:
> The ascent and descent of fontset is incorrect.
> This is serious in some terminal programs.
>
> --- gdkfont.c.orig Fri Mar 27 14:29:14 1998
> +++ gdkfont.c Fri Mar 27 14:30:22 1998
> @@ -87,9 +87,8 @@
>
> private->xfont = fontset;
> font->type = GDK_FONT_FONTSET;
> - /* how to define ascent and descent for fontset ??? */
> - font->ascent = extent->max_logical_extent.height;
> - font->descent = font->ascent / 4 ;
> + font->ascent = extent->max_logical_extent.height + extent->max_logical_extent.y;
> + font->descent = -extent->max_logical_extent.height.y;
> }
> return font;
> }
Hmmm. That doesn't seem to work for me (or even compile - height.y?)
But I think the following patch does the right thing.
Thanks for pointing out the problem,
Owen
Index: gdkfont.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gdk/gdkfont.c,v
retrieving revision 1.3
diff -u -r1.3 gdkfont.c
--- gdkfont.c 1998/03/22 00:07:49 1.3
+++ gdkfont.c 1998/03/27 20:47:52
@@ -86,13 +86,22 @@
}
else
{
- XFontSetExtents *extent = XExtentsOfFontSet(fontset);
-
+ gint num_fonts;
+ gint i;
+ XFontStruct **font_structs;
+ gchar **font_names;
+
private->xfont = fontset;
font->type = GDK_FONT_FONTSET;
- /* how to define ascent and descent for fontset ??? */
- font->ascent = extent->max_logical_extent.height;
- font->descent = font->ascent / 4 ;
+ num_fonts = XFontsOfFontSet (fontset, &font_structs, &font_names);
+
+ font->ascent = font->descent = 0;
+
+ for (i = 0; i < num_fonts; i++)
+ {
+ font->ascent = MAX (font->ascent, font_structs[i]->ascent);
+ font->descent = MAX (font->descent, font_structs[i]->descent);
+ }
}
return font;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]