#142562 problem with <td align=right or align=center
We are observing langGroup in some place while ignor it in others. This patch make all font metrics call consistent. nsIRenderingContext API is change to make things neat. r=rbs, sr=waterson git-svn-id: svn://10.0.0.236/trunk@122131 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -589,7 +589,7 @@ nsGlyphTable::GetBoundingMetrics(nsIRenderingContext& aRenderingContext,
|
||||
if (aGlyphCode.font) {
|
||||
// glyph not associated to our primary font, it comes from an external font
|
||||
mFontName.StringAt(aGlyphCode.font, aFont.name);
|
||||
aRenderingContext.SetFont(aFont);
|
||||
aRenderingContext.SetFont(aFont, nsnull);
|
||||
}
|
||||
|
||||
//if (mType == NS_TABLE_TYPE_UNICODE)
|
||||
@@ -601,7 +601,7 @@ nsGlyphTable::GetBoundingMetrics(nsIRenderingContext& aRenderingContext,
|
||||
if (aGlyphCode.font) {
|
||||
// restore our primary font in the rendering context
|
||||
mFontName.StringAt(0, aFont.name);
|
||||
aRenderingContext.SetFont(aFont);
|
||||
aRenderingContext.SetFont(aFont, nsnull);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ nsGlyphTable::DrawGlyph(nsIRenderingContext& aRenderingContext,
|
||||
if (aGlyphCode.font) {
|
||||
// glyph not associated to our primary font, it comes from an external font
|
||||
mFontName.StringAt(aGlyphCode.font, aFont.name);
|
||||
aRenderingContext.SetFont(aFont);
|
||||
aRenderingContext.SetFont(aFont, nsnull);
|
||||
}
|
||||
|
||||
//if (mType == NS_TABLE_TYPE_UNICODE)
|
||||
@@ -636,7 +636,7 @@ nsGlyphTable::DrawGlyph(nsIRenderingContext& aRenderingContext,
|
||||
if (aGlyphCode.font) {
|
||||
// restore our primary font in the rendering context
|
||||
mFontName.StringAt(0, aFont.name);
|
||||
aRenderingContext.SetFont(aFont);
|
||||
aRenderingContext.SetFont(aFont, nsnull);
|
||||
}
|
||||
if (aClipRect) {
|
||||
aRenderingContext.PopState(clipState);
|
||||
@@ -1480,7 +1480,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext,
|
||||
fontName.Assign(NS_LITERAL_STRING("CMSY10")); // assumptions in the sqrt code, we need
|
||||
SetFirstFamily(theFont, fontName); // to force precedence on this TeX font
|
||||
}
|
||||
aRenderingContext.SetFont(theFont);
|
||||
aRenderingContext.SetFont(theFont, nsnull);
|
||||
rv = aRenderingContext.GetBoundingMetrics(mData.get(),
|
||||
PRUint32(mData.Length()),
|
||||
mBoundingMetrics);
|
||||
@@ -1577,7 +1577,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext,
|
||||
}
|
||||
glyphTable->GetPrimaryFontName(fontName);
|
||||
SetFirstFamily(theFont, fontName);
|
||||
aRenderingContext.SetFont(theFont);
|
||||
aRenderingContext.SetFont(theFont, nsnull);
|
||||
#ifdef NOISY_SEARCH
|
||||
char str[50];
|
||||
fontName.ToCString(str, sizeof(str));
|
||||
@@ -1674,7 +1674,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext,
|
||||
// See if the parts of this table fit in the desired space ///////////////////////
|
||||
glyphTable->GetPrimaryFontName(fontName);
|
||||
SetFirstFamily(theFont, fontName);
|
||||
aRenderingContext.SetFont(theFont);
|
||||
aRenderingContext.SetFont(theFont, nsnull);
|
||||
// Compute the bounding metrics of all partial glyphs
|
||||
PRInt32 i;
|
||||
nsGlyphCode chdata[4];
|
||||
@@ -1956,7 +1956,7 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext,
|
||||
fontName.Assign(NS_LITERAL_STRING("CMSY10")); // assumptions in the sqrt code, we need
|
||||
SetFirstFamily(theFont, fontName); // to force precedence on this TeX font
|
||||
}
|
||||
aRenderingContext.SetFont(theFont);
|
||||
aRenderingContext.SetFont(theFont, nsnull);
|
||||
//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 + mBoundingMetrics.ascent);
|
||||
@@ -1965,7 +1965,7 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext,
|
||||
// Set the stretchy font and grab some metrics to adjust the placements ...
|
||||
mGlyphTable->GetPrimaryFontName(fontName);
|
||||
SetFirstFamily(theFont, fontName);
|
||||
aRenderingContext.SetFont(theFont);
|
||||
aRenderingContext.SetFont(theFont, nsnull);
|
||||
// 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]);
|
||||
|
||||
@@ -78,7 +78,7 @@ nsMathMLContainerFrame::ReflowError(nsIPresContext* aPresContext,
|
||||
// Set font
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font));
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
|
||||
// bounding metrics
|
||||
nsAutoString errorMsg; errorMsg.AssignWithConversion("invalid-markup");
|
||||
@@ -122,7 +122,7 @@ nsMathMLContainerFrame::PaintError(nsIPresContext* aPresContext,
|
||||
// Set color and font ...
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font));
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
|
||||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||
aRenderingContext.FillRect(0, 0, mRect.width, mRect.height);
|
||||
|
||||
@@ -282,7 +282,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
|
||||
const nsStyleFont* font;
|
||||
aForFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct *&)font);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aReflowState.rendContext->SetFont(font->mFont);
|
||||
aReflowState.rendContext->SetFont(font->mFont, nsnull);
|
||||
aReflowState.rendContext->GetFontMetrics(*getter_AddRefs(fm));
|
||||
nscoord axisHeight, em;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
|
||||
@@ -290,7 +290,7 @@ nsMathMLmfracFrame::Place(nsIPresContext* aPresContext,
|
||||
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font));
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext,
|
||||
// get x-height (an ex)
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font));
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
@@ -605,7 +605,7 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font));
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
nscoord leading = 0, axisHeight, height;
|
||||
GetAxisHeight(aRenderingContext, fm, axisHeight);
|
||||
|
||||
@@ -301,7 +301,7 @@ nsMathMLmoverFrame::Place(nsIPresContext* aPresContext,
|
||||
|
||||
const nsStyleFont* font =
|
||||
(const nsStyleFont*) mStyleContext->GetStyleData (eStyleStruct_Font);
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font));
|
||||
renderingContext.SetFont(font->mFont);
|
||||
renderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
renderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ nsMathMLmsqrtFrame::Reflow(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& renderingContext = *aReflowState.rendContext;
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font));
|
||||
renderingContext.SetFont(font->mFont);
|
||||
renderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
renderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsIPresContext* aPresContext,
|
||||
|
||||
const nsStyleFont* font;
|
||||
baseFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct *&)font);
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@ nsMathMLmtableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
||||
// XXX should instead use style data from the row of reference here ?
|
||||
const nsStyleFont* font;
|
||||
GetStyleData(eStyleStruct_Font, (const nsStyleStruct *&)font);
|
||||
aReflowState.rendContext->SetFont(font->mFont);
|
||||
aReflowState.rendContext->SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aReflowState.rendContext->GetFontMetrics(*getter_AddRefs(fm));
|
||||
nscoord axisHeight;
|
||||
|
||||
@@ -298,7 +298,7 @@ nsMathMLmunderFrame::Place(nsIPresContext* aPresContext,
|
||||
|
||||
const nsStyleFont* font =
|
||||
(const nsStyleFont*) mStyleContext->GetStyleData (eStyleStruct_Font);
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ nsMathMLmunderoverFrame::Place(nsIPresContext* aPresContext,
|
||||
|
||||
const nsStyleFont* font =
|
||||
(const nsStyleFont*) mStyleContext->GetStyleData (eStyleStruct_Font);
|
||||
aRenderingContext.SetFont(font->mFont);
|
||||
aRenderingContext.SetFont(font->mFont, nsnull);
|
||||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user