Fix for slanted System font on Fedora Core 4

Pavel Roskin proski at gnu.org
Fri Aug 26 00:46:11 CDT 2005


Hello!

The "System" font (e.g. the one used in the Wine Notepad edit window) is
slanted by default in Fedora Core 4.  The reason appears to be
following.  The System font defined in dlls/gdi/gdiobj.c has non-zero
width (namely 7).

What LFD_ComposeLFD() in dlls/x11drv/xfont.c is called with uRelax 0, it
sets Y resolution to 96 based on some calculations involving font width.
By I only have resolutions 75 and 100.  So it fails.

Then LFD_ComposeLFD() is called with uRelax 1.  Two things are relaxed -
Y resolution and slant.  An italic version of Helvetica happens to be
first to match.

The patch extends the uRelax scale so that 1 relaxes yres, 2 relaxes
slant, 3 relaxes what 2 used to relax and so on.  This fixes the System
font for me.

Just in case, I'm running Fedora Cora 4, which used xfs for fonts.
Unscaled fonts are put first in the xfs configuration file.

ChangeLog:
	* dlls/x11drv/xfont.c: Extend uRelax scale so that yres is
	relaxed before slant, not at the same time.

--- dlls/x11drv/xfont.c
+++ dlls/x11drv/xfont.c
@@ -865,9 +865,9 @@ static BOOL LFD_ComposeLFD( const fontOb
  * until XLoadFont() succeeds.
  * to avoid an infinite loop; these will always match
  */
-   if (uRelax >= 5)
+   if (uRelax >= 6)
    {
-       if (uRelax == 5)
+       if (uRelax == 6)
 	   sprintf( lpLFD, "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1" );
        else
 	   sprintf( lpLFD, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*" );
@@ -909,7 +909,7 @@ static BOOL LFD_ComposeLFD( const fontOb
        else
 	   aLFD.slant = "i";
    else
-       aLFD.slant = (uRelax < 1) ? "r" : any;
+       aLFD.slant = (uRelax <= 1) ? "r" : any;
 
 /* add width */
    if( fo->fi->fi_flags & FI_NORMAL )
@@ -939,7 +939,7 @@ static BOOL LFD_ComposeLFD( const fontOb
        h = MAX_FONT_SIZE;
    }
 
-   if (uRelax <= 2)
+   if (uRelax <= 3)
        /* handle rotated fonts */
        if (fo->lf.lfEscapement) {
 	   /* escapement is in tenths of degrees, theta is in radians */
@@ -961,7 +961,7 @@ static BOOL LFD_ComposeLFD( const fontOb
     * so that you have to mess around with res_y
     */
    aLFD.average_width = any;
-   if (uRelax <= 3)
+   if (uRelax <= 4)
    {
        sprintf(resx_string, "%d", fo->fi->lfd_resolution);
        aLFD.resolution_x = resx_string;
@@ -997,12 +997,12 @@ static BOOL LFD_ComposeLFD( const fontOb
        else
 	   w = ( fo->fi->fi_flags & FI_VARIABLEPITCH ) ? "p" : any;
 
-       aLFD.spacing = (uRelax <= 1) ? w : any;
+       aLFD.spacing = (uRelax <= 2) ? w : any;
    }
 
 /* encoding */
 
-   if (uRelax <= 4)
+   if (uRelax <= 5)
    {
        fontEncodingTemplate* boba = fETTable;
 


-- 
Regards,
Pavel Roskin




More information about the wine-patches mailing list