mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
tweaks to rounding problems with twips to pixels and font point sizes
added hack to support desdemona font for test cases
This commit is contained in:
parent
3538d9e5ed
commit
e63a09dbd3
@ -29,7 +29,7 @@ nsDeviceContextWin :: nsDeviceContextWin()
|
||||
|
||||
HDC hdc = ::GetDC(NULL);
|
||||
|
||||
mTwipsToPixels = ::GetDeviceCaps(hdc, LOGPIXELSX) / NS_POINTS_TO_TWIPS_FLOAT(72.0f);
|
||||
mTwipsToPixels = ((float)::GetDeviceCaps(hdc, LOGPIXELSX)) / NS_POINTS_TO_TWIPS_FLOAT(72.0f);
|
||||
mPixelsToTwips = 1.0f / mTwipsToPixels;
|
||||
|
||||
::ReleaseDC(NULL, hdc);
|
||||
|
@ -90,6 +90,9 @@ const char* nsFontMetricsWin::MapFamilyToFont(const nsString& aLogicalFontName)
|
||||
if (aLogicalFontName.EqualsIgnoreCase("monospace")) {
|
||||
return "Courier New";
|
||||
}
|
||||
if (aLogicalFontName.EqualsIgnoreCase("desdemona")) {
|
||||
return "Desdemona";
|
||||
}
|
||||
return "Arial";/* XXX for now */
|
||||
}
|
||||
|
||||
@ -116,7 +119,8 @@ void nsFontMetricsWin::RealizeFont(nsIDeviceContext *aContext)
|
||||
logFont.lfItalic = (mFont->style & NS_FONT_STYLE_ITALIC)
|
||||
? TRUE : FALSE;
|
||||
float t2p = aContext->GetAppUnitsToDevUnits();
|
||||
logFont.lfHeight = (LONG)(-mFont->size * t2p);
|
||||
float rounded = (float)NS_POINTS_TO_TWIPS_INT(NS_TWIPS_TO_POINTS_INT(mFont->size));
|
||||
logFont.lfHeight = (LONG)(-rounded * t2p); // this ugly rounding is to make ours compatible with Nav 4.0
|
||||
strncpy(logFont.lfFaceName,
|
||||
MapFamilyToFont(mFont->name),
|
||||
LF_FACESIZE);
|
||||
|
Loading…
Reference in New Issue
Block a user