bug 102088 - Cleanup transitory font APIs that were used as a bridge in bug 99010, r=waterson, sr=attinasi

This commit is contained in:
rbs%maths.uq.edu.au 2001-10-30 22:58:00 +00:00
Родитель ef130edd24
Коммит 32cf016db5
63 изменённых файлов: 238 добавлений и 589 удалений

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

@ -218,6 +218,11 @@ public:
*/
NS_IMETHOD GetAveCharWidth(nscoord& aAveCharWidth) = 0;
#endif
/**
* Returns the often needed width of the space character
*/
NS_IMETHOD GetSpaceWidth(nscoord& aSpaceCharWidth) = 0;
};
#endif /* nsIFontMetrics_h___ */

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

@ -642,14 +642,6 @@ public:
nsTextDimensions& aLastWordDimensions,
PRInt32* aFontID = nsnull) = 0;
#endif
/*
* XXX Buggy APIs: the DrawString() APIs are not implemented according
* to their signature. Indeed aX and aY are not interpreted as the
* coordinates of the baseline.
* XXX TODO: replace the buggy DrawString() APIs with the newer DrawString2()
* APIs and fix callers. The newer APIs are the ones to use in conjunction
* with GetTextDimensions().
*/
/**
* Draw a string in the RenderingContext
@ -663,15 +655,6 @@ public:
nscoord aX, nscoord aY,
const nscoord* aSpacing = nsnull) = 0;
/**
* Same as above, with the difference that the implementation is
* correctly intepreting aX and aY as the horizontal and vertical
* starting point of the baseline
*/
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing = nsnull) = 0;
/**
* Draw a string in the RenderingContext
* @param aString A PRUnichar of the string
@ -687,10 +670,6 @@ public:
nscoord aX, nscoord aY,
PRInt32 aFontID = -1,
const nscoord* aSpacing = nsnull) = 0;
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID = -1,
const nscoord* aSpacing = nsnull) = 0;
/**
* Draw a string in the RenderingContext

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

@ -316,6 +316,13 @@ NS_IMETHODIMP nsFontMetricsBeOS::GetMaxAdvance(nscoord &aAdvance)
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsBeOS::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsBeOS::GetFont(const nsFont*& aFont)
{
aFont = mFont;
@ -379,13 +386,6 @@ nsFontMetricsBeOS::FamilyExists(const nsString& aName)
return NS_ERROR_FAILURE;
}
nsresult
nsFontMetricsBeOS::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
// The Font Enumerator
nsFontEnumeratorBeOS::nsFontEnumeratorBeOS()

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

@ -87,7 +87,7 @@ public:
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord &aSpaceWidth);
static nsresult FamilyExists(const nsString& aFontName);

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

@ -1035,8 +1035,7 @@ NS_IMETHODIMP nsRenderingContextBeOS::GetWidth(char aC, nscoord &aWidth)
// Check for the very common case of trying to get the width of a single
// space.
if ((aC == ' ') && (nsnull != mFontMetrics)) {
nsFontMetricsBeOS *fontMetricsBeOS = (nsFontMetricsBeOS*)mFontMetrics;
return fontMetricsBeOS->GetSpaceWidth(aWidth);
return mFontMetrics->GetSpaceWidth(aWidth);
}
return GetWidth(&aC, 1, aWidth);
}
@ -1148,31 +1147,6 @@ nsRenderingContextBeOS::GetTextDimensions(const PRUnichar* aString,
return GetWidth(aString, aLength, aDimensions.width, aFontID);
}
NS_IMETHODIMP
nsRenderingContextBeOS::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
nscoord y = 0;
if (mFontMetrics) {
mFontMetrics->GetMaxAscent(y);
}
return DrawString2(aString, aLength, aX, aY + y, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextBeOS::DrawString(const PRUnichar* aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
nscoord y = 0;
if (mFontMetrics) {
mFontMetrics->GetMaxAscent(y);
}
return DrawString2(aString, aLength, aX, aY + y, aFontID, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextBeOS::DrawString(const nsString& aString,
nscoord aX, nscoord aY,
@ -1184,7 +1158,7 @@ nsRenderingContextBeOS::DrawString(const nsString& aString,
}
NS_IMETHODIMP
nsRenderingContextBeOS::DrawString2(const char *aString, PRUint32 aLength,
nsRenderingContextBeOS::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
@ -1196,15 +1170,6 @@ nsRenderingContextBeOS::DrawString2(const char *aString, PRUint32 aLength,
nscoord x = aX;
nscoord y = aY;
#if 0
// XXX - doesn't seem to be needed right now but leaving just incase -cls
// Substract xFontStruct ascent since drawing specifies baseline
if (mFontMetrics) {
mFontMetrics->GetMaxAscent(y);
y += aY;
}
#endif
UpdateView();
if(mView && mView->LockLooper())
@ -1242,7 +1207,7 @@ nsRenderingContextBeOS::DrawString2(const char *aString, PRUint32 aLength,
}
NS_IMETHODIMP
nsRenderingContextBeOS::DrawString2(const PRUnichar *aString, PRUint32 aLength,
nsRenderingContextBeOS::DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
@ -1256,7 +1221,7 @@ nsRenderingContextBeOS::DrawString2(const PRUnichar *aString, PRUint32 aLength,
*utf8ptr = '\0';
utf8str_len = strlen(utf8str);
DrawString2((char *)utf8str, utf8str_len, aX, aY, aSpacing);
DrawString((char *)utf8str, utf8str_len, aX, aY, aSpacing);
delete [] utf8str;
return NS_OK;
}

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

@ -171,15 +171,6 @@ public:
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
nscoord aWidth, nscoord aHeight);

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

@ -1390,6 +1390,14 @@ NS_IMETHODIMP nsFontMetricsGTK::GetFontHandle(nsFontHandle &aHandle)
return NS_OK;
}
NS_IMETHODIMP
nsFontMetricsGTK::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
/*
* CSS2 "font properties":
* font-family
@ -4078,13 +4086,6 @@ nsFontMetricsGTK::FindFont(PRUnichar aChar)
return font;
}
nsresult
nsFontMetricsGTK::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
// The Font Enumerator

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

@ -153,7 +153,7 @@ public:
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord &aSpaceWidth);
nsFontGTK* FindFont(PRUnichar aChar);
nsFontGTK* FindUserDefinedFont(PRUnichar aChar);

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

@ -1252,8 +1252,7 @@ nsRenderingContextGTK::GetWidth(char aC, nscoord &aWidth)
// Check for the very common case of trying to get the width of a single
// space.
if ((aC == ' ') && (nsnull != mFontMetrics)) {
nsFontMetricsGTK* fontMetricsGTK = (nsFontMetricsGTK*)mFontMetrics;
return fontMetricsGTK->GetSpaceWidth(aWidth);
return mFontMetrics->GetSpaceWidth(aWidth);
}
return GetWidth(&aC, 1, aWidth);
}
@ -1439,27 +1438,6 @@ NS_IMETHODIMP
nsRenderingContextGTK::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextGTK::DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aFontID, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextGTK::DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
if (0 != aLength) {
g_return_val_if_fail(mTranMatrix != NULL, NS_ERROR_FAILURE);
@ -1548,7 +1526,7 @@ nsRenderingContextGTK::DrawString2(const char *aString, PRUint32 aLength,
}
NS_IMETHODIMP
nsRenderingContextGTK::DrawString2(const PRUnichar* aString, PRUint32 aLength,
nsRenderingContextGTK::DrawString(const PRUnichar* aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)

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

@ -174,13 +174,6 @@ public:
nsTextDimensions& aDimensions);
NS_IMETHOD GetTextDimensions(const PRUnichar *aString, PRUint32 aLength,
nsTextDimensions& aDimensions, PRInt32 *aFontID);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,

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

@ -83,7 +83,7 @@ public:
NS_IMETHOD GetFont(const nsFont *&aFont);
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle& aHandle);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord& aSpaceCharWidth);
// fill a native TextStyle record with the font, size and style (not color)
static void GetNativeTextStyle(nsIFontMetrics& inMetrics,
const nsIDeviceContext& inDevContext, TextStyle &outStyle);

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

@ -1208,8 +1208,7 @@ NS_IMETHODIMP nsRenderingContextMac::FillArc(nscoord aX, nscoord aY, nscoord aWi
NS_IMETHODIMP nsRenderingContextMac::GetWidth(char ch, nscoord &aWidth)
{
if (ch == ' ' && mGS->mFontMetrics) {
nsFontMetricsMac* fontMetricsMac = static_cast<nsFontMetricsMac*>(mGS->mFontMetrics);
return fontMetricsMac->GetSpaceWidth(aWidth);
return mGS->mFontMetrics->GetSpaceWidth(aWidth);
}
char buf[1];
@ -1222,8 +1221,7 @@ NS_IMETHODIMP nsRenderingContextMac::GetWidth(char ch, nscoord &aWidth)
NS_IMETHODIMP nsRenderingContextMac::GetWidth(PRUnichar ch, nscoord &aWidth, PRInt32 *aFontID)
{
if (ch == ' ' && mGS->mFontMetrics) {
nsFontMetricsMac* fontMetricsMac = static_cast<nsFontMetricsMac*>(mGS->mFontMetrics);
return fontMetricsMac->GetSpaceWidth(aWidth);
return mGS->mFontMetrics->GetSpaceWidth(aWidth);
}
PRUnichar buf[1];
@ -1314,35 +1312,10 @@ nsRenderingContextMac::GetTextDimensions(const PRUnichar* aString, PRUint32 aLen
return rv;
}
NS_IMETHODIMP
nsRenderingContextMac::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
nscoord y = 0;
if (mGS->mFontMetrics) {
mGS->mFontMetrics->GetMaxAscent(y);
}
return DrawString2(aString, aLength, aX, aY + y, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextMac::DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
nscoord y = 0;
if (mGS->mFontMetrics) {
mGS->mFontMetrics->GetMaxAscent(y);
}
return DrawString2(aString, aLength, aX, aY + y, aFontID, aSpacing);
}
#pragma mark -
//------------------------------------------------------------------------
NS_IMETHODIMP nsRenderingContextMac::DrawString2(const char *aString, PRUint32 aLength,
NS_IMETHODIMP nsRenderingContextMac::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
@ -1389,7 +1362,7 @@ NS_IMETHODIMP nsRenderingContextMac::DrawString2(const char *aString, PRUint32 a
//------------------------------------------------------------------------
NS_IMETHODIMP nsRenderingContextMac::DrawString2(const PRUnichar *aString, PRUint32 aLength,
NS_IMETHODIMP nsRenderingContextMac::DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY, PRInt32 aFontID,
const nscoord* aSpacing)
{

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

@ -143,13 +143,6 @@ public:
nsTextDimensions& aDimensions);
NS_IMETHOD GetTextDimensions(const PRUnichar *aString, PRUint32 aLength,
nsTextDimensions& aDimensions, PRInt32 *aFontID);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);

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

@ -144,15 +144,7 @@ NS_IMETHODIMP nsGraphicsImpl::InvertPolygon(PRUint32 count, PRInt32 *points)
NS_IMETHODIMP nsGraphicsImpl::DrawString(const PRUnichar *text, nscoord x, nscoord y)
{
// this works around a bug in the way the ascent calculation is done.
nsCOMPtr<nsIFontMetrics> metrics;
if (mRenderer->GetFontMetrics(*getter_AddRefs(metrics)) == NS_OK) {
nscoord ascent = 0;
metrics->GetMaxAscent(ascent);
y -= ascent;
return mRenderer->DrawString(text, nsCRT::strlen(text), x, y);
}
return NS_ERROR_FAILURE;
return mRenderer->DrawString(text, nsCRT::strlen(text), x, y);
}
NS_IMETHODIMP nsGraphicsImpl::SetFont(const PRUnichar *name, nscoord size)

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

@ -1125,7 +1125,7 @@ nsresult nsFontMetricsOS2::RealizeFont()
return NS_OK;
}
nsresult nsFontMetricsOS2::GetSpaceWidth(nscoord &aSpaceWidth)
NS_IMETHODIMP nsFontMetricsOS2::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;

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

@ -150,7 +150,7 @@ class nsFontMetricsOS2 : public nsIFontMetrics
NS_IMETHOD GetFontHandle( nsFontHandle &aHandle);
NS_IMETHOD GetAveCharWidth(nscoord &aAveCharWidth);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHODIMP SetUnicodeFont( HPS aPS, LONG lcid );

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

@ -1275,8 +1275,7 @@ NS_IMETHODIMP nsRenderingContextOS2 :: GetWidth(const char* aString,
// space.
if ((1 == aLength) && (aString[0] == ' '))
{
nsFontMetricsOS2* fontMetricsOS2 = (nsFontMetricsOS2*)mFontMetrics;
return fontMetricsOS2->GetSpaceWidth(aWidth);
return mFontMetrics->GetSpaceWidth(aWidth);
}
SIZEL size;
@ -1481,31 +1480,6 @@ nsRenderingContextOS2::GetTextDimensions(const PRUnichar* aString,
return GetWidth(aString, aLength, aDimensions.width, aFontID);
}
NS_IMETHODIMP nsRenderingContextOS2 :: DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
nscoord y = 0;
if (mFontMetrics) {
mFontMetrics->GetMaxAscent(y);
}
// return DrawString2(aString, aLength, aX, aY + y, aSpacing);
return DrawString2(aString, aLength, aX, aY, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextOS2 :: DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY, PRInt32 aFontID,
const nscoord* aSpacing)
{
nscoord y = 0;
if (mFontMetrics) {
mFontMetrics->GetMaxAscent(y);
}
return DrawString2(aString, aLength, aX, aY + y, aFontID, aSpacing);
// return DrawString2(aString, aLength, aX, aY, aFontID, aSpacing);
}
NS_IMETHODIMP nsRenderingContextOS2 :: DrawString(const nsString& aString,
nscoord aX, nscoord aY,
PRInt32 aFontID,
@ -1514,17 +1488,12 @@ NS_IMETHODIMP nsRenderingContextOS2 :: DrawString(const nsString& aString,
return DrawString(aString.get(), aString.Length(), aX, aY, aFontID, aSpacing);
}
NS_IMETHODIMP nsRenderingContextOS2 :: DrawString2(const char *aString, PRUint32 aLength,
NS_IMETHODIMP nsRenderingContextOS2 :: DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
NS_PRECONDITION(mFontMetrics,"Something is wrong somewhere");
// Take care of ascent and specifies the drawing on the baseline
// nscoord ascent;
// mFontMetrics->GetMaxAscent(ascent);
// aY -= ascent;
PRInt32 x = aX;
PRInt32 y = aY;
@ -1553,7 +1522,7 @@ NS_IMETHODIMP nsRenderingContextOS2 :: DrawString2(const char *aString, PRUint32
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextOS2 :: DrawString2(const PRUnichar *aString, PRUint32 aLength,
NS_IMETHODIMP nsRenderingContextOS2 :: DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)

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

@ -180,14 +180,6 @@ public:
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawImage( nsIImage *aImage, nscoord aX, nscoord aY);
NS_IMETHOD DrawImage( nsIImage *aImage, nscoord aX, nscoord aY,
nscoord aWidth, nscoord aHeight);

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

@ -422,7 +422,7 @@ NS_IMETHODIMP nsFontMetricsPh::GetFontHandle(nsFontHandle &aHandle)
return NS_OK;
}
nsresult nsFontMetricsPh::GetSpaceWidth(nscoord &aSpaceWidth)
NS_IMETHODIMP nsFontMetricsPh::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;

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

@ -84,7 +84,7 @@ public:
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord &aSpaceWidth);
protected:
void RealizeFont();

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

@ -912,8 +912,7 @@ NS_IMETHODIMP nsRenderingContextPh :: GetWidth( char ch, nscoord& aWidth )
// Check for the very common case of trying to get the width of a single
// space.
if(ch == ' ' && nsnull != mFontMetrics ) {
nsFontMetricsPh* fontMetricsPh = (nsFontMetricsPh*)mFontMetrics;
return fontMetricsPh->GetSpaceWidth(aWidth);
return mFontMetrics->GetSpaceWidth(aWidth);
}
return GetWidth( &ch, 1, aWidth );
}
@ -1028,47 +1027,6 @@ NS_IMETHODIMP nsRenderingContextPh::GetTextDimensions(const PRUnichar* aString,
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh :: DrawString( const char *aString, PRUint32 aLength, nscoord aX, nscoord aY, const nscoord* aSpacing )
{
if ( aLength == 0 )
return NS_OK;
UpdateGC();
PgSetFont( mPhotonFontName );
if( !aSpacing ) {
mTranMatrix->TransformCoord( &aX, &aY );
PhPoint_t pos = { aX, aY };
PgDrawTextChars( aString, aLength, &pos, Pg_TEXT_LEFT | Pg_TEXT_TOP );
// PgDrawTextChars( aString, aLength, &pos, Pg_TEXT_LEFT );
}
else {
nscoord x = aX;
nscoord y = aY;
const char* end = aString + aLength;
while( aString < end ) {
char ch = *aString++;
nscoord xx = x;
nscoord yy = y;
mTranMatrix->TransformCoord(&xx, &yy);
PhPoint_t pos = { xx, yy };
PgDrawText( &ch, 1, &pos, Pg_TEXT_LEFT | Pg_TEXT_TOP);
// PgDrawText( &ch, 1, &pos, Pg_TEXT_LEFT);
x += *aSpacing++;
}
}
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh :: DrawString( const PRUnichar *aString, PRUint32 aLength, nscoord aX, nscoord aY, PRInt32 aFontID, const nscoord* aSpacing )
{
NS_ConvertUCS2toUTF8 theUnicodeString( aString, aLength );
const char *p = theUnicodeString.get( );
return DrawString( p, strlen( p ), aX, aY, aSpacing );
}
NS_IMETHODIMP nsRenderingContextPh :: DrawString( const nsString& aString, nscoord aX, nscoord aY, PRInt32 aFontID, const nscoord* aSpacing )
{
NS_ConvertUCS2toUTF8 theUnicodeString( aString.get(), aString.Length() );
@ -1076,7 +1034,7 @@ NS_IMETHODIMP nsRenderingContextPh :: DrawString( const nsString& aString, nscoo
return DrawString( p, strlen( p ), aX, aY, aSpacing );
}
NS_IMETHODIMP nsRenderingContextPh::DrawString2(const char *aString, PRUint32 aLength,
NS_IMETHODIMP nsRenderingContextPh::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
@ -1109,14 +1067,14 @@ NS_IMETHODIMP nsRenderingContextPh::DrawString2(const char *aString, PRUint32 aL
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh::DrawString2(const PRUnichar* aString, PRUint32 aLength,
NS_IMETHODIMP nsRenderingContextPh::DrawString(const PRUnichar* aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
NS_ConvertUCS2toUTF8 theUnicodeString( aString, aLength );
const char *p = theUnicodeString.get( );
return DrawString2( p, strlen( p ), aX, aY, aSpacing );
return DrawString( p, strlen( p ), aX, aY, aSpacing );
}
NS_IMETHODIMP nsRenderingContextPh::DrawImage( nsIImage *aImage, nscoord aX, nscoord aY )

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

@ -166,13 +166,6 @@ public:
nsTextDimensions& aDimensions);
NS_IMETHOD GetTextDimensions(const PRUnichar *aString, PRUint32 aLength,
nsTextDimensions& aDimensions, PRInt32 *aFontID);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,

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

@ -164,6 +164,8 @@ float offset;
mMaxAscent = mAscent;
mMaxDescent = mDescent;
mMaxAdvance = mHeight;
GetStringWidth(" ", mSpaceWidth, 1);
}
/** ---------------------------------------------------
@ -328,6 +330,17 @@ nsFontMetricsPS :: GetMaxAdvance(nscoord &aAdvance)
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsFontMetricsPS.h
* @update 2/26/99 dwc
*/
NS_IMETHODIMP
nsFontMetricsPS :: GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
/** ---------------------------------------------------
* See documentation in nsFontMetricsPS.h
* @update 2/26/99 dwc

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

@ -80,6 +80,7 @@ public:
NS_IMETHOD GetMaxAscent(nscoord &aAscent);
NS_IMETHOD GetMaxDescent(nscoord &aDescent);
NS_IMETHOD GetMaxAdvance(nscoord &aAdvance);
NS_IMETHOD GetSpaceWidth(nscoord& aAveCharWidth);
NS_IMETHOD GetFont(const nsFont *&aFont);
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
@ -125,6 +126,7 @@ protected:
nscoord mStrikeoutOffset;
nscoord mUnderlineSize;
nscoord mUnderlineOffset;
nscoord mSpaceWidth;
PRInt16 mFontIndex;
public:

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

@ -1086,33 +1086,12 @@ nsRenderingContextPS :: GetTextDimensions(const PRUnichar* aString, PRUint32 aLe
}
}
NS_IMETHODIMP
nsRenderingContextPS :: DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextPS :: DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aFontID, aSpacing);
}
/** ---------------------------------------------------
* See documentation in nsIRenderingContext.h
* @update 12/21/98 dwc
*/
NS_IMETHODIMP
nsRenderingContextPS :: DrawString2(const char *aString, PRUint32 aLength,
nsRenderingContextPS :: DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
@ -1165,7 +1144,7 @@ PRInt32 y = aY;
* @update 12/21/98 dwc
*/
NS_IMETHODIMP
nsRenderingContextPS :: DrawString2(const PRUnichar *aString, PRUint32 aLength,
nsRenderingContextPS :: DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY, PRInt32 aFontID,
const nscoord* aSpacing)
{

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

@ -175,13 +175,6 @@ public:
nsTextDimensions& aDimensions);
NS_IMETHOD GetTextDimensions(const PRUnichar *aString, PRUint32 aLength,
nsTextDimensions& aDimensions, PRInt32 *aFontID);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,

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

@ -1022,6 +1022,12 @@ NS_IMETHODIMP nsFontMetricsQT::GetMaxAdvance(nscoord &aAdvance)
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsQT::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsQT::GetFont(const nsFont *&aFont)
{
aFont = mFont;
@ -1635,13 +1641,6 @@ nsFontMetricsQT::FindFont(PRUnichar aChar)
}
return font;
}
nsresult
nsFontMetricsQT::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(nsFontQT);

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

