ch = XP_TO_UPPER(ch);
ch = nsCRT::ToUpper(ch);
TextFrame::GetWidth(nsIRenderingContext& aRenderingContext,                    TextStyle& aTextStyle,                    PRUnichar* aBuffer, PRInt32 aLength,                    nscoord& aWidthResult){  PRUnichar buf[TEXT_BUF_SIZE];  PRUnichar* bp0 = buf;  if (aLength > TEXT_BUF_SIZE) {    bp0 = new PRUnichar[aLength];  }  PRUnichar* bp = bp0;  nsIFontMetrics* lastFont = aTextStyle.mLastFont;  nscoord w, sum = 0;  PRInt32 pendingCount;  PRUnichar* runStart = bp;  for (; --aLength >= 0; aBuffer++) {    nsIFontMetrics* nextFont;    PRUnichar ch = *aBuffer;    if (aTextStyle.mSmallCaps && XP_IS_LOWERCASE(ch)) {      nextFont = aTextStyle.mSmallFont;      ch = XP_TO_UPPER(ch);    }    else {      nextFont = aTextStyle.mNormalFont;    }    if (nextFont != lastFont) {      pendingCount = bp - runStart;      if (0 != pendingCount) {        // Measure previous run of characters using the previous font        aRenderingContext.GetWidth(runStart, pendingCount, w);        sum += w;        runStart = bp;      }      aRenderingContext.SetFont(nextFont);      lastFont = nextFont;    }    *bp++ = ch;  }  pendingCount = bp - runStart;  if (0 != pendingCount) {    // Measure previous run of characters using the previous font    aRenderingContext.GetWidth(runStart, pendingCount, w);    sum += w;  }  if (bp0 != buf) {    delete [] bp0;  }  aTextStyle.mLastFont = lastFont;  aWidthResult = sum;}