mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
Deprecate the "Resolution" entry in the config file in favour of
HKEY_CURRNET_CONFIG\Software\Fonts\LogPixels.
This commit is contained in:
parent
329025915c
commit
ce4dfe23b4
5 changed files with 63 additions and 37 deletions
|
@ -45,6 +45,51 @@ unsigned int text_caps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
|
||||||
TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE);
|
TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE);
|
||||||
/* X11R6 adds TC_SF_X_YINDEP, Xrender adds TC_VA_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
|
* X11DRV_GDI_Initialize
|
||||||
*/
|
*/
|
||||||
|
@ -59,12 +104,13 @@ void X11DRV_GDI_Initialize( Display *display )
|
||||||
/* Initialize XRender */
|
/* Initialize XRender */
|
||||||
X11DRV_XRender_Init();
|
X11DRV_XRender_Init();
|
||||||
|
|
||||||
/* Initialize fonts and text caps */
|
/* Initialize device caps */
|
||||||
|
log_pixels_x = log_pixels_y = get_dpi();
|
||||||
log_pixels_x = log_pixels_y = 96;
|
|
||||||
X11DRV_FONT_Init( &log_pixels_x, &log_pixels_y );
|
|
||||||
horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
|
horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
|
||||||
vert_size = MulDiv( screen_height, 254, log_pixels_y * 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
|
|
@ -197,7 +197,7 @@ extern BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev);
|
||||||
/* X11 driver internal functions */
|
/* X11 driver internal functions */
|
||||||
|
|
||||||
extern void X11DRV_BITMAP_Init(void);
|
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;
|
struct tagBITMAPOBJ;
|
||||||
extern int X11DRV_DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse );
|
extern int X11DRV_DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse );
|
||||||
|
|
|
@ -83,7 +83,6 @@ static const char* INIAliasSection = "Alias";
|
||||||
static const char* INIIgnoreSection = "Ignore";
|
static const char* INIIgnoreSection = "Ignore";
|
||||||
static const char* INIDefault = "Default";
|
static const char* INIDefault = "Default";
|
||||||
static const char* INIDefaultFixed = "DefaultFixed";
|
static const char* INIDefaultFixed = "DefaultFixed";
|
||||||
static const char* INIResolution = "Resolution";
|
|
||||||
static const char* INIGlobalMetrics = "FontMetrics";
|
static const char* INIGlobalMetrics = "FontMetrics";
|
||||||
static const char* INIDefaultSerif = "DefaultSerif";
|
static const char* INIDefaultSerif = "DefaultSerif";
|
||||||
static const char* INIDefaultSansSerif = "DefaultSansSerif";
|
static const char* INIDefaultSansSerif = "DefaultSansSerif";
|
||||||
|
@ -2390,44 +2389,25 @@ static BOOL XFONT_WriteCachedMetrics( int fd, unsigned x_checksum, int x_count,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* XFONT_GetPointResolution()
|
* XFONT_GetDefResolution()
|
||||||
*
|
*
|
||||||
* INIT ONLY
|
* INIT ONLY
|
||||||
*
|
*
|
||||||
* Here we initialize DefResolution which is used in the
|
* Here we initialize DefResolution which is used in the
|
||||||
* XFONT_Match() penalty function. We also load the point
|
* XFONT_Match() penalty function, based on the values of log_pixels
|
||||||
* resolution value (higher values result in larger fonts).
|
|
||||||
*/
|
*/
|
||||||
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 allowed_xfont_resolutions[3] = { 72, 75, 100 };
|
||||||
int best = 0, best_diff = 65536;
|
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
|
/* FIXME We can only really guess at a best DefResolution
|
||||||
* - this should be configurable
|
* - this should be configurable
|
||||||
*/
|
*/
|
||||||
for( i = best = 0; i < num; i++ )
|
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 )
|
if( j < best_diff )
|
||||||
{
|
{
|
||||||
best = i;
|
best = i;
|
||||||
|
@ -2435,7 +2415,7 @@ static int XFONT_GetPointResolution( int *log_pixels_x, int *log_pixels_y )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DefResolution = allowed_xfont_resolutions[best];
|
DefResolution = allowed_xfont_resolutions[best];
|
||||||
return point_resolution;
|
return DefResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3012,14 +2992,14 @@ void X11DRV_FONT_InitX11Metrics( void )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* X11DRV_FONT_Init
|
* 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)
|
if(using_client_side_fonts)
|
||||||
text_caps |= TC_VA_ABLE;
|
text_caps |= TC_VA_ABLE;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
|
|
@ -94,7 +94,6 @@ WINE REGISTRY Version 2
|
||||||
[fonts]
|
[fonts]
|
||||||
;Read the Fonts topic in the Wine User Guide before adding aliases
|
;Read the Fonts topic in the Wine User Guide before adding aliases
|
||||||
;See a couple of examples for russian users below
|
;See a couple of examples for russian users below
|
||||||
"Resolution" = "96"
|
|
||||||
"Default" = "-adobe-helvetica-"
|
"Default" = "-adobe-helvetica-"
|
||||||
"DefaultFixed" = "fixed"
|
"DefaultFixed" = "fixed"
|
||||||
"DefaultSerif" = "-adobe-times-"
|
"DefaultSerif" = "-adobe-times-"
|
||||||
|
|
|
@ -156,6 +156,7 @@ HKLM,%FontSubStr%,"Times New Roman CYR,204",,"Times New Roman,204"
|
||||||
HKLM,%FontSubStr%,"Times New Roman Greek,161",,"Times New Roman,161"
|
HKLM,%FontSubStr%,"Times New Roman Greek,161",,"Times New Roman,161"
|
||||||
HKLM,%FontSubStr%,"Times New Roman TUR,162",,"Times New Roman,162"
|
HKLM,%FontSubStr%,"Times New Roman TUR,162",,"Times New Roman,162"
|
||||||
HKLM,%FontSubStr%,"Tms Rmn",,"Times New Roman"
|
HKLM,%FontSubStr%,"Tms Rmn",,"Times New Roman"
|
||||||
|
HKLM,System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts,"LogPixels",0x10001,00000060
|
||||||
|
|
||||||
[MCI]
|
[MCI]
|
||||||
HKLM,%Mci32Str%,"AVIVideo",,"mciavi.drv"
|
HKLM,%Mci32Str%,"AVIVideo",,"mciavi.drv"
|
||||||
|
|
Loading…
Reference in a new issue