mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
#5000 "GFX changes required to assume 96 dpi default scaling"
This commit is contained in:
parent
2bd75e97dc
commit
78e941dc79
@ -419,8 +419,10 @@ ATSUTextLayout nsATSUIToolkit::GetTextLayout()
|
||||
|
||||
mContext->GetDevUnitsToAppUnits(dev2app);
|
||||
Fixed size = FloatToFixed( roundf(float(fontsize) / dev2app));
|
||||
#if DONT_USE_FONTS_SMALLER_THAN_9
|
||||
if( FixRound ( size ) < 9 )
|
||||
size = X2Fix(9);
|
||||
#endif
|
||||
|
||||
theTag[1] = kATSUSizeTag;
|
||||
theValueSize[1] = (ByteCount) sizeof(Fixed);
|
||||
|
@ -29,6 +29,10 @@
|
||||
#include "il_util.h"
|
||||
#include <FixMath.h>
|
||||
|
||||
|
||||
const PRUint32 nsDeviceContextMac::kPixelsPerInch = 72;
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
@ -69,7 +73,7 @@ double pix_inch;
|
||||
thepix = (**thegd).gdPMap; // dereferenced handle: don't move memory below!
|
||||
mDepth = (**thepix).pixelSize;
|
||||
pix_inch = Fix2X((**thepix).hRes);
|
||||
mTwipsToPixels = pix_inch/(float)NSIntPointsToTwips(72);
|
||||
mTwipsToPixels = pix_inch/(float)NSIntPointsToTwips(kPixelsPerInch);
|
||||
mPixelsToTwips = 1.0f/mTwipsToPixels;
|
||||
|
||||
return DeviceContextImpl::Init(aNativeWidget);
|
||||
@ -341,7 +345,7 @@ THPrint thePrintRecord; // handle to print record
|
||||
((nsDeviceContextMac*)aContext)->Init(curPort);
|
||||
|
||||
((nsDeviceContextMac*)aContext)->mPageRect = (**thePrintRecord).prInfo.rPage;
|
||||
((nsDeviceContextMac*)aContext)->mTwipsToPixels = pix_Inch/(float)NSIntPointsToTwips(72);
|
||||
((nsDeviceContextMac*)aContext)->mTwipsToPixels = pix_Inch/(float)NSIntPointsToTwips(kPixelsPerInch);
|
||||
((nsDeviceContextMac*)aContext)->mPixelsToTwips = 1.0f/mTwipsToPixels;
|
||||
((nsDeviceContextMac*)aContext)->mAppUnitsToDevUnits = mTwipsToPixels;
|
||||
((nsDeviceContextMac*)aContext)->mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
|
||||
|
@ -78,6 +78,8 @@ protected:
|
||||
static nsHashtable* gFontInfoList;
|
||||
public:
|
||||
static bool GetMacFontNumber(const nsString& aFontName, short &fontNum);
|
||||
|
||||
static const PRUint32 kPixelsPerInch;
|
||||
};
|
||||
|
||||
#endif /* nsDeviceContextMac_h___ */
|
||||
|
@ -273,8 +273,10 @@ NS_EXPORT void nsFontMetricsMac::GetNativeTextStyle(nsIFontMetrics& inMetrics,
|
||||
inDevContext.GetDevUnitsToAppUnits(dev2app);
|
||||
short textSize = float(aFont->size) / dev2app;
|
||||
|
||||
#if DONT_USE_FONTS_SMALLER_THAN_9
|
||||
if (textSize < 9)
|
||||
textSize = 9;
|
||||
#endif
|
||||
|
||||
Style textFace = normal;
|
||||
switch (aFont->style)
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#define DONT_USE_FONTS_SMALLER_THAN_9 1 // 1 = 9 pt minimum, 0 = use any font size
|
||||
|
||||
class nsFontMetricsMac : public nsIFontMetrics
|
||||
{
|
||||
public:
|
||||
|
@ -113,8 +113,8 @@ PRInt32 bufferdepth;
|
||||
mThePixelmap.pixelSize = bufferdepth;
|
||||
mThePixelmap.packType = 0;
|
||||
mThePixelmap.packSize = 0;
|
||||
mThePixelmap.hRes = 72<<16;
|
||||
mThePixelmap.vRes = 72<<16;
|
||||
mThePixelmap.hRes = nsDeviceContextMac::kPixelsPerInch<<16;
|
||||
mThePixelmap.vRes = nsDeviceContextMac::kPixelsPerInch<<16;
|
||||
mThePixelmap.planeBytes = 0;
|
||||
mThePixelmap.pmReserved = 0;
|
||||
mThePixelmap.pmVersion = 0;
|
||||
|
@ -29,6 +29,10 @@
|
||||
#include "il_util.h"
|
||||
#include <FixMath.h>
|
||||
|
||||
|
||||
const PRUint32 nsDeviceContextMac::kPixelsPerInch = 72;
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
@ -69,7 +73,7 @@ double pix_inch;
|
||||
thepix = (**thegd).gdPMap; // dereferenced handle: don't move memory below!
|
||||
mDepth = (**thepix).pixelSize;
|
||||
pix_inch = Fix2X((**thepix).hRes);
|
||||
mTwipsToPixels = pix_inch/(float)NSIntPointsToTwips(72);
|
||||
mTwipsToPixels = pix_inch/(float)NSIntPointsToTwips(kPixelsPerInch);
|
||||
mPixelsToTwips = 1.0f/mTwipsToPixels;
|
||||
|
||||
return DeviceContextImpl::Init(aNativeWidget);
|
||||
@ -341,7 +345,7 @@ THPrint thePrintRecord; // handle to print record
|
||||
((nsDeviceContextMac*)aContext)->Init(curPort);
|
||||
|
||||
((nsDeviceContextMac*)aContext)->mPageRect = (**thePrintRecord).prInfo.rPage;
|
||||
((nsDeviceContextMac*)aContext)->mTwipsToPixels = pix_Inch/(float)NSIntPointsToTwips(72);
|
||||
((nsDeviceContextMac*)aContext)->mTwipsToPixels = pix_Inch/(float)NSIntPointsToTwips(kPixelsPerInch);
|
||||
((nsDeviceContextMac*)aContext)->mPixelsToTwips = 1.0f/mTwipsToPixels;
|
||||
((nsDeviceContextMac*)aContext)->mAppUnitsToDevUnits = mTwipsToPixels;
|
||||
((nsDeviceContextMac*)aContext)->mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
|
||||
|
@ -78,6 +78,8 @@ protected:
|
||||
static nsHashtable* gFontInfoList;
|
||||
public:
|
||||
static bool GetMacFontNumber(const nsString& aFontName, short &fontNum);
|
||||
|
||||
static const PRUint32 kPixelsPerInch;
|
||||
};
|
||||
|
||||
#endif /* nsDeviceContextMac_h___ */
|
||||
|
@ -284,8 +284,6 @@ NS_METHOD nsMacControl::CreateOrReplaceMacControl(short inControlType)
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
#define kMinControlFontSize 9
|
||||
|
||||
void nsMacControl::SetupMacControlFont()
|
||||
{
|
||||
NS_PRECONDITION(mFontMetrics != nsnull, "No font metrics in SetupMacControlFont");
|
||||
@ -294,9 +292,11 @@ void nsMacControl::SetupMacControlFont()
|
||||
TextStyle theStyle;
|
||||
nsFontMetricsMac::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
|
||||
|
||||
#if DONT_USE_FONTS_SMALLER_THAN_9
|
||||
// impose a min size of 9pt on the control font
|
||||
if (theStyle.tsSize < kMinControlFontSize)
|
||||
theStyle.tsSize = kMinControlFontSize;
|
||||
if (theStyle.tsSize < 9)
|
||||
theStyle.tsSize = 9;
|
||||
#endif
|
||||
|
||||
ControlFontStyleRec fontStyleRec;
|
||||
fontStyleRec.flags = (kControlUseFontMask | kControlUseFaceMask | kControlUseSizeMask);
|
||||
|
Loading…
Reference in New Issue
Block a user