@ -142,7 +142,7 @@ public:
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord &aSpaceWidth);
nsFontQT* FindFont(PRUnichar aChar);
nsFontQT* FindUserDefinedFont(PRUnichar aChar);

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

@ -1201,7 +1201,7 @@ FoundFont:
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextQT::DrawString2(const char *aString,
NS_IMETHODIMP nsRenderingContextQT::DrawString(const char *aString,
PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord *aSpacing)
@ -1241,28 +1241,7 @@ NS_IMETHODIMP nsRenderingContextQT::DrawString2(const char *aString,
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextQT::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextQT::DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aFontID, aSpacing);
}
NS_IMETHODIMP nsRenderingContextQT::DrawString2(const PRUnichar *aString,
NS_IMETHODIMP nsRenderingContextQT::DrawString(const PRUnichar *aString,
PRUint32 aLength,
nscoord aX,nscoord aY,
PRInt32 aFontID,

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

@ -161,13 +161,6 @@ public:
nsTextDimensions& aDimensions);
NS_IMETHOD GetTextDimensions(const PRUnichar *aString, PRUint32 aLength,
nsTextDimensions& aDimensions, PRInt32 *aFontID);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
#ifdef MOZ_MATHML
/* Returns metrics (in app units) of an 8-bit character string */

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

@ -2891,7 +2891,7 @@ nsFontMetricsWin::FindGenericFont(HDC aDC, PRUnichar aChar)
return context.mFont;
}
#ifdef DEBUG_rbs
#if defined(DEBUG_rbs) || defined(DEBUG_shanjian)
nsCAutoString lang; lang.Assign(NS_ConvertUCS2toUTF8(langGroup));
nsCAutoString generic; generic.Assign(NS_ConvertUCS2toUTF8(mGeneric));
nsCAutoString family; family.Assign(NS_ConvertUCS2toUTF8(mFont.name));
@ -3097,7 +3097,7 @@ nsFontMetricsWin::RealizeFont()
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsFontMetricsWin::GetSpaceWidth(nscoord& aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;

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

@ -201,7 +201,7 @@ public:
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
NS_IMETHOD GetAveCharWidth(nscoord &aAveCharWidth);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord &aSpaceWidth);
virtual nsresult
ResolveForwards(HDC aDC,

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

@ -2214,18 +2214,6 @@ NS_IMETHODIMP nsRenderingContextWin :: DrawString(const char *aString, PRUint32
{
NS_PRECONDITION(mFontMetrics,"Something is wrong somewhere");
SetupFontAndColor();
// Take care of ascent and specifies the drawing on the baseline
nscoord ascent = mCurrFontWin->mMaxAscent;
return DrawString2(aString, aLength, aX, aY + ascent, aSpacing);
}
NS_IMETHODIMP nsRenderingContextWin :: DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
NS_PRECONDITION(mFontMetrics,"Something is wrong somewhere");
PRInt32 x = aX;
PRInt32 y = aY;
@ -2306,7 +2294,7 @@ do_DrawString(const nsFontSwitch* aFontSwitch,
return PR_TRUE; // don't stop till the end
}
NS_IMETHODIMP nsRenderingContextWin :: DrawString2(const PRUnichar *aString, PRUint32 aLength,
NS_IMETHODIMP nsRenderingContextWin :: DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
@ -2341,18 +2329,6 @@ NS_IMETHODIMP nsRenderingContextWin :: DrawString2(const PRUnichar *aString, PRU
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextWin :: DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
if (!mFontMetrics) return NS_ERROR_FAILURE;
SetupFontAndColor();
nscoord ascent = mCurrFontWin->mMaxAscent;
return DrawString2(aString, aLength, aX, aY + ascent, aFontID, aSpacing);
}
NS_IMETHODIMP nsRenderingContextWin :: DrawString(const nsString& aString,
nscoord aX, nscoord aY,
PRInt32 aFontID,

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

@ -178,14 +178,6 @@ public:
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing);
NS_IMETHOD DrawString2(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY);
NS_IMETHOD DrawImage(nsIImage *aImage, nscoord aX, nscoord aY,
nscoord aWidth, nscoord aHeight);

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

@ -1391,6 +1391,12 @@ NS_IMETHODIMP nsFontMetricsXlib::GetMaxAdvance(nscoord &aAdvance)
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsXlib::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
NS_IMETHODIMP nsFontMetricsXlib::GetFont(const nsFont*& aFont)
{
aFont = mFont;
@ -4094,13 +4100,6 @@ nsFontMetricsXlib::FindFont(PRUnichar aChar)
return font;
}
nsresult
nsFontMetricsXlib::GetSpaceWidth(nscoord &aSpaceWidth)
{
aSpaceWidth = mSpaceWidth;
return NS_OK;
}
// The Font Enumerator
nsFontEnumeratorXlib::nsFontEnumeratorXlib()

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

@ -167,7 +167,7 @@ public:
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle &aHandle);
virtual nsresult GetSpaceWidth(nscoord &aSpaceWidth);
NS_IMETHOD GetSpaceWidth(nscoord &aSpaceWidth);
nsFontXlib* FindFont(PRUnichar aChar);
nsFontXlib* FindUserDefinedFont(PRUnichar aChar);

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

@ -1236,8 +1236,7 @@ nsRenderingContextXlib::GetWidth(char aC, nscoord& aWidth)
// Check for the very common case of trying to get the width of a single
// space.
if ((aC == ' ') && (nsnull != mFontMetrics)) {
nsFontMetricsXlib* fontMetricsXlib = (nsFontMetricsXlib*)mFontMetrics;
return fontMetricsXlib->GetSpaceWidth(aWidth);
return mFontMetrics->GetSpaceWidth(aWidth);
}
return GetWidth(&aC, 1, aWidth);
}
@ -1424,27 +1423,6 @@ NS_IMETHODIMP
nsRenderingContextXlib::DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextXlib::DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)
{
nscoord y;
mFontMetrics->GetMaxAscent(y);
return DrawString2(aString, aLength, aX, aY + y, aFontID, aSpacing);
}
NS_IMETHODIMP
nsRenderingContextXlib::DrawString2(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing)
{
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawString()\n"));
if (0 != aLength) {
@ -1540,7 +1518,7 @@ nsRenderingContextXlib::DrawString2(const char *aString, PRUint32 aLength,
}
NS_IMETHODIMP
nsRenderingContextXlib::DrawString2(const PRUnichar *aString, PRUint32 aLength,
nsRenderingContextXlib::DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID,
const nscoord* aSpacing)

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

@ -523,7 +523,7 @@ nsPresContext::GetUserPreferences()
}
NS_IMETHODIMP
nsPresContext::GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue)
nsPresContext::GetCachedBoolPref(PRUint32 aPrefType, PRBool& aValue)
{
nsresult rv = NS_OK;
@ -545,7 +545,7 @@ nsPresContext::GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue)
}
NS_IMETHODIMP
nsPresContext::GetCachedIntPref(const PRUint32 aPrefType, PRInt32& aValue)
nsPresContext::GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue)
{
nsresult rv = NS_OK;
switch (aPrefType) {
@ -988,7 +988,7 @@ nsPresContext::GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult)
}
NS_IMETHODIMP
nsPresContext::GetDefaultFont(const PRUint8 aFontID, nsFont& aResult)
nsPresContext::GetDefaultFont(PRUint8 aFontID, nsFont& aResult)
{
nsresult rv = NS_OK;
switch (aFontID) {
@ -1024,7 +1024,7 @@ nsPresContext::GetDefaultFont(const PRUint8 aFontID, nsFont& aResult)
}
NS_IMETHODIMP
nsPresContext::SetDefaultFont(const PRUint8 aFontID, const nsFont& aFont)
nsPresContext::SetDefaultFont(PRUint8 aFontID, const nsFont& aFont)
{
nsresult rv = NS_OK;
switch (aFontID) {

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

@ -268,23 +268,23 @@ public:
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) = 0;
/** Get the default font correponding to the given ID */
NS_IMETHOD GetDefaultFont(const PRUint8 aFontID, nsFont& aResult) = 0;
NS_IMETHOD GetDefaultFont(PRUint8 aFontID, nsFont& aResult) = 0;
/** Set the default font correponding to the given ID */
NS_IMETHOD SetDefaultFont(const PRUint8 aFontID, const nsFont& aFont) = 0;
NS_IMETHOD SetDefaultFont(PRUint8 aFontID, const nsFont& aFont) = 0;
/** Get a cached boolean pref, by its type
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
and the aValue argument is undefined, otherwise aValue is set
to the value of the boolean pref */
// * - initially created for bugs 31816, 20760, 22963
NS_IMETHOD GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue) = 0;
NS_IMETHOD GetCachedBoolPref(PRUint32 aPrefType, PRBool& aValue) = 0;
/** Get a cached integer pref, by its type
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
and the aValue argument is undefined, otherwise aValue is set
to the value of the integer pref */
// * - initially created for bugs 30910, 61883, 74186, 84398
NS_IMETHOD GetCachedIntPref(const PRUint32 aPrefType, PRInt32& aValue) = 0;
NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) = 0;
/**
* Access Nav's magic font scaler value

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

@ -7283,14 +7283,15 @@ void ReflowCountMgr::PaintCount(const char * aName,
aRenderingContext->SetFont(fm);
char buf[16];
sprintf(buf, "%d", counter->mCount);
nscoord x = 0, y;
nscoord width, height;
aRenderingContext->GetWidth((char*)buf, width);
fm->GetHeight(height);
fm->GetMaxAscent(y);
nsRect r;
aFrame->GetRect(r);
nscoord x = 0;
PRUint32 color;
PRUint32 color2;
if (aColor != 0) {
@ -7314,9 +7315,9 @@ void ReflowCountMgr::PaintCount(const char * aName,
aRenderingContext->SetColor(NS_RGB(0,0,0));
aRenderingContext->FillRect(rect);
aRenderingContext->SetColor(color2);
aRenderingContext->DrawString(buf, strlen(buf), x+15,15);
aRenderingContext->DrawString(buf, strlen(buf), x+15,y+15);
aRenderingContext->SetColor(color);
aRenderingContext->DrawString(buf, strlen(buf), x,0);
aRenderingContext->DrawString(buf, strlen(buf), x,y);
PRBool clipEmpty;
aRenderingContext->PopState(clipEmpty);

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

@ -268,23 +268,23 @@ public:
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) = 0;
/** Get the default font correponding to the given ID */
NS_IMETHOD GetDefaultFont(const PRUint8 aFontID, nsFont& aResult) = 0;
NS_IMETHOD GetDefaultFont(PRUint8 aFontID, nsFont& aResult) = 0;
/** Set the default font correponding to the given ID */
NS_IMETHOD SetDefaultFont(const PRUint8 aFontID, const nsFont& aFont) = 0;
NS_IMETHOD SetDefaultFont(PRUint8 aFontID, const nsFont& aFont) = 0;
/** Get a cached boolean pref, by its type
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
and the aValue argument is undefined, otherwise aValue is set
to the value of the boolean pref */
// * - initially created for bugs 31816, 20760, 22963
NS_IMETHOD GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue) = 0;
NS_IMETHOD GetCachedBoolPref(PRUint32 aPrefType, PRBool& aValue) = 0;
/** Get a cached integer pref, by its type
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
and the aValue argument is undefined, otherwise aValue is set
to the value of the integer pref */
// * - initially created for bugs 30910, 61883, 74186, 84398
NS_IMETHOD GetCachedIntPref(const PRUint32 aPrefType, PRInt32& aValue) = 0;
NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) = 0;
/**
* Access Nav's magic font scaler value

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

@ -268,23 +268,23 @@ public:
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) = 0;
/** Get the default font correponding to the given ID */
NS_IMETHOD GetDefaultFont(const PRUint8 aFontID, nsFont& aResult) = 0;
NS_IMETHOD GetDefaultFont(PRUint8 aFontID, nsFont& aResult) = 0;
/** Set the default font correponding to the given ID */
NS_IMETHOD SetDefaultFont(const PRUint8 aFontID, const nsFont& aFont) = 0;
NS_IMETHOD SetDefaultFont(PRUint8 aFontID, const nsFont& aFont) = 0;
/** Get a cached boolean pref, by its type
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
and the aValue argument is undefined, otherwise aValue is set
to the value of the boolean pref */
// * - initially created for bugs 31816, 20760, 22963
NS_IMETHOD GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue) = 0;
NS_IMETHOD GetCachedBoolPref(PRUint32 aPrefType, PRBool& aValue) = 0;
/** Get a cached integer pref, by its type
if the type is not supported, then NS_ERROR_INVALID_ARG is returned
and the aValue argument is undefined, otherwise aValue is set
to the value of the integer pref */
// * - initially created for bugs 30910, 61883, 74186, 84398
NS_IMETHOD GetCachedIntPref(const PRUint32 aPrefType, PRInt32& aValue) = 0;
NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) = 0;
/**
* Access Nav's magic font scaler value

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

@ -523,7 +523,7 @@ nsPresContext::GetUserPreferences()
}
NS_IMETHODIMP
nsPresContext::GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue)
nsPresContext::GetCachedBoolPref(PRUint32 aPrefType, PRBool& aValue)
{
nsresult rv = NS_OK;
@ -545,7 +545,7 @@ nsPresContext::GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue)
}
NS_IMETHODIMP
nsPresContext::GetCachedIntPref(const PRUint32 aPrefType, PRInt32& aValue)
nsPresContext::GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue)
{
nsresult rv = NS_OK;
switch (aPrefType) {
@ -988,7 +988,7 @@ nsPresContext::GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult)
}
NS_IMETHODIMP
nsPresContext::GetDefaultFont(const PRUint8 aFontID, nsFont& aResult)
nsPresContext::GetDefaultFont(PRUint8 aFontID, nsFont& aResult)
{
nsresult rv = NS_OK;
switch (aFontID) {
@ -1024,7 +1024,7 @@ nsPresContext::GetDefaultFont(const PRUint8 aFontID, nsFont& aResult)
}
NS_IMETHODIMP
nsPresContext::SetDefaultFont(const PRUint8 aFontID, const nsFont& aFont)
nsPresContext::SetDefaultFont(PRUint8 aFontID, const nsFont& aFont)
{
nsresult rv = NS_OK;
switch (aFontID) {

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

@ -107,10 +107,10 @@ public:
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult);
NS_IMETHOD AllocateFromShell(size_t aSize, void** aResult);
NS_IMETHOD FreeToShell(size_t aSize, void* aFreeChunk);
NS_IMETHOD GetDefaultFont(const PRUint8 aFontID, nsFont& aResult);
NS_IMETHOD SetDefaultFont(const PRUint8 aFontID, const nsFont& aFont);
NS_IMETHOD GetCachedBoolPref(const PRUint32 aPrefType, PRBool& aValue);
NS_IMETHOD GetCachedIntPref(const PRUint32 aPrefType, PRInt32& aValue);
NS_IMETHOD GetDefaultFont(PRUint8 aFontID, nsFont& aResult);
NS_IMETHOD SetDefaultFont(PRUint8 aFontID, const nsFont& aFont);
NS_IMETHOD GetCachedBoolPref(PRUint32 aPrefType, PRBool& aValue);
NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue);
NS_IMETHOD GetFontScaler(PRInt32* aResult);
NS_IMETHOD SetFontScaler(PRInt32 aScaler);

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

@ -322,13 +322,17 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
aPresContext->GetMetricsFor(myFont->mFont, getter_AddRefs(fm));
GetListItemText(aPresContext, *myList, text);
aRenderingContext.SetFont(fm);
aRenderingContext.DrawString(text, mPadding.left, mPadding.top);
nscoord ascent;
fm->GetMaxAscent(ascent);
aRenderingContext.DrawString(text, mPadding.left, mPadding.top + ascent);
break;
}
#ifdef IBMBIDI
if (charType != eCharType_LeftToRight) {
aPresContext->GetMetricsFor(myFont->mFont, getter_AddRefs(fm));
aRenderingContext.SetFont(fm);
nscoord ascent;
fm->GetMaxAscent(ascent);
nsBidiPresUtils* bidiUtils;
aPresContext->GetBidiUtils(&bidiUtils);
@ -347,7 +351,7 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
charType, level, isBidiSystem);//Mohamed
}
}
aRenderingContext.DrawString(text, mPadding.left, mPadding.top);
aRenderingContext.DrawString(text, mPadding.left, mPadding.top + ascent);
}
#endif // IBMBIDI
}

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

@ -892,7 +892,8 @@ nsImageFrame::DisplayAltText(nsIPresContext* aPresContext,
nsIFontMetrics* fm;
aRenderingContext.GetFontMetrics(fm);
nscoord maxDescent, height;
nscoord maxAscent, maxDescent, height;
fm->GetMaxAscent(maxAscent);
fm->GetMaxDescent(maxDescent);
fm->GetHeight(height);
@ -908,7 +909,7 @@ nsImageFrame::DisplayAltText(nsIPresContext* aPresContext,
MeasureString(str, strLen, aRect.width, maxFit, aRenderingContext);
// Display the text
aRenderingContext.DrawString(str, maxFit, aRect.x, y);
aRenderingContext.DrawString(str, maxFit, aRect.x, y + maxAscent);
// Move to the next line
str += maxFit;

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

@ -421,6 +421,7 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
const nsString& aStr2,
const nsString& aStr3,
const nsRect& aRect,
nscoord aAscent,
nscoord aHeight)
{
PRInt32 numStrs = 0;
@ -432,13 +433,13 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
nscoord strSpace = aRect.width / numStrs;
if (!aStr1.IsEmpty()) {
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustLeft, aStr1, aRect, aHeight, strSpace);
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustLeft, aStr1, aRect, aAscent, aHeight, strSpace);
}
if (!aStr2.IsEmpty()) {
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustCenter, aStr2, aRect, aHeight, strSpace);
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustCenter, aStr2, aRect, aAscent, aHeight, strSpace);
}
if (!aStr3.IsEmpty()) {
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustRight, aStr3, aRect, aHeight, strSpace);
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustRight, aStr3, aRect, aAscent, aHeight, strSpace);
}
}
@ -458,6 +459,7 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
PRInt32 aJust,
const nsString& aStr,
const nsRect& aRect,
nscoord aAscent,
nscoord aHeight,
nscoord aWidth)
{
@ -507,7 +509,7 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
PRBool clipEmpty;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty);
aRenderingContext.DrawString(str, x, y);
aRenderingContext.DrawString(str, x, y + aAscent);
aRenderingContext.PopState(clipEmpty);
#ifdef DEBUG_PRINTING
PRINT_DEBUG_MSG2("Page: %p", this);
@ -605,9 +607,11 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
NS_ASSERTION(deviceContext, "Couldn't get the device context");
nsCOMPtr<nsIFontMetrics> fontMet;
deviceContext->GetMetricsFor(*mHeadFootFont, *getter_AddRefs(fontMet));
nscoord ascent = 0;
nscoord visibleHeight = 0;
if (fontMet) {
fontMet->GetHeight(visibleHeight);
fontMet->GetMaxAscent(ascent);
}
// print document headers and footers
@ -617,7 +621,7 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
mPrintOptions->GetHeaderStrRight(&headers[2]); // creates memory
DrawHeaderFooter(aRenderingContext, this, eHeader, nsIPrintOptions::kJustLeft,
nsAutoString(headers[0]), nsAutoString(headers[1]), nsAutoString(headers[2]),
rect, visibleHeight);
rect, ascent, visibleHeight);
PRInt32 i;
for (i=0;i<3;i++) nsMemory::Free(headers[i]);
@ -627,7 +631,7 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
mPrintOptions->GetFooterStrRight(&footers[2]); // creates memory
DrawHeaderFooter(aRenderingContext, this, eFooter, nsIPrintOptions::kJustRight,
nsAutoString(footers[0]), nsAutoString(footers[1]), nsAutoString(footers[2]),
rect, visibleHeight);
rect, ascent, visibleHeight);
for (i=0;i<3;i++) nsMemory::Free(footers[i]);
}

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

@ -112,6 +112,7 @@ protected:
const nsString& sStr,
const nsRect& aRect,
nscoord aHeight,
nscoord aAscent,
nscoord aWidth);
void DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
@ -122,6 +123,7 @@ protected:
const nsString& aStr2,
const nsString& aStr3,
const nsRect& aRect,
nscoord aAscent,
nscoord aHeight);
void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr);

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

@ -543,8 +543,8 @@ public:
mVisibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
deviceContext->GetMetricsFor(*plainFont, langGroup, mNormalFont);
aRenderingContext.SetFont(mNormalFont);
aRenderingContext.GetWidth(' ', mSpaceWidth);
aRenderingContext.SetFont(mNormalFont); // some users of the struct expect this state
mNormalFont->GetSpaceWidth(mSpaceWidth);
mAveCharWidth = 0;
#if defined(_WIN32) || defined(XP_OS2)
mNormalFont->GetAveCharWidth(mAveCharWidth);
@ -2253,7 +2253,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
// When there is no selection showing, use the fastest and
// simplest rendering approach
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
PaintTextDecorations(aRenderingContext, aStyleContext, aTextStyle,
dx, dy, width);
}
@ -2332,10 +2332,10 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
if (isPaginated && !iter.IsBeforeOrAfter()) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
} else if (!isPaginated) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(currentFGColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
}
#ifdef IBMBIDI
@ -2349,7 +2349,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
else if (!isPaginated)
{
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
}
PaintTextDecorations(aRenderingContext, aStyleContext,
aTextStyle, dx, dy, width, text, details,0,(PRUint32)textLength);
@ -2549,33 +2549,18 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
}
PRIntn* sp = sp0;
nscoord smallY = aY;
if (aTextStyle.mSmallCaps) {
nscoord normalAscent, smallAscent;
aTextStyle.mNormalFont->GetMaxAscent(normalAscent);
aTextStyle.mSmallFont->GetMaxAscent(smallAscent);
if (normalAscent > smallAscent) {
smallY = aY + normalAscent - smallAscent;
}
}
nsIFontMetrics* lastFont = aTextStyle.mLastFont;
nscoord lastY = aY;
if (lastFont == aTextStyle.mSmallFont) {
lastY = smallY;
}
PRInt32 pendingCount;
PRUnichar* runStart = bp;
nscoord charWidth, width = 0;
PRInt32 countSoFar = 0;
for (; --aLength >= 0; aBuffer++) {
nsIFontMetrics* nextFont;
nscoord nextY, glyphWidth;
nscoord glyphWidth;
PRUnichar ch = *aBuffer;
if (aTextStyle.mSmallCaps &&
(IsLowerCase(ch) || (ch == kSZLIG))) {
nextFont = aTextStyle.mSmallFont;
nextY = smallY;
PRUnichar upper_ch;
// German szlig should be expanded to "SS".
if (ch == kSZLIG)
@ -2601,7 +2586,6 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
}
else if (ch == ' ') {
nextFont = aTextStyle.mNormalFont;
nextY = aY;
glyphWidth = aTextStyle.mSpaceWidth + aTextStyle.mWordSpacing + aTextStyle.mLetterSpacing
+ aTextStyle.mExtraSpacePerSpace;
if ((PRUint32)--aTextStyle.mNumSpacesToRender <
@ -2619,7 +2603,6 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
aRenderingContext.GetWidth(ch, charWidth);
}
nextFont = aTextStyle.mNormalFont;
nextY = aY;
glyphWidth = charWidth + aTextStyle.mLetterSpacing;
}
if (nextFont != lastFont) {
@ -2627,8 +2610,8 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
if (0 != pendingCount) {
// Measure previous run of characters using the previous font
//aRenderingContext.SetColor(aTextStyle.mColor->mColor); commenting out redundat(and destructive) call to setcolor
aRenderingContext.DrawString2(runStart, pendingCount,
aX, aY/*lastY*/ + mAscent, -1,
aRenderingContext.DrawString(runStart, pendingCount,
aX, aY + mAscent, -1,
spacing ? sp0 : nsnull);
// Note: use aY not small-y so that decorations are drawn with
@ -2644,7 +2627,6 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
}
aRenderingContext.SetFont(nextFont);
lastFont = nextFont;
lastY = nextY;
}
*bp++ = ch;
*sp++ = glyphWidth;
@ -2653,7 +2635,7 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
pendingCount = bp - runStart;
if (0 != pendingCount) {
// Measure previous run of characters using the previous font
aRenderingContext.DrawString2(runStart, pendingCount, aX, aY/*lastY*/ + mAscent, -1,
aRenderingContext.DrawString(runStart, pendingCount, aX, aY + mAscent, -1,
spacing ? sp0 : nsnull);
// Note: use aY not small-y so that decorations are drawn with
@ -3110,7 +3092,7 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
// When there is no selection showing, use the fastest and
// simplest rendering approach
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
PaintTextDecorations(aRenderingContext, aStyleContext, aTextStyle,
dx, dy, width);
}
@ -3168,10 +3150,10 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
if (isPaginated && !iter.IsBeforeOrAfter()) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
} else if (!isPaginated) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(currentFGColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
}
currentX+=newWidth;//increment twips X start
@ -3182,7 +3164,7 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
else if (!isPaginated)
{
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
}
PaintTextDecorations(aRenderingContext, aStyleContext,
aTextStyle, dx, dy, width,

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

@ -322,13 +322,17 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
aPresContext->GetMetricsFor(myFont->mFont, getter_AddRefs(fm));
GetListItemText(aPresContext, *myList, text);
aRenderingContext.SetFont(fm);
aRenderingContext.DrawString(text, mPadding.left, mPadding.top);
nscoord ascent;
fm->GetMaxAscent(ascent);
aRenderingContext.DrawString(text, mPadding.left, mPadding.top + ascent);
break;
}
#ifdef IBMBIDI
if (charType != eCharType_LeftToRight) {
aPresContext->GetMetricsFor(myFont->mFont, getter_AddRefs(fm));
aRenderingContext.SetFont(fm);
nscoord ascent;
fm->GetMaxAscent(ascent);
nsBidiPresUtils* bidiUtils;
aPresContext->GetBidiUtils(&bidiUtils);
@ -347,7 +351,7 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
charType, level, isBidiSystem);//Mohamed
}
}
aRenderingContext.DrawString(text, mPadding.left, mPadding.top);
aRenderingContext.DrawString(text, mPadding.left, mPadding.top + ascent);
}
#endif // IBMBIDI
}

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

