From d1382b90718df5cde65216fa0e4965189504875f Mon Sep 17 00:00:00 2001 From: "rbs%maths.uq.edu.au" Date: Sat, 5 Jan 2002 01:08:09 +0000 Subject: [PATCH] MathML only - remove outdated APIs git-svn-id: svn://10.0.0.236/trunk@111383 18797224-902f-48f8-a5cc-f745e15eee43 --- .../mathml/base/src/nsMathMLContainerFrame.h | 60 +++++++------------ .../mathml/base/src/nsMathMLmrootFrame.cpp | 4 +- .../mathml/base/src/nsMathMLmsqrtFrame.cpp | 4 +- 3 files changed, 26 insertions(+), 42 deletions(-) diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h index a93476b3b01..b42b0285205 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h @@ -344,13 +344,10 @@ public: nscoord& aSubScriptShift1, nscoord& aSubScriptShift2) { - GetSubShifts(fm, aSubScriptShift1, aSubScriptShift2); -#if 0 - // XXX for now an alias for GetSubscriptOffset - fm->GetSubscriptOffset (aSubScriptShift1); - aSubScriptShift2 = aSubScriptShift1 - = NSToCoordRound(0.5f * aSubScriptShift1); -#endif + nscoord xHeight = 0; + fm->GetXHeight (xHeight); + aSubScriptShift1 = NSToCoordRound (150.000f/430.556f * xHeight); + aSubScriptShift2 = NSToCoordRound (247.217f/430.556f * xHeight); } // 3 levels of superscript shifts @@ -360,13 +357,11 @@ public: nscoord& aSupScriptShift2, nscoord& aSupScriptShift3) { - GetSupShifts(fm, aSupScriptShift1, aSupScriptShift2, aSupScriptShift3); -#if 0 - // XXX for now an alias for GetSupscriptOffset - fm->GetSuperscriptOffset (aSupScriptShift1); - aSupScriptShift2 = aSupScriptShift3 = aSupScriptShift1 - = NSToCoordRound(0.75f * aSupScriptShift1); -#endif + nscoord xHeight = 0; + fm->GetXHeight (xHeight); + aSupScriptShift1 = NSToCoordRound (412.892f/430.556f * xHeight); + aSupScriptShift2 = NSToCoordRound (362.892f/430.556f * xHeight); + aSupScriptShift3 = NSToCoordRound (288.889f/430.556f * xHeight); } // these are TeX specific params not found in ordinary fonts @@ -387,30 +382,6 @@ public: aSupDrop = NSToCoordRound(386.108f/430.556f * xHeight); } - static void - GetSubShifts (nsIFontMetrics *fm, - nscoord& aSubShift1, - nscoord& aSubShift2) - { - nscoord xHeight = 0; - fm->GetXHeight (xHeight); - aSubShift1 = NSToCoordRound (150.000f/430.556f * xHeight); - aSubShift2 = NSToCoordRound (247.217f/430.556f * xHeight); - } - - static void - GetSupShifts (nsIFontMetrics *fm, - nscoord& aSupShift1, - nscoord& aSupShift2, - nscoord& aSupShift3) - { - nscoord xHeight = 0; - fm->GetXHeight (xHeight); - aSupShift1 = NSToCoordRound (412.892f/430.556f * xHeight); - aSupShift2 = NSToCoordRound (362.892f/430.556f * xHeight); - aSupShift3 = NSToCoordRound (288.889f/430.556f * xHeight); - } - static void GetNumeratorShifts (nsIFontMetrics *fm, nscoord& numShift1, @@ -435,6 +406,19 @@ public: denShift2 = NSToCoordRound (344.841f/430.556f * xHeight); } + static void + GetEmHeight (nsIFontMetrics *fm, + nscoord& emHeight) + { +#if 0 // should switch to this API in order to scale with changes of TextZoom + fm->GetEmHeight (emHeight); +#else + const nsFont* font; + fm->GetFont(font); + emHeight = NSToCoordRound(float(font->size)); +#endif + } + static void GetAxisHeight (nsIFontMetrics *fm, nscoord& axisHeight) diff --git a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp index 286e4115843..0c76797b3c6 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp @@ -224,12 +224,12 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr fm; renderingContext.GetFontMetrics(*getter_AddRefs(fm)); - nscoord ruleThickness, leading; + nscoord ruleThickness, leading, em; GetRuleThickness(renderingContext, fm, ruleThickness); // get the leading to be left at the top of the resulting frame // this seems more reliable than using fm->GetLeading() on suspicious fonts - float em = float(font->mFont.size); + GetEmHeight(fm, em); leading = nscoord(0.2f * em); // Rule 11, App. G, TeXbook diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp index 1a62b32178b..9f455ff98ba 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp @@ -189,12 +189,12 @@ nsMathMLmsqrtFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr fm; renderingContext.GetFontMetrics(*getter_AddRefs(fm)); - nscoord ruleThickness, leading; + nscoord ruleThickness, leading, em; GetRuleThickness(renderingContext, fm, ruleThickness); // get the leading to be left at the top of the resulting frame // this seems more reliable than using fm->GetLeading() on suspicious fonts - float em = float(font->mFont.size); + GetEmHeight(fm, em); leading = nscoord(0.2f * em); // Rule 11, App. G, TeXbook