aString, aLength, buf, sizeof(buf), bufLen);  int len = mCharSetInfo->Convert(mCharSetInfo, mFont, aString, aLength, p, bufLen);  if ((mFont->min_byte1 == 0) && (mFont->max_byte1 == 0)) { xGC *gc = aContext->GetGC(); Drawable drawable; aSurface->GetDrawable(drawable); XlibRgbHandle *xrgbh; aSurface->GetXlibRgbHandle(xrgbh);  XDrawString(xxlib_rgb_get_display(xrgbh), drawable, *gc, aX, aY + mBaselineAdjust, p, len);  gc->Release(); textWidth = XTextWidth(mFont, p, len);
aString, aLength, buf, sizeof(buf), bufLen); int len = mCharSetInfo->Convert(mCharSetInfo, mXFont->GetXFontStruct(), aString, aLength, p, bufLen); xGC *gc = aContext->GetGC(); int outWidth; if (mXFont->IsSingleByte()) { mXFont->DrawText8(aSurface->GetDrawable(), *gc, aX, aY + mBaselineAdjust, p, len); outWidth = mXFont->TextWidth8(p, len);
nsFontXlibNormal::DrawString(nsRenderingContextXlib* aContext,                             nsIDrawingSurfaceXlib* aSurface,                             nscoord aX, nscoord aY,                             const PRUnichar* aString, PRUint32 aLength){  if (!mFont) {    LoadFont();    if (!mFont)      return 0;  }  XChar2b buf[512];  char *p;  PRInt32 bufLen;  int textWidth;  ENCODER_BUFFER_ALLOC_IF_NEEDED(p, mCharSetInfo->mConverter,      aString, aLength, buf, sizeof(buf), bufLen);    int len = mCharSetInfo->Convert(mCharSetInfo, mFont, aString, aLength,                                  p, bufLen);  if ((mFont->min_byte1 == 0) && (mFont->max_byte1 == 0)) {    xGC *gc = aContext->GetGC();    Drawable drawable; aSurface->GetDrawable(drawable);    XlibRgbHandle *xrgbh; aSurface->GetXlibRgbHandle(xrgbh);        XDrawString(xxlib_rgb_get_display(xrgbh),                drawable,                *gc,                aX, aY + mBaselineAdjust, p, len);    gc->Release();    textWidth = XTextWidth(mFont, p, len);  }  else  {    nsFontXlib *savedFont = aContext->GetCurrentFont();    aContext->SetCurrentFont(this);    aContext->UpdateGC();    xGC *gc = aContext->GetGC();        /* note the length must be divided by 2 for X*16 functions */    Drawable drawable; aSurface->GetDrawable(drawable);    XlibRgbHandle *xrgbh; aSurface->GetXlibRgbHandle(xrgbh);    XDrawString16(xxlib_rgb_get_display(xrgbh),                  drawable,                  *gc,                  aX, aY + mBaselineAdjust, (XChar2b *)p, len / 2);                      gc->Release();        textWidth = XTextWidth16(mFont, (XChar2b *)p, len / 2);    aContext->SetCurrentFont(savedFont);    aContext->UpdateGC();  }  ENCODER_BUFFER_FREE_IF_NEEDED(p, buf);  return textWidth;}