diff --git a/mozilla/mailnews/mime/src/mimemoz2.cpp b/mozilla/mailnews/mime/src/mimemoz2.cpp index bd31693ba69..1d98e5b9531 100644 --- a/mozilla/mailnews/mime/src/mimemoz2.cpp +++ b/mozilla/mailnews/mime/src/mimemoz2.cpp @@ -1851,7 +1851,10 @@ static int DoLanguageSensitiveFont(MimeObject *obj, const char *prefixName, cons fontSize = fontSize * 72 / screenRes; char buf[256]; - PR_snprintf(buf, 256, "
\n", (const char *) fontName, fontSize); + if (!nsCRT::strcasecmp(obj->content_type, TEXT_HTML)) + PR_snprintf(buf, 256, "
", (const char *) fontName, fontSize); + else + PR_snprintf(buf, 256, "
", (const char *) fontName, fontSize);
     
       status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);
     }
@@ -1871,14 +1874,14 @@ int BeginMailNewsFont(MimeObject *obj)
   int status = -1;
   nsresult rv;
 
-  if (aPrefs) {
-    // check Content-Type:
-    PRBool bTEXT_HTML = PR_FALSE;
-    if (!nsCRT::strcasecmp(obj->content_type, TEXT_HTML))
-      bTEXT_HTML = PR_TRUE;
-    else if (nsCRT::strcasecmp(obj->content_type, TEXT_PLAIN))
-      goto done;  // not supported type
+  // check Content-Type:
+  PRBool bTEXT_HTML = PR_FALSE;
+  if (!nsCRT::strcasecmp(obj->content_type, TEXT_HTML))
+    bTEXT_HTML = PR_TRUE;
+  else if (nsCRT::strcasecmp(obj->content_type, TEXT_PLAIN))
+    goto done;  // not supported type
 
+  if (aPrefs) {
     // if indicated by the pref, do language sensitive font selection (slower)
     PRBool  languageSensitiveFont = PR_FALSE;
     rv = aPrefs->GetBoolPref("mailnews.language_sensitive_font", &languageSensitiveFont);
@@ -1926,22 +1929,31 @@ int BeginMailNewsFont(MimeObject *obj)
   
     char buf[256];
 
-    PR_snprintf(buf, 256, "
\n", (const char *) fontName, fontSize); + if (bTEXT_HTML) + PR_snprintf(buf, 256, "
", (const char *) fontName, fontSize); + else + PR_snprintf(buf, 256, "
", (const char *) fontName, fontSize);
 
     status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);
 
   }
 done:
   // if nothing has been written then write out just "
" to match with "
" - if (status == -1) - status = MimeObject_write(obj, "
\n", 6, PR_FALSE); + if (status == -1) { + if (bTEXT_HTML) + status = MimeObject_write(obj, "
", 5, PR_FALSE); + else + status = MimeObject_write(obj, "
", 5, PR_FALSE);
+  }
   
   return status;
 }
 
 int EndMailNewsFont(MimeObject *obj)
 {
-  char buf[] = "
\n"; - return MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE); + if (!nsCRT::strcasecmp(obj->content_type, TEXT_HTML)) + return MimeObject_write(obj, "
", 6, PR_FALSE); + else + return MimeObject_write(obj, "
", 6, PR_FALSE); }