bug 27164; need to use em square height to compute line-height; added new

APIs for this purpose; this is the Windows implementation; r=kmcclusk
This commit is contained in:
erik%netscape.com 2000-05-08 21:59:23 +00:00
Родитель 815b961c58
Коммит 48bf04c76e
3 изменённых файлов: 52 добавлений и 8 удалений

Просмотреть файл

@ -132,7 +132,7 @@ public:
*/
NS_IMETHOD GetHeight(nscoord &aHeight) = 0;
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_PC)
#define NEW_FONT_HEIGHT_APIS 1
#endif
#ifdef NEW_FONT_HEIGHT_APIS

Просмотреть файл

@ -2534,10 +2534,13 @@ HDC dc1 = NULL;
#endif
}
mHeight = NSToCoordRound(metrics.tmHeight * dev2app);
mAscent = NSToCoordRound(metrics.tmAscent * dev2app);
mDescent = NSToCoordRound(metrics.tmDescent * dev2app);
mLeading = NSToCoordRound(metrics.tmInternalLeading * dev2app);
mEmHeight = NSToCoordRound((metrics.tmHeight - metrics.tmInternalLeading) *
dev2app);
mEmAscent = NSToCoordRound((metrics.tmAscent - metrics.tmInternalLeading) *
dev2app);
mEmDescent = NSToCoordRound(metrics.tmDescent * dev2app);
mMaxHeight = NSToCoordRound(metrics.tmHeight * dev2app);
mMaxAscent = NSToCoordRound(metrics.tmAscent * dev2app);
mMaxDescent = NSToCoordRound(metrics.tmDescent * dev2app);
mMaxAdvance = NSToCoordRound(metrics.tmMaxCharWidth * dev2app);
@ -2606,7 +2609,14 @@ nsFontMetricsWin :: GetUnderline(nscoord& aOffset, nscoord& aSize)
NS_IMETHODIMP
nsFontMetricsWin :: GetHeight(nscoord &aHeight)
{
aHeight = mHeight;
aHeight = mMaxHeight;
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetNormalLineHeight(nscoord &aHeight)
{
aHeight = mEmHeight + mLeading;
return NS_OK;
}
@ -2617,6 +2627,34 @@ nsFontMetricsWin :: GetLeading(nscoord &aLeading)
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetEmHeight(nscoord &aHeight)
{
aHeight = mEmHeight;
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetEmAscent(nscoord &aAscent)
{
aAscent = mEmAscent;
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetEmDescent(nscoord &aDescent)
{
aDescent = mEmDescent;
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetMaxHeight(nscoord &aHeight)
{
aHeight = mMaxHeight;
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsWin :: GetMaxAscent(nscoord &aAscent)
{

Просмотреть файл

@ -116,7 +116,12 @@ public:
NS_IMETHOD GetUnderline(nscoord& aOffset, nscoord& aSize);
NS_IMETHOD GetHeight(nscoord &aHeight);
NS_IMETHOD GetNormalLineHeight(nscoord &aHeight);
NS_IMETHOD GetLeading(nscoord &aLeading);
NS_IMETHOD GetEmHeight(nscoord &aHeight);
NS_IMETHOD GetEmAscent(nscoord &aAscent);
NS_IMETHOD GetEmDescent(nscoord &aDescent);
NS_IMETHOD GetMaxHeight(nscoord &aHeight);
NS_IMETHOD GetMaxAscent(nscoord &aAscent);
NS_IMETHOD GetMaxDescent(nscoord &aDescent);
NS_IMETHOD GetMaxAdvance(nscoord &aAdvance);
@ -193,10 +198,11 @@ protected:
nsDeviceContextWin *mDeviceContext;
nsFont *mFont;
nscoord mHeight;
nscoord mAscent;
nscoord mDescent;
nscoord mLeading;
nscoord mEmHeight;
nscoord mEmAscent;
nscoord mEmDescent;
nscoord mMaxHeight;
nscoord mMaxAscent;
nscoord mMaxDescent;
nscoord mMaxAdvance;