From 3198862140b20ecab843981dda47ecba6f9bd953 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Thu, 26 Oct 2000 16:35:19 +0000 Subject: [PATCH] - fix wrong text size in input windows Changed files: XFree86-xlib-textmeasure.patch -> 1.1 --- XFree86-xlib-textmeasure.patch | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 XFree86-xlib-textmeasure.patch diff --git a/XFree86-xlib-textmeasure.patch b/XFree86-xlib-textmeasure.patch new file mode 100644 index 0000000..d47901d --- /dev/null +++ b/XFree86-xlib-textmeasure.patch @@ -0,0 +1,79 @@ + +The following patch fixes a problem in _XomGenericTextEscapement(). +The problem is that the font used when + +To reproduce the bug, load the following fontset: + + "-*-helvetica-bold-r-normal--10-*-*-*-p-*-*-*," \ + "-*-*-bold-r-normal-*-10-*-*-*-*-*-*-*,*" + +And then (in a Latin-1 locale) compare the results of measuring the +string with actually drawing the font on the screen. Though helvetica +is drawn on the screen, the width will not be the width from the +helvetica font, but from a different font from matching on the '*'. + +The patch below fixes selecting the font for measuring the text +escapement to work the same way as selecting the font for drawing. + +I've added another comment in a different portion of code that appears +somewhat dubious to me; the entries in font_set->font_data are getting +filled in with bogus fonts. Loading these fonts is unecessary +overhead, and having them there is likely to produce odd bugs like +this one. + +(I have to say that reading this code makes me more and more happy +that I decided to ignore and bypass it for Pango.) + +Regards, + Owen + +--- xc/lib/X11/omGeneric.c.ots Wed Jul 12 12:02:04 2000 ++++ xc/lib/X11/omGeneric.c Wed Jul 12 12:09:15 2000 +@@ -1031,6 +1031,15 @@ + + found_num++; + is_found = True; ++ /* We almost certainly should have 'break' here and should ignore ++ * the rest of the patterns. The problem is that we'll overwrite ++ * font_data->font and font_data->xlfd_name with later matches. ++ * But the general expectation would be that font_data->xlfd_name ++ * would correspond to to the returned value. (It's not clear ++ * why this routine modifies font_data and has a font_data_return...) ++ * ++ * Owen Taylor 12 Jul 2000 ++ */ + } + + switch(class) { +--- xc/lib/X11/omTextEsc.c.ots Wed Jul 12 11:57:58 2000 ++++ xc/lib/X11/omTextEsc.c Wed Jul 12 12:07:41 2000 +@@ -151,10 +151,27 @@ + is_xchar2b, FONTSCOPE); + if(ptr_len <= 0) + break; ++ ++ /* First, see if the "Best Match" font for the FontSet was set. ++ * If it was, use that font. If it was not set, then use the ++ * font defined by font_set->font_data[0] (which is what ++ * _XomGetFontDataFromFontSet() always seems to return for ++ * non-VW text). Note that given the new algorithm in ++ * parse_fontname() and parse_fontdata(), fs->font will ++ * *always* contain good data. We should probably remove ++ * the check for "fd->font", but we won't :-) -- jjw/pma (HP) ++ * ++ * Above comment and way this is done propagated from omText.c ++ * Note that fd->font is junk so using the result of the ++ * above call /needs/ to be ignored. ++ * ++ * Owen Taylor 12 Jul 2000 ++ * ++ */ + if(fd == (FontData) NULL || +- (font = fd->font) == (XFontStruct *) NULL) { ++ (font = font_set->font) == (XFontStruct *) NULL) { + +- if((font = font_set->font) == (XFontStruct *) NULL) ++ if((font = fd->font) == (XFontStruct *) NULL) + break; + } + -- 2.44.0