@ -892,7 +892,8 @@ nsImageFrame::DisplayAltText(nsIPresContext* aPresContext,
nsIFontMetrics* fm;
aRenderingContext.GetFontMetrics(fm);
nscoord maxDescent, height;
nscoord maxAscent, maxDescent, height;
fm->GetMaxAscent(maxAscent);
fm->GetMaxDescent(maxDescent);
fm->GetHeight(height);
@ -908,7 +909,7 @@ nsImageFrame::DisplayAltText(nsIPresContext* aPresContext,
MeasureString(str, strLen, aRect.width, maxFit, aRenderingContext);
// Display the text
aRenderingContext.DrawString(str, maxFit, aRect.x, y);
aRenderingContext.DrawString(str, maxFit, aRect.x, y + maxAscent);
// Move to the next line
str += maxFit;

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

@ -421,6 +421,7 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
const nsString& aStr2,
const nsString& aStr3,
const nsRect& aRect,
nscoord aAscent,
nscoord aHeight)
{
PRInt32 numStrs = 0;
@ -432,13 +433,13 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
nscoord strSpace = aRect.width / numStrs;
if (!aStr1.IsEmpty()) {
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustLeft, aStr1, aRect, aHeight, strSpace);
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustLeft, aStr1, aRect, aAscent, aHeight, strSpace);
}
if (!aStr2.IsEmpty()) {
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustCenter, aStr2, aRect, aHeight, strSpace);
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustCenter, aStr2, aRect, aAscent, aHeight, strSpace);
}
if (!aStr3.IsEmpty()) {
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustRight, aStr3, aRect, aHeight, strSpace);
DrawHeaderFooter(aRenderingContext, aFrame, aHeaderFooter, nsIPrintOptions::kJustRight, aStr3, aRect, aAscent, aHeight, strSpace);
}
}
@ -458,6 +459,7 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
PRInt32 aJust,
const nsString& aStr,
const nsRect& aRect,
nscoord aAscent,
nscoord aHeight,
nscoord aWidth)
{
@ -507,7 +509,7 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
PRBool clipEmpty;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty);
aRenderingContext.DrawString(str, x, y);
aRenderingContext.DrawString(str, x, y + aAscent);
aRenderingContext.PopState(clipEmpty);
#ifdef DEBUG_PRINTING
PRINT_DEBUG_MSG2("Page: %p", this);
@ -605,9 +607,11 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
NS_ASSERTION(deviceContext, "Couldn't get the device context");
nsCOMPtr<nsIFontMetrics> fontMet;
deviceContext->GetMetricsFor(*mHeadFootFont, *getter_AddRefs(fontMet));
nscoord ascent = 0;
nscoord visibleHeight = 0;
if (fontMet) {
fontMet->GetHeight(visibleHeight);
fontMet->GetMaxAscent(ascent);
}
// print document headers and footers
@ -617,7 +621,7 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
mPrintOptions->GetHeaderStrRight(&headers[2]); // creates memory
DrawHeaderFooter(aRenderingContext, this, eHeader, nsIPrintOptions::kJustLeft,
nsAutoString(headers[0]), nsAutoString(headers[1]), nsAutoString(headers[2]),
rect, visibleHeight);
rect, ascent, visibleHeight);
PRInt32 i;
for (i=0;i<3;i++) nsMemory::Free(headers[i]);
@ -627,7 +631,7 @@ nsPageFrame::Paint(nsIPresContext* aPresContext,
mPrintOptions->GetFooterStrRight(&footers[2]); // creates memory
DrawHeaderFooter(aRenderingContext, this, eFooter, nsIPrintOptions::kJustRight,
nsAutoString(footers[0]), nsAutoString(footers[1]), nsAutoString(footers[2]),
rect, visibleHeight);
rect, ascent, visibleHeight);
for (i=0;i<3;i++) nsMemory::Free(footers[i]);
}

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

