nsMathMLFrame::GetAxisHeight(nsIRenderingContext& aRenderingContext, nsIFontMetrics*      aFontMetrics, nscoord&             aAxisHeight) {   #ifdef NS_DEBUG nsCOMPtr<nsIFontMetrics> currFontMetrics; aRenderingContext.GetFontMetrics(*getter_AddRefs(currFontMetrics)); NS_ASSERTION(currFontMetrics->Font().Equals(aFontMetrics->Font()), "unexpected state"); #endif nscoord xHeight; aFontMetrics->GetXHeight(xHeight); PRUnichar minus = 0x2212; nsBoundingMetrics bm; nsresult rv = aRenderingContext.GetBoundingMetrics(&minus, PRUint32(1), bm); if (NS_SUCCEEDED(rv)) { aAxisHeight = bm.ascent - (bm.ascent + bm.descent)/2;
GetAxisHeight (nsIFontMetrics* fm, nscoord&        axisHeight) { fm->GetXHeight (axisHeight); axisHeight = NSToCoordRound(250.000f/430.556f * axisHeight);
nsMathMLFrame::GetAxisHeight(nsIRenderingContext& aRenderingContext,                             nsIFontMetrics*      aFontMetrics,                             nscoord&             aAxisHeight){  // get the bounding metrics of the minus sign, the rendering context  // is assumed to have been set with the font of the current style context#ifdef NS_DEBUG  nsCOMPtr<nsIFontMetrics> currFontMetrics;  aRenderingContext.GetFontMetrics(*getter_AddRefs(currFontMetrics));  NS_ASSERTION(currFontMetrics->Font().Equals(aFontMetrics->Font()),	"unexpected state");#endif  nscoord xHeight;  aFontMetrics->GetXHeight(xHeight);  PRUnichar minus = 0x2212; // not '-', but official Unicode minus sign  nsBoundingMetrics bm;  nsresult rv = aRenderingContext.GetBoundingMetrics(&minus, PRUint32(1), bm);  if (NS_SUCCEEDED(rv)) {    aAxisHeight = bm.ascent - (bm.ascent + bm.descent)/2;  }  if (NS_FAILED(rv) || aAxisHeight <= 0 || aAxisHeight >= xHeight) {    // fall-back to the other version    GetAxisHeight(aFontMetrics, aAxisHeight);  }}