PR_snprintf(buf, 256, "<div style=\"font-family: %s; font-size: %dpt;\">\n", (const char *) fontName, fontSize);
if (!nsCRT::strcasecmp(obj->content_type, TEXT_HTML)) PR_snprintf(buf, 256, "<div style=\"font-family: %s; font-size: %dpt;\">", (const char *) fontName, fontSize); else PR_snprintf(buf, 256, "<pre style=\"font-family: %s; font-size: %dpt;\">", (const char *) fontName, fontSize);
static int DoLanguageSensitiveFont(MimeObject *obj, const char *prefixName, const char *prefixSize){  nsCOMPtr<nsICharsetConverterManager> aCharSets;  nsCOMPtr<nsIAtom> aLangGroup;  MimeInlineText  *text = (MimeInlineText *) obj;  nsAutoString aCharset;  const PRUnichar* langGroup = nsnull;  nsCAutoString aPrefStr(prefixName);  nsresult rv;  int status = -1;  if (!text->charset || !(*text->charset))    goto done;  // no alias resolution for performance  // if we get alias then no font tag to be generated (i think that's acceptable).  aCharset.AssignWithConversion(text->charset);  aCharset.ToLowerCase();  aCharSets = do_GetService(NS_CHARSETCONVERTERMANAGER_PROGID);  if (aCharSets) {    // get a language, e.g. x-western, ja    rv = aCharSets->GetCharsetLangGroup(&aCharset, getter_AddRefs(aLangGroup));    if (NS_FAILED(rv))      goto done;    rv = aLangGroup->GetUnicode(&langGroup);    if (NS_FAILED(rv))      goto done;      // append the language to the pref string    aPrefStr.AppendWithConversion(langGroup);    nsIPref *aPrefs = GetPrefServiceManager(obj->options);      if (aPrefs) {      nsCAutoString fontName;      PRUnichar *unicode = nsnull;      PRInt32 fontSize;      PRInt32 screenRes;           // get a font name from pref, could be non ascii (need charset conversion)      // this is not necessary if we insert this tag after the message is converted to UTF-8      rv = aPrefs->CopyUnicharPref(aPrefStr, &unicode);      if (NS_FAILED(rv))        goto done;      nsAutoString tempStr(unicode);      PR_FREEIF(unicode);      nsCAutoString charsetCStr;      charsetCStr.AssignWithConversion(aCharset);      rv = nsMsgI18NConvertFromUnicode(charsetCStr, tempStr, fontName);      if (NS_FAILED(rv))        goto done;      // get a font size from pref      aPrefStr.Assign(prefixSize);      aPrefStr.AppendWithConversion(langGroup);      rv = aPrefs->GetIntPref(aPrefStr, &fontSize);      if (NS_FAILED(rv))        goto done;      // get a screen resolution      rv = aPrefs->GetIntPref("browser.screen_resolution", &screenRes);      if (NS_FAILED(rv))        goto done;      fontSize = fontSize * 72 / screenRes;      char buf[256];      PR_snprintf(buf, 256, "<div style=\"font-family: %s; font-size: %dpt;\">\n", (const char *) fontName, fontSize);          status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);    }  }done:  // if nothing has been written then write out just "<div>" to match with "</div>"  if (status == -1)    status = MimeObject_write(obj, "<div>\n", 6, PR_FALSE);  return status;}