@ -112,6 +112,7 @@ protected:
const nsString& sStr,
const nsRect& aRect,
nscoord aHeight,
nscoord aAscent,
nscoord aWidth);
void DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
@ -122,6 +123,7 @@ protected:
const nsString& aStr2,
const nsString& aStr3,
const nsRect& aRect,
nscoord aAscent,
nscoord aHeight);
void ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr);

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

@ -7283,14 +7283,15 @@ void ReflowCountMgr::PaintCount(const char * aName,
aRenderingContext->SetFont(fm);
char buf[16];
sprintf(buf, "%d", counter->mCount);
nscoord x = 0, y;
nscoord width, height;
aRenderingContext->GetWidth((char*)buf, width);
fm->GetHeight(height);
fm->GetMaxAscent(y);
nsRect r;
aFrame->GetRect(r);
nscoord x = 0;
PRUint32 color;
PRUint32 color2;
if (aColor != 0) {
@ -7314,9 +7315,9 @@ void ReflowCountMgr::PaintCount(const char * aName,
aRenderingContext->SetColor(NS_RGB(0,0,0));
aRenderingContext->FillRect(rect);
aRenderingContext->SetColor(color2);
aRenderingContext->DrawString(buf, strlen(buf), x+15,15);
aRenderingContext->DrawString(buf, strlen(buf), x+15,y+15);
aRenderingContext->SetColor(color);
aRenderingContext->DrawString(buf, strlen(buf), x,0);
aRenderingContext->DrawString(buf, strlen(buf), x,y);
PRBool clipEmpty;
aRenderingContext->PopState(clipEmpty);

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

@ -543,8 +543,8 @@ public:
mVisibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
deviceContext->GetMetricsFor(*plainFont, langGroup, mNormalFont);
aRenderingContext.SetFont(mNormalFont);
aRenderingContext.GetWidth(' ', mSpaceWidth);
aRenderingContext.SetFont(mNormalFont); // some users of the struct expect this state
mNormalFont->GetSpaceWidth(mSpaceWidth);
mAveCharWidth = 0;
#if defined(_WIN32) || defined(XP_OS2)
mNormalFont->GetAveCharWidth(mAveCharWidth);
@ -2253,7 +2253,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
// When there is no selection showing, use the fastest and
// simplest rendering approach
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
PaintTextDecorations(aRenderingContext, aStyleContext, aTextStyle,
dx, dy, width);
}
@ -2332,10 +2332,10 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
if (isPaginated && !iter.IsBeforeOrAfter()) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
} else if (!isPaginated) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(currentFGColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
}
#ifdef IBMBIDI
@ -2349,7 +2349,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
else if (!isPaginated)
{
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
}
PaintTextDecorations(aRenderingContext, aStyleContext,
aTextStyle, dx, dy, width, text, details,0,(PRUint32)textLength);
@ -2549,33 +2549,18 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
}
PRIntn* sp = sp0;
nscoord smallY = aY;
if (aTextStyle.mSmallCaps) {
nscoord normalAscent, smallAscent;
aTextStyle.mNormalFont->GetMaxAscent(normalAscent);
aTextStyle.mSmallFont->GetMaxAscent(smallAscent);
if (normalAscent > smallAscent) {
smallY = aY + normalAscent - smallAscent;
}
}
nsIFontMetrics* lastFont = aTextStyle.mLastFont;
nscoord lastY = aY;
if (lastFont == aTextStyle.mSmallFont) {
lastY = smallY;
}
PRInt32 pendingCount;
PRUnichar* runStart = bp;
nscoord charWidth, width = 0;
PRInt32 countSoFar = 0;
for (; --aLength >= 0; aBuffer++) {
nsIFontMetrics* nextFont;
nscoord nextY, glyphWidth;
nscoord glyphWidth;
PRUnichar ch = *aBuffer;
if (aTextStyle.mSmallCaps &&
(IsLowerCase(ch) || (ch == kSZLIG))) {
nextFont = aTextStyle.mSmallFont;
nextY = smallY;
PRUnichar upper_ch;
// German szlig should be expanded to "SS".
if (ch == kSZLIG)
@ -2601,7 +2586,6 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
}
else if (ch == ' ') {
nextFont = aTextStyle.mNormalFont;
nextY = aY;
glyphWidth = aTextStyle.mSpaceWidth + aTextStyle.mWordSpacing + aTextStyle.mLetterSpacing
+ aTextStyle.mExtraSpacePerSpace;
if ((PRUint32)--aTextStyle.mNumSpacesToRender <
@ -2619,7 +2603,6 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
aRenderingContext.GetWidth(ch, charWidth);
}
nextFont = aTextStyle.mNormalFont;
nextY = aY;
glyphWidth = charWidth + aTextStyle.mLetterSpacing;
}
if (nextFont != lastFont) {
@ -2627,8 +2610,8 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
if (0 != pendingCount) {
// Measure previous run of characters using the previous font
//aRenderingContext.SetColor(aTextStyle.mColor->mColor); commenting out redundat(and destructive) call to setcolor
aRenderingContext.DrawString2(runStart, pendingCount,
aX, aY/*lastY*/ + mAscent, -1,
aRenderingContext.DrawString(runStart, pendingCount,
aX, aY + mAscent, -1,
spacing ? sp0 : nsnull);
// Note: use aY not small-y so that decorations are drawn with
@ -2644,7 +2627,6 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
}
aRenderingContext.SetFont(nextFont);
lastFont = nextFont;
lastY = nextY;
}
*bp++ = ch;
*sp++ = glyphWidth;
@ -2653,7 +2635,7 @@ nsTextFrame::RenderString(nsIRenderingContext& aRenderingContext,
pendingCount = bp - runStart;
if (0 != pendingCount) {
// Measure previous run of characters using the previous font
aRenderingContext.DrawString2(runStart, pendingCount, aX, aY/*lastY*/ + mAscent, -1,
aRenderingContext.DrawString(runStart, pendingCount, aX, aY + mAscent, -1,
spacing ? sp0 : nsnull);
// Note: use aY not small-y so that decorations are drawn with
@ -3110,7 +3092,7 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
// When there is no selection showing, use the fastest and
// simplest rendering approach
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
PaintTextDecorations(aRenderingContext, aStyleContext, aTextStyle,
dx, dy, width);
}
@ -3168,10 +3150,10 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
if (isPaginated && !iter.IsBeforeOrAfter()) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
} else if (!isPaginated) {
aRenderingContext.SetColor(nsCSSRendering::TransformColor(currentFGColor,isPaginated));
aRenderingContext.DrawString2(currenttext, currentlength, currentX, dy + mAscent);
aRenderingContext.DrawString(currenttext, currentlength, currentX, dy + mAscent);
}
currentX+=newWidth;//increment twips X start
@ -3182,7 +3164,7 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
else if (!isPaginated)
{
aRenderingContext.SetColor(nsCSSRendering::TransformColor(aTextStyle.mColor->mColor,isPaginated));
aRenderingContext.DrawString2(text, PRUint32(textLength), dx, dy + mAscent);
aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy + mAscent);
}
PaintTextDecorations(aRenderingContext, aStyleContext,
aTextStyle, dx, dy, width,

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

@ -247,7 +247,6 @@ public:
void
DrawGlyph(nsIRenderingContext& aRenderingContext,
nsFont& aFont,
nscoord aFontAscent,
nsGlyphCode& aGlyphCode,
nscoord aX,
nscoord aY,
@ -555,7 +554,6 @@ nsGlyphTable::GetBoundingMetrics(nsIRenderingContext& aRenderingContext,
void
nsGlyphTable::DrawGlyph(nsIRenderingContext& aRenderingContext,
nsFont& aFont,
nscoord aFontAscent,
nsGlyphCode& aGlyphCode,
nscoord aX,
nscoord aY,
@ -570,13 +568,6 @@ nsGlyphTable::DrawGlyph(nsIRenderingContext& aRenderingContext,
// glyph not associated to our primary font, it comes from an external font
mFontName.StringAt(aGlyphCode.font, aFont.name);
aRenderingContext.SetFont(aFont);
// Now the font is different, the ascent may have changed, so we need to
// compensate any change to keep the glyph aligned as expected by the caller
nscoord fontAscent;
nsCOMPtr<nsIFontMetrics> fm;
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
fm->GetMaxAscent(fontAscent);
aY += aFontAscent - fontAscent;
}
//if (mType == NS_TABLE_TYPE_UNICODE)
@ -951,12 +942,12 @@ InitGlobals()
}
// Allocate the placeholders for the preferred parts and variants
nsGlyphTableList::gParts = new PRInt32[count];
if (nsGlyphTableList::gParts) {
nsGlyphTableList::gVariants = new PRInt32[count];
if (!nsGlyphTableList::gVariants) {
delete nsGlyphTableList::gParts;
return NS_ERROR_OUT_OF_MEMORY;
}
if (!nsGlyphTableList::gParts)
return NS_ERROR_OUT_OF_MEMORY;
nsGlyphTableList::gVariants = new PRInt32[count];
if (!nsGlyphTableList::gVariants) {
delete nsGlyphTableList::gParts;
return NS_ERROR_OUT_OF_MEMORY;
}
PRInt32 i;
for (i = 0; i < count; i++) {
@ -1733,8 +1724,6 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext,
aRenderingContext.SetColor(color->mColor);
nsAutoString fontName;
nscoord fontAscent;
nsCOMPtr<nsIFontMetrics> fm;
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
styleContext->GetStyleData(eStyleStruct_Font));
nsFont theFont(font->mFont);
@ -1749,26 +1738,21 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext,
SetFirstFamily(theFont, fontName); // to force precedence on this TeX font
}
aRenderingContext.SetFont(theFont);
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
fm->GetMaxAscent(fontAscent);
//printf("Painting %04X like a normal char\n", mData[0]);
//aRenderingContext.SetColor(NS_RGB(255,0,0));
aRenderingContext.DrawString(mData.get(), len, mRect.x,
mRect.y - (fontAscent - mBoundingMetrics.ascent));
aRenderingContext.DrawString(mData.get(), len, mRect.x, mRect.y + mBoundingMetrics.ascent);
}
else {
// Set the stretchy font and grab some metrics to adjust the placements ...
mGlyphTable->GetPrimaryFontName(fontName);
SetFirstFamily(theFont, fontName);
aRenderingContext.SetFont(theFont);
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
fm->GetMaxAscent(fontAscent);
// if there is a glyph of appropriate size, paint that glyph
if (mGlyph) {
//printf("Painting %04X with a glyph of appropriate size\n", mData[0]);
//aRenderingContext.SetColor(NS_RGB(0,0,255));
mGlyphTable->DrawGlyph(aRenderingContext, theFont, fontAscent, mGlyph,
mRect.x, mRect.y - (fontAscent - mBoundingMetrics.ascent));
mGlyphTable->DrawGlyph(aRenderingContext, theFont, mGlyph,
mRect.x, mRect.y + mBoundingMetrics.ascent);
}
else { // paint by parts
// see if this is a composite char and let children paint themselves
@ -1783,11 +1767,11 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext,
}
//aRenderingContext.SetColor(NS_RGB(0,255,0));
if (NS_STRETCH_DIRECTION_VERTICAL == mDirection)
rv = PaintVertically(aPresContext, aRenderingContext, theFont, fontAscent,
styleContext, mGlyphTable, this, mRect);
rv = PaintVertically(aPresContext, aRenderingContext, theFont, styleContext,
mGlyphTable, this, mRect);
else if (NS_STRETCH_DIRECTION_HORIZONTAL == mDirection)
rv = PaintHorizontally(aPresContext, aRenderingContext, theFont, fontAscent,
styleContext, mGlyphTable, this, mRect);
rv = PaintHorizontally(aPresContext, aRenderingContext, theFont, styleContext,
mGlyphTable, this, mRect);
}
}
}
@ -1803,7 +1787,6 @@ nsresult
nsMathMLChar::PaintVertically(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsFont& aFont,
nscoord aFontAscent,
nsIStyleContext* aStyleContext,
nsGlyphTable* aGlyphTable,
nsMathMLChar* aChar,
@ -1852,21 +1835,20 @@ nsMathMLChar::PaintVertically(nsIPresContext* aPresContext,
ch = chdata[i];
bm = bmdata[i];
if (0 == i) { // top
dy = aRect.y - aFontAscent + bm.ascent;
dy = aRect.y + bm.ascent;
}
else if (1 == i) { // middle
dy = aRect.y - aFontAscent + bm.ascent +
(aRect.height - (bm.ascent + bm.descent))/2;
dy = aRect.y + bm.ascent + (aRect.height - (bm.ascent + bm.descent))/2;
}
else { // bottom
dy = aRect.y - aFontAscent + aRect.height - bm.descent;
dy = aRect.y + aRect.height - bm.descent;
}
// abcissa passed to DrawString
offset[i] = dy;
// *exact* abcissa where the *top-most* pixel of the glyph is painted
start[i] = dy + aFontAscent - bm.ascent;
start[i] = dy - bm.ascent;
// *exact* abcissa where the *bottom-most* pixel of the glyph is painted
end[i] = dy + aFontAscent + bm.descent; // end = start + height
end[i] = dy + bm.descent; // end = start + height
}
/////////////////////////////////////
@ -1892,8 +1874,7 @@ nsMathMLChar::PaintVertically(nsIPresContext* aPresContext,
}
if (!clipRect.IsEmpty()) {
clipRect.Inflate(onePixel, onePixel);
aGlyphTable->DrawGlyph(aRenderingContext, aFont, aFontAscent,
ch, dx, dy, &clipRect);
aGlyphTable->DrawGlyph(aRenderingContext, aFont, ch, dx, dy, &clipRect);
}
}
}
@ -1955,7 +1936,7 @@ nsMathMLChar::PaintVertically(nsIPresContext* aPresContext,
aRenderingContext.PushState();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState);
bm = bmdata[i];
while (dy + aFontAscent + bm.descent < start[i+1]) {
while (dy + bm.descent < start[i+1]) {
if (2 > count) {
stride = bm.descent;
bm = bmdata[3]; // glue
@ -1963,8 +1944,7 @@ nsMathMLChar::PaintVertically(nsIPresContext* aPresContext,
}
count++;
dy += stride;
aGlyphTable->DrawGlyph(aRenderingContext, aFont, aFontAscent,
glue, dx, dy);
aGlyphTable->DrawGlyph(aRenderingContext, aFont, glue, dx, dy);
// NS_ASSERTION(5000 == count, "Error - glyph table is incorrectly set");
if (1000 == count) return NS_ERROR_UNEXPECTED;
}
@ -1973,7 +1953,7 @@ nsMathMLChar::PaintVertically(nsIPresContext* aPresContext,
// last glyph that may cross past its boundary and collide with the next
nscoord height = bm.ascent + bm.descent;
aRenderingContext.SetColor(NS_RGB(0,255,0));
aRenderingContext.DrawRect(nsRect(dx, dy+aFontAscent-bm.ascent, width, height));
aRenderingContext.DrawRect(nsRect(dx, dy-bm.ascent, width, height));
#endif
}
}
@ -1985,7 +1965,6 @@ nsresult
nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsFont& aFont,
nscoord aFontAscent,
nsIStyleContext* aStyleContext,
nsGlyphTable* aGlyphTable,
nsMathMLChar* aChar,
@ -2004,7 +1983,7 @@ nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext,
nsGlyphCode ch, chdata[4];
nsBoundingMetrics bm, bmdata[4];
nscoord stride, offset[3], start[3], end[3];
dy = aRect.y - aFontAscent;
dy = aRect.y;
nsGlyphCode glue = aGlyphTable->GlueOf(aPresContext, aChar);
for (i = 0; i < 4; i++) {
switch (i) {
@ -2024,8 +2003,8 @@ nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext,
NS_WARNING("GetBoundingMetrics failed");
return rv;
}
if (dy < aRect.y - aFontAscent + bm.ascent) {
dy = aRect.y - aFontAscent + bm.ascent;
if (dy < aRect.y + bm.ascent) {
dy = aRect.y + bm.ascent;
}
}
chdata[i] = ch;
@ -2059,7 +2038,7 @@ nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext,
if (ch) {
#ifdef SHOW_BORDERS
aRenderingContext.SetColor(NS_RGB(255,0,0));
aRenderingContext.DrawRect(nsRect(start[i], dy + aFontAscent - bmdata[i].ascent,
aRenderingContext.DrawRect(nsRect(start[i], dy - bmdata[i].ascent,
end[i] - start[i], bmdata[i].ascent + bmdata[i].descent));
#endif
dx = offset[i];
@ -2074,8 +2053,7 @@ nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext,
}
if (!clipRect.IsEmpty()) {
clipRect.Inflate(onePixel, onePixel);
aGlyphTable->DrawGlyph(aRenderingContext, aFont, aFontAscent,
ch, dx, dy, &clipRect);
aGlyphTable->DrawGlyph(aRenderingContext, aFont, ch, dx, dy, &clipRect);
}
}
}
@ -2114,7 +2092,7 @@ nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext,
}
// paint the rule between the parts
aRenderingContext.FillRect(end[first] - onePixel,
dy + aFontAscent - ascent,
dy - ascent,
start[last] - end[first] + 2*onePixel,
ascent + descent);
first = last;
@ -2144,8 +2122,7 @@ nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext,
}
count++;
dx += stride;
aGlyphTable->DrawGlyph(aRenderingContext, aFont, aFontAscent,
glue, dx, dy);
aGlyphTable->DrawGlyph(aRenderingContext, aFont, glue, dx, dy);
// NS_ASSERTION(5000 == count, "Error - glyph table is incorrectly set");
if (1000 == count) return NS_ERROR_UNEXPECTED;
}

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

