gdi32: Do not normalize height of the default GUI font.

This commit is contained in:
Dmitry Timoshkov 2012-06-09 13:08:42 +09:00 committed by Alexandre Julliard
parent 00fb537a2d
commit e65b19cad3
2 changed files with 1 additions and 38 deletions

View File

@ -492,34 +492,6 @@ static UINT get_default_charset( void )
return csi.ciCharset; return csi.ciCharset;
} }
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'};
/******************************************************************************
* get_dpi (internal)
*
* get the dpi from the registry
*/
static DWORD get_dpi( void )
{
DWORD dpi = 96;
HKEY 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;
}
/*********************************************************************** /***********************************************************************
* GDI_inc_ref_count * GDI_inc_ref_count
@ -574,7 +546,6 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
*/ */
BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
{ {
LOGFONTW default_gui_font;
const struct DefaultFontInfo* deffonts; const struct DefaultFontInfo* deffonts;
int i; int i;
@ -609,12 +580,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
stock_objects[SYSTEM_FONT] = CreateFontIndirectW( &deffonts->SystemFont ); stock_objects[SYSTEM_FONT] = CreateFontIndirectW( &deffonts->SystemFont );
stock_objects[DEVICE_DEFAULT_FONT] = CreateFontIndirectW( &deffonts->DeviceDefaultFont ); stock_objects[DEVICE_DEFAULT_FONT] = CreateFontIndirectW( &deffonts->DeviceDefaultFont );
stock_objects[SYSTEM_FIXED_FONT] = CreateFontIndirectW( &deffonts->SystemFixedFont ); stock_objects[SYSTEM_FIXED_FONT] = CreateFontIndirectW( &deffonts->SystemFixedFont );
stock_objects[DEFAULT_GUI_FONT] = CreateFontIndirectW( &deffonts->DefaultGuiFont );
/* For the default gui font, we use the lfHeight member in deffonts as a place-holder
for the point size so we must convert this into a true height */
default_gui_font = deffonts->DefaultGuiFont;
default_gui_font.lfHeight = -MulDiv(default_gui_font.lfHeight, get_dpi(), 72);
stock_objects[DEFAULT_GUI_FONT] = CreateFontIndirectW( &default_gui_font );
stock_objects[DC_BRUSH] = CreateBrushIndirect( &DCBrush ); stock_objects[DC_BRUSH] = CreateBrushIndirect( &DCBrush );
stock_objects[DC_PEN] = CreatePenIndirect( &DCPen ); stock_objects[DC_PEN] = CreatePenIndirect( &DCPen );

View File

@ -4422,9 +4422,6 @@ static void test_stock_fonts(void)
} }
ok(td[i].weight == lf.lfWeight, "%d: expected lfWeight %d, got %d\n", i, td[i].weight, lf.lfWeight); ok(td[i].weight == lf.lfWeight, "%d: expected lfWeight %d, got %d\n", i, td[i].weight, lf.lfWeight);
if (td[i].height < 0) /* FIXME: remove once Wine is fixed */
todo_wine ok(td[i].height == lf.lfHeight, "%d: expected lfHeight %d, got %d\n", i, td[i].height, lf.lfHeight);
else
ok(td[i].height == lf.lfHeight, "%d: expected lfHeight %d, got %d\n", i, td[i].height, lf.lfHeight); ok(td[i].height == lf.lfHeight, "%d: expected lfHeight %d, got %d\n", i, td[i].height, lf.lfHeight);
ok(!lstrcmp(td[i].face_name, lf.lfFaceName), "%d: expected lfFaceName %s, got %s\n", i, td[i].face_name, lf.lfFaceName); ok(!lstrcmp(td[i].face_name, lf.lfFaceName), "%d: expected lfFaceName %s, got %s\n", i, td[i].face_name, lf.lfFaceName);
} }