зеркало из https://github.com/mozilla/pjs.git
Added GetAveCharWidth() function
This commit is contained in:
Родитель
6c878d3126
Коммит
d2d592948d
|
@ -154,6 +154,13 @@ public:
|
|||
* Returns the font handle associated with these metrics
|
||||
*/
|
||||
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle) = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
/**
|
||||
* Returns the average character width
|
||||
*/
|
||||
NS_IMETHOD GetAveCharWidth(nscoord& aAveCharWidth) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsIFontMetrics_h___ */
|
||||
|
|
|
@ -2524,6 +2524,7 @@ HDC dc1 = NULL;
|
|||
mMaxAscent = NSToCoordRound(metrics.tmAscent * dev2app);
|
||||
mMaxDescent = NSToCoordRound(metrics.tmDescent * dev2app);
|
||||
mMaxAdvance = NSToCoordRound(metrics.tmMaxCharWidth * dev2app);
|
||||
mAveCharWidth = NSToCoordRound(metrics.tmAveCharWidth * dev2app);
|
||||
|
||||
// Cache the width of a single space.
|
||||
SIZE size;
|
||||
|
@ -2647,6 +2648,13 @@ nsFontMetricsWin::GetFontHandle(nsFontHandle &aHandle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFontMetricsWin::GetAveCharWidth(nscoord &aAveCharWidth)
|
||||
{
|
||||
aAveCharWidth = mAveCharWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsFontWin::nsFontWin(LOGFONT* aLogFont, HFONT aFont, PRUint32* aMap)
|
||||
{
|
||||
if (aLogFont) {
|
||||
|
@ -2678,7 +2686,6 @@ nsFontWinUnicode::GetWidth(HDC aDC, const PRUnichar* aString, PRUint32 aLength)
|
|||
{
|
||||
SIZE size;
|
||||
::GetTextExtentPoint32W(aDC, aString, aLength, &size);
|
||||
|
||||
return size.cx;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ public:
|
|||
NS_IMETHOD GetFont(const nsFont *&aFont);
|
||||
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
|
||||
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
|
||||
NS_IMETHOD GetAveCharWidth(nscoord &aAveCharWidth);
|
||||
|
||||
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
|
||||
virtual nsFontWin* FindGlobalFont(HDC aDC, PRUnichar aChar);
|
||||
|
@ -199,6 +200,7 @@ protected:
|
|||
nscoord mMaxAscent;
|
||||
nscoord mMaxDescent;
|
||||
nscoord mMaxAdvance;
|
||||
nscoord mAveCharWidth;
|
||||
#ifdef MOZ_MATHML
|
||||
float mItalicSlope;
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче