зеркало из https://github.com/mozilla/pjs.git
Bug 174055, part 7: remove unnecessary members from nsFontMetrics.
This commit is contained in:
Родитель
100dba00ae
Коммит
cae4281327
|
@ -67,7 +67,7 @@ public:
|
|||
private:
|
||||
static PRUint32 ComputeFlags(nsFontMetrics* aMetrics) {
|
||||
PRUint32 flags = 0;
|
||||
if (aMetrics->GetRightToLeftTextRunMode()) {
|
||||
if (aMetrics->GetTextRunRTL()) {
|
||||
flags |= gfxTextRunFactory::TEXT_IS_RTL;
|
||||
}
|
||||
return flags;
|
||||
|
@ -93,16 +93,14 @@ public:
|
|||
} // anon namespace
|
||||
|
||||
nsFontMetrics::nsFontMetrics()
|
||||
: mDeviceContext(nsnull), mP2A(-1), mTextRunRTL(PR_FALSE)
|
||||
{
|
||||
mFontStyle = nsnull;
|
||||
mFontGroup = nsnull;
|
||||
}
|
||||
|
||||
nsFontMetrics::~nsFontMetrics()
|
||||
{
|
||||
if (mDeviceContext)
|
||||
mDeviceContext->FontMetricsDeleted(this);
|
||||
delete mFontStyle;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -110,26 +108,26 @@ nsFontMetrics::Init(const nsFont& aFont, nsIAtom* aLanguage,
|
|||
nsIDeviceContext *aContext,
|
||||
gfxUserFontSet *aUserFontSet)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mP2A == -1, "already initialized");
|
||||
|
||||
mFont = aFont;
|
||||
mLanguage = aLanguage;
|
||||
mDeviceContext = (nsThebesDeviceContext*)aContext;
|
||||
mP2A = mDeviceContext->AppUnitsPerDevPixel();
|
||||
mIsRightToLeft = PR_FALSE;
|
||||
mTextRunRTL = PR_FALSE;
|
||||
|
||||
gfxFloat size = gfxFloat(aFont.size) / mP2A;
|
||||
gfxFontStyle style(aFont.style,
|
||||
aFont.weight,
|
||||
aFont.stretch,
|
||||
gfxFloat(aFont.size) / mP2A,
|
||||
aLanguage,
|
||||
aFont.sizeAdjust,
|
||||
aFont.systemFont,
|
||||
mDeviceContext->IsPrinterSurface(),
|
||||
aFont.featureSettings,
|
||||
aFont.languageOverride);
|
||||
|
||||
PRBool printerFont = mDeviceContext->IsPrinterSurface();
|
||||
mFontStyle = new gfxFontStyle(aFont.style, aFont.weight, aFont.stretch,
|
||||
size, aLanguage,
|
||||
aFont.sizeAdjust, aFont.systemFont,
|
||||
printerFont,
|
||||
aFont.featureSettings,
|
||||
aFont.languageOverride);
|
||||
|
||||
mFontGroup =
|
||||
gfxPlatform::GetPlatform()->CreateFontGroup(aFont.name, mFontStyle,
|
||||
aUserFontSet);
|
||||
mFontGroup = gfxPlatform::GetPlatform()->
|
||||
CreateFontGroup(aFont.name, &style, aUserFontSet);
|
||||
if (mFontGroup->FontListLength() < 1)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
|
|
@ -224,12 +224,8 @@ public:
|
|||
nsRenderingContext *aContext);
|
||||
#endif /* MOZ_MATHML */
|
||||
|
||||
// Set the direction of the text rendering
|
||||
void SetRightToLeftText(PRBool aIsRTL) { mIsRightToLeft = aIsRTL; }
|
||||
PRBool GetRightToLeftText() { return mIsRightToLeft; }
|
||||
|
||||
void SetTextRunRTL(PRBool aIsRTL) { mTextRunRTL = aIsRTL; }
|
||||
PRBool GetRightToLeftTextRunMode() { return mTextRunRTL; }
|
||||
PRBool GetTextRunRTL() { return mTextRunRTL; }
|
||||
|
||||
gfxFontGroup* GetThebesFontGroup() { return mFontGroup; }
|
||||
gfxUserFontSet* GetUserFontSet() { return mFontGroup->GetUserFontSet(); }
|
||||
|
@ -239,13 +235,11 @@ public:
|
|||
protected:
|
||||
const gfxFont::Metrics& GetMetrics() const;
|
||||
|
||||
nsFont mFont; // The font for this metrics object.
|
||||
nsFont mFont;
|
||||
nsRefPtr<gfxFontGroup> mFontGroup;
|
||||
gfxFontStyle *mFontStyle;
|
||||
nsThebesDeviceContext *mDeviceContext;
|
||||
nsCOMPtr<nsIAtom> mLanguage;
|
||||
nsThebesDeviceContext *mDeviceContext;
|
||||
PRInt32 mP2A;
|
||||
PRPackedBool mIsRightToLeft;
|
||||
PRPackedBool mTextRunRTL;
|
||||
};
|
||||
|
||||
|
|
|
@ -448,12 +448,6 @@ nsRenderingContext::FillPolygon(const nsPoint twPoints[], PRInt32 aNumPoints)
|
|||
// text
|
||||
//
|
||||
|
||||
void
|
||||
nsRenderingContext::SetRightToLeftText(PRBool aIsRTL)
|
||||
{
|
||||
mFontMetrics->SetRightToLeftText(aIsRTL);
|
||||
}
|
||||
|
||||
void
|
||||
nsRenderingContext::SetTextRunRTL(PRBool aIsRTL)
|
||||
{
|
||||
|
@ -607,7 +601,7 @@ nsRenderingContext::DrawString(const PRUnichar *aString, PRUint32 aLength,
|
|||
return;
|
||||
}
|
||||
|
||||
PRBool isRTL = mFontMetrics->GetRightToLeftText();
|
||||
PRBool isRTL = mFontMetrics->GetTextRunRTL();
|
||||
|
||||
// If we're drawing right to left, we must start at the end.
|
||||
if (isRTL) {
|
||||
|
|
|
@ -123,7 +123,6 @@ public:
|
|||
void SetFont(nsFontMetrics *aFontMetrics);
|
||||
nsFontMetrics *FontMetrics() { return mFontMetrics; } // may be null
|
||||
|
||||
void SetRightToLeftText(PRBool aIsRTL);
|
||||
void SetTextRunRTL(PRBool aIsRTL);
|
||||
|
||||
nscoord GetWidth(char aC);
|
||||
|
|
|
@ -1764,7 +1764,7 @@ public:
|
|||
|
||||
~nsIRenderingContextBidiProcessor()
|
||||
{
|
||||
mCtx->SetRightToLeftText(PR_FALSE);
|
||||
mCtx->SetTextRunRTL(PR_FALSE);
|
||||
}
|
||||
|
||||
virtual void SetText(const PRUnichar* aText,
|
||||
|
|
Загрузка…
Ссылка в новой задаче