From 423b78d26f1da9cd7b3220c298227b26223fc222 Mon Sep 17 00:00:00 2001 From: "nhotta%netscape.com" Date: Thu, 27 Apr 2000 00:26:24 +0000 Subject: [PATCH] Changed to use "pre" instead of "div" in case of plain text for the font setting, bug 37299. git-svn-id: svn://10.0.0.236/trunk@67342 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/mime/src/mimemoz2.cpp | 38 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 13 deletions(-) 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); }