get rid of the "Resolution" entry from the config file
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Thu Aug 26 09:40:25 CDT 2004
Huw Davies <huw at codeweavers.com>
Deprecate the "Resolution" entry in the config file in
favour of HKEY_CURRNET_CONFIG\Software\Fonts\LogPixels
--
Huw Davies
huw at codeweavers.com
Index: tools/wine.inf
===================================================================
RCS file: /home/wine/wine/tools/wine.inf,v
retrieving revision 1.17
diff -u -r1.17 wine.inf
--- tools/wine.inf 23 Aug 2004 18:50:54 -0000 1.17
+++ tools/wine.inf 26 Aug 2004 14:29:50 -0000
@@ -156,6 +156,7 @@
HKLM,%FontSubStr%,"Times New Roman Greek,161",,"Times New Roman,161"
HKLM,%FontSubStr%,"Times New Roman TUR,162",,"Times New Roman,162"
HKLM,%FontSubStr%,"Tms Rmn",,"Times New Roman"
+HKLM,System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts,"LogPixels",0x10001,00000060
[MCI]
HKLM,%Mci32Str%,"AVIVideo",,"mciavi.drv"
Index: documentation/samples/config
===================================================================
RCS file: /home/wine/wine/documentation/samples/config,v
retrieving revision 1.69
diff -u -r1.69 config
--- documentation/samples/config 12 Aug 2004 03:24:58 -0000 1.69
+++ documentation/samples/config 26 Aug 2004 14:29:50 -0000
@@ -94,7 +94,6 @@
[fonts]
;Read the Fonts topic in the Wine User Guide before adding aliases
;See a couple of examples for russian users below
-"Resolution" = "96"
"Default" = "-adobe-helvetica-"
"DefaultFixed" = "fixed"
"DefaultSerif" = "-adobe-times-"
Index: dlls/x11drv/init.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/init.c,v
retrieving revision 1.10
diff -u -r1.10 init.c
--- dlls/x11drv/init.c 13 Jul 2004 03:49:52 -0000 1.10
+++ dlls/x11drv/init.c 26 Aug 2004 14:29:50 -0000
@@ -45,6 +45,51 @@
TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE);
/* X11R6 adds TC_SF_X_YINDEP, Xrender adds TC_VA_ABLE */
+
+static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
+static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};
+
+static const WCHAR INIFontSection[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
+ 'W','i','n','e','\\','C','o','n','f','i','g','\\',
+ 'f','o','n','t','s','\0'};
+static const WCHAR INIResolution[] = {'R','e','s','o','l','u','t','i','o','n','\0'};
+
+/******************************************************************************
+ * get_dpi
+ *
+ * get the dpi from the registry
+ */
+static DWORD get_dpi( void )
+{
+ DWORD dpi = 96;
+ HKEY hkey;
+
+ if(RegOpenKeyW(HKEY_LOCAL_MACHINE, INIFontSection, &hkey) == ERROR_SUCCESS)
+ {
+ char buffer[20];
+ DWORD type, count = sizeof(buffer);
+ if(RegQueryValueExW(hkey, INIResolution, 0, &type, buffer, &count) == ERROR_SUCCESS)
+ if(atoi(buffer) != 96)
+ MESSAGE("Please use the registry key HKEY_CURRENT_CONFIG\\Sotfware\\Fonts\\LogPixels\n"
+ "to set the screen resolution and remove the \"Resolution\" entry in the config file\n");
+ RegCloseKey(hkey);
+ }
+
+ if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS)
+ {
+ DWORD type, size, new_dpi;
+
+ size = sizeof(new_dpi);
+ if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (void *)&new_dpi, &size) == ERROR_SUCCESS)
+ {
+ if(type == REG_DWORD && new_dpi != 0)
+ dpi = new_dpi;
+ }
+ RegCloseKey(hkey);
+ }
+ return dpi;
+}
+
/**********************************************************************
* X11DRV_GDI_Initialize
*/
@@ -59,12 +104,13 @@
/* Initialize XRender */
X11DRV_XRender_Init();
- /* Initialize fonts and text caps */
-
- log_pixels_x = log_pixels_y = 96;
- X11DRV_FONT_Init( &log_pixels_x, &log_pixels_y );
+ /* Initialize device caps */
+ log_pixels_x = log_pixels_y = get_dpi();
horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
+
+ /* Initialize fonts and text caps */
+ X11DRV_FONT_Init(log_pixels_x, log_pixels_y);
}
/**********************************************************************
Index: dlls/x11drv/x11drv.h
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11drv.h,v
retrieving revision 1.33
diff -u -r1.33 x11drv.h
--- dlls/x11drv/x11drv.h 18 Aug 2004 23:47:48 -0000 1.33
+++ dlls/x11drv/x11drv.h 26 Aug 2004 14:29:50 -0000
@@ -197,7 +197,7 @@
/* X11 driver internal functions */
extern void X11DRV_BITMAP_Init(void);
-extern void X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y );
+extern void X11DRV_FONT_Init( int log_pixels_x, int log_pixels_y );
struct tagBITMAPOBJ;
extern int X11DRV_DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse );
Index: dlls/x11drv/xfont.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/xfont.c,v
retrieving revision 1.8
diff -u -r1.8 xfont.c
--- dlls/x11drv/xfont.c 11 Aug 2004 23:45:34 -0000 1.8
+++ dlls/x11drv/xfont.c 26 Aug 2004 14:29:50 -0000
@@ -83,7 +83,6 @@
static const char* INIIgnoreSection = "Ignore";
static const char* INIDefault = "Default";
static const char* INIDefaultFixed = "DefaultFixed";
-static const char* INIResolution = "Resolution";
static const char* INIGlobalMetrics = "FontMetrics";
static const char* INIDefaultSerif = "DefaultSerif";
static const char* INIDefaultSansSerif = "DefaultSansSerif";
@@ -2390,44 +2389,25 @@
}
/***********************************************************************
- * XFONT_GetPointResolution()
+ * XFONT_GetDefResolution()
*
* INIT ONLY
*
* Here we initialize DefResolution which is used in the
- * XFONT_Match() penalty function. We also load the point
- * resolution value (higher values result in larger fonts).
+ * XFONT_Match() penalty function, based on the values of log_pixels
*/
-static int XFONT_GetPointResolution( int *log_pixels_x, int *log_pixels_y )
+static int XFONT_GetDefResolution( int log_pixels_x, int log_pixels_y )
{
- int i, j, point_resolution, num = 3;
+ int i, j, num = 3;
int allowed_xfont_resolutions[3] = { 72, 75, 100 };
int best = 0, best_diff = 65536;
- HKEY hkey;
-
- point_resolution = 0;
-
- if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
- {
- char buffer[20];
- DWORD type, count = sizeof(buffer);
- if(!RegQueryValueExA(hkey, INIResolution, 0, &type, buffer, &count))
- point_resolution = atoi(buffer);
- RegCloseKey(hkey);
- }
-
- if( !point_resolution )
- point_resolution = *log_pixels_y;
- else
- *log_pixels_x = *log_pixels_y = point_resolution;
-
/* FIXME We can only really guess at a best DefResolution
* - this should be configurable
*/
for( i = best = 0; i < num; i++ )
{
- j = abs( point_resolution - allowed_xfont_resolutions[i] );
+ j = abs( log_pixels_x - allowed_xfont_resolutions[i] );
if( j < best_diff )
{
best = i;
@@ -2435,7 +2415,7 @@
}
}
DefResolution = allowed_xfont_resolutions[best];
- return point_resolution;
+ return DefResolution;
}
@@ -3012,14 +2992,14 @@
/***********************************************************************
* X11DRV_FONT_Init
*/
-void X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y )
+void X11DRV_FONT_Init( int log_pixels_x, int log_pixels_y )
{
- XFONT_GetPointResolution( log_pixels_x, log_pixels_y );
+ XFONT_GetDefResolution( log_pixels_x, log_pixels_y );
- if(using_client_side_fonts)
- text_caps |= TC_VA_ABLE;
+ if(using_client_side_fonts)
+ text_caps |= TC_VA_ABLE;
- return;
+ return;
}
/**********************************************************************
More information about the wine-patches
mailing list