Changes for qnx ( photon ) platform only. They should not affect building/runtime other platforms.

This fixes the problem with prefrences window and other configuration windows not being sized
properly to fit the whole content. The "size" of the system fonts ( in mozilla coordinates ) was wrong.
This commit is contained in:
amardare%qnx.com 2004-06-14 14:47:27 +00:00
parent 75eee7ea7b
commit 1583d3557a
2 changed files with 13 additions and 18 deletions

View File

@ -99,17 +99,9 @@ printf( "\n\n\n!!!!!!!!!!!!!!!!! ~nsDeviceContextPh is unloading the mFontLoadCa
}
NS_IMETHODIMP nsDeviceContextPh :: Init( nsNativeWidget aWidget ) {
float newscale, origscale;
float a2d,t2d;
CommonInit(NULL);
newscale = TwipsToDevUnits();
origscale = AppUnitsToDevUnits();
t2d = TwipsToDevUnits();
a2d = AppUnitsToDevUnits();
// Call my base class
return DeviceContextImpl::Init( aWidget );
}
@ -117,7 +109,7 @@ NS_IMETHODIMP nsDeviceContextPh :: Init( nsNativeWidget aWidget ) {
/* Called for Printing */
nsresult nsDeviceContextPh :: Init( nsNativeDeviceContext aContext, nsIDeviceContext *aOrigContext ) {
float origscale, newscale, t2d, a2d;
float origscale, newscale, t2d, a2d;
mDC = aContext;
@ -348,22 +340,22 @@ int nsDeviceContextPh :: ReadSystemFonts( ) const
void nsDeviceContextPh :: DefaultSystemFonts( ) const
{
FaceMessageFont = "MessageFont";
SizeMessageFont = 9;
SizeMessageFont = 8;
StyleMessageFont = NS_FONT_STYLE_NORMAL;
WeightMessageFont = NS_FONT_WEIGHT_NORMAL;
FaceMenuFont = "MenuFont";
SizeMenuFont = 9;
SizeMenuFont = 8;
StyleMenuFont = NS_FONT_STYLE_NORMAL;
WeightMenuFont = NS_FONT_WEIGHT_NORMAL;
FaceBalloonFont = "BalloonFont";
SizeBalloonFont = 9;
SizeBalloonFont = 8;
StyleBalloonFont = NS_FONT_STYLE_NORMAL;
WeightBalloonFont = NS_FONT_WEIGHT_NORMAL;
FaceGeneralFont = "TextFont";
SizeGeneralFont = 9;
SizeGeneralFont = 8;
StyleGeneralFont = NS_FONT_STYLE_NORMAL;
WeightGeneralFont = NS_FONT_WEIGHT_NORMAL;
}
@ -398,25 +390,25 @@ NS_IMETHODIMP nsDeviceContextPh :: GetSystemFont( nsSystemFontID aID, nsFont *aF
aFont->name.AssignWithConversion( FaceGeneralFont );
aFont->style = StyleGeneralFont;
aFont->weight = WeightGeneralFont;
aFont->size = NSIntPointsToTwips( SizeGeneralFont );
aFont->size = SizeGeneralFont / ( mAppUnitsToDevUnits * 0.68 ); /* see nsFontMetricsPh::Init */
break;
case eSystemFont_MessageBox:
aFont->name.AssignWithConversion( FaceMessageFont );
aFont->style = StyleMessageFont;
aFont->weight = WeightMessageFont;
aFont->size = NSIntPointsToTwips( SizeMessageFont );
aFont->size = SizeMessageFont / ( mAppUnitsToDevUnits * 0.68 ); /* see nsFontMetricsPh::Init */
break;
case eSystemFont_Tooltips: // moz
aFont->name.AssignWithConversion( FaceBalloonFont );
aFont->style = StyleBalloonFont;
aFont->weight = WeightBalloonFont;
aFont->size = NSIntPointsToTwips( SizeBalloonFont );
aFont->size = SizeBalloonFont / ( mAppUnitsToDevUnits * 0.68 ); /* see nsFontMetricsPh::Init */
break;
case eSystemFont_Menu:
aFont->name.AssignWithConversion( FaceMenuFont );
aFont->style = StyleMenuFont;
aFont->weight = WeightMenuFont;
aFont->size = NSIntPointsToTwips( SizeMenuFont );
aFont->size = SizeMenuFont / ( mAppUnitsToDevUnits * 0.68 ); /* see nsFontMetricsPh::Init */
break;
}

View File

@ -185,7 +185,10 @@ printf( "\n\n\t\t\tIn nsFontMetricsPh::Init str=%s\n", str );
float app2dev;
app2dev = mDeviceContext->AppUnitsToDevUnits();
PRInt32 sizePoints = NSToIntRound( app2dev * mFont->size * 0.74 );
PRInt32 sizePoints;
if( mFont->systemFont == PR_TRUE )
sizePoints = NSToIntRound( app2dev * mFont->size * 0.68 );
else sizePoints = NSToIntRound( app2dev * mFont->size * 0.74 );
char NSFullFontName[MAX_FONT_TAG];