@ -180,7 +180,6 @@ private:
PaintVertically(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsFont& aFont,
nscoord aFontAscent,
nsIStyleContext* aStyleContext,
nsGlyphTable* aGlyphTable,
nsMathMLChar* aChar,
@ -190,7 +189,6 @@ private:
PaintHorizontally(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nsFont& aFont,
nscoord aFontAscent,
nsIStyleContext* aStyleContext,
nsGlyphTable* aGlyphTable,
nsMathMLChar* aChar,

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

@ -432,10 +432,15 @@ nsMathMLContainerFrame::PaintError(nsIPresContext* aPresContext,
aRenderingContext.SetColor(color->mColor);
aRenderingContext.SetFont(font->mFont);
nscoord ascent;
nsCOMPtr<nsIFontMetrics> fm;
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
fm->GetMaxAscent(ascent);
nsAutoString errorMsg(PRUnichar(0xFFFD));
aRenderingContext.DrawString(errorMsg.get(),
PRUint32(errorMsg.Length()),
mRect.x, mRect.y);
mRect.x, mRect.y + ascent);
}
return NS_OK;
}

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

@ -374,13 +374,13 @@ nsTextBoxFrame::PaintTitle(nsIPresContext* aPresContext,
nscoord offset;
nscoord size;
nscoord baseline;
if (decorations & (NS_FONT_DECORATION_OVERLINE | NS_FONT_DECORATION_UNDERLINE)) {
nsCOMPtr<nsIDeviceContext> deviceContext;
aPresContext->GetDeviceContext(getter_AddRefs(deviceContext));
nsCOMPtr<nsIDeviceContext> deviceContext;
nsCOMPtr<nsIFontMetrics> fontMet;
aPresContext->GetDeviceContext(getter_AddRefs(deviceContext));
deviceContext->GetMetricsFor(fontStyle->mFont, *getter_AddRefs(fontMet));
fontMet->GetMaxAscent(baseline);
nsCOMPtr<nsIFontMetrics> fontMet;
deviceContext->GetMetricsFor(fontStyle->mFont, *getter_AddRefs(fontMet));
fontMet->GetMaxAscent(baseline);
if (decorations & (NS_FONT_DECORATION_OVERLINE | NS_FONT_DECORATION_UNDERLINE)) {
fontMet->GetUnderline(offset, size);
if (decorations & NS_FONT_DECORATION_OVERLINE) {
aRenderingContext.SetColor(overColor);
@ -392,12 +392,6 @@ nsTextBoxFrame::PaintTitle(nsIPresContext* aPresContext,
}
}
if (decorations & NS_FONT_DECORATION_LINE_THROUGH) {
nsCOMPtr<nsIDeviceContext> deviceContext;
aPresContext->GetDeviceContext(getter_AddRefs(deviceContext));
nsCOMPtr<nsIFontMetrics> fontMet;
deviceContext->GetMetricsFor(fontStyle->mFont, *getter_AddRefs(fontMet));
fontMet->GetMaxAscent(baseline);
fontMet->GetStrikeout(offset, size);
aRenderingContext.SetColor(strikeColor);
aRenderingContext.FillRect(textRect.x, textRect.y + baseline - offset, mRect.width, size);
@ -472,7 +466,7 @@ nsTextBoxFrame::PaintTitle(nsIPresContext* aPresContext,
aRenderingContext.GetWidth(buffer + start, length, width, nsnull);
aRenderingContext.DrawString(buffer + start, length, textRect.x,
textRect.y, width);
textRect.y + baseline, width);
textRect.x += width;
} // for
// Restore original x (for aRenderingContext.FillRect below),
@ -488,7 +482,7 @@ nsTextBoxFrame::PaintTitle(nsIPresContext* aPresContext,
} // frame is bidi
if (NS_FAILED(rv) )
#endif // IBMBIDI
aRenderingContext.DrawString(mCroppedTitle, textRect.x, textRect.y);
aRenderingContext.DrawString(mCroppedTitle, textRect.x, textRect.y + baseline);
if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) {
aRenderingContext.FillRect(textRect.x + mAccessKeyInfo->mBeforeWidth,

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

@ -2090,8 +2090,9 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex,
nsCOMPtr<nsIFontMetrics> fontMet;
deviceContext->GetMetricsFor(fontStyle->mFont, *getter_AddRefs(fontMet));
nscoord height;
nscoord height, baseline;
fontMet->GetHeight(height);
fontMet->GetMaxAscent(baseline);
// Center the text. XXX Obey vertical-align style prop?
if (height < textRect.height) {
@ -2181,7 +2182,7 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex,
const nsStyleColor* colorStyle = (const nsStyleColor*)textContext->GetStyleData(eStyleStruct_Color);
aRenderingContext.SetColor(colorStyle->mColor);
aRenderingContext.DrawString(realText, textRect.x, textRect.y);
aRenderingContext.DrawString(realText, textRect.x, textRect.y + baseline);
}
return NS_OK;

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

@ -2090,8 +2090,9 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex,
nsCOMPtr<nsIFontMetrics> fontMet;
deviceContext->GetMetricsFor(fontStyle->mFont, *getter_AddRefs(fontMet));
nscoord height;
nscoord height, baseline;
fontMet->GetHeight(height);
fontMet->GetMaxAscent(baseline);
// Center the text. XXX Obey vertical-align style prop?
if (height < textRect.height) {
@ -2181,7 +2182,7 @@ NS_IMETHODIMP nsOutlinerBodyFrame::PaintText(int aRowIndex,
const nsStyleColor* colorStyle = (const nsStyleColor*)textContext->GetStyleData(eStyleStruct_Color);
aRenderingContext.SetColor(colorStyle->mColor);
aRenderingContext.DrawString(realText, textRect.x, textRect.y);
aRenderingContext.DrawString(realText, textRect.x, textRect.y + baseline);
}
return NS_OK;

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

@ -291,7 +291,7 @@ NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext,
nscoord x = ((rect.width - textWidth) / 2) + rect.x;
nscoord y = ((rect.height - textHeight) / 2) + rect.y;
aRenderingContext.DrawString(mLabel, x, y);
aRenderingContext.DrawString(mLabel, x, y + textHeight);
NS_RELEASE(context);

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

@ -310,14 +310,14 @@ NS_METHOD nsTextWidget::Paint(nsIRenderingContext& aRenderingContext,
nscoord y = ((rect.height - textHeight) / 2) + rect.y;
aRenderingContext.SetColor(txtFGColor);
if (!mIsPassword) {
aRenderingContext.DrawString(mText, x, y);
aRenderingContext.DrawString(mText, x, y + textHeight);
} else {
nsString astricks;
PRUint32 i;
for (i=0;i<mText.Length();i++) {
astricks.AppendWithConversion("*");
}
aRenderingContext.DrawString(astricks, x, y);
aRenderingContext.DrawString(astricks, x, y + textHeight);
}