--- mozilla/xpfe/components/prefwindow/resources/content/pref-fonts.js.foo	Mon Aug  5 20:53:17 2002
+++ mozilla/xpfe/components/prefwindow/resources/content/pref-fonts.js	Wed Jan 22 17:28:11 2003
@@ -245,17 +245,46 @@
           var popupNode = document.createElement( "menupopup" ); 
           var strDefaultFontFace = "";
           var fontName;
+
+          // get the string for describing the system default
+          var sysDefaultStr;
+          try {
+            var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService();
+            strBundleService = strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService);
+            fontBundle = strBundleService.createBundle("chrome://communicator/locale/pref/pref-fonts.properties");
+
+            sysDefaultStr = fontBundle.GetStringFromName("systemDefault");
+          }
+          catch(e) {
+            sysDefaultStr = "[System Default]";
+          }
+
+          // always put the default system font at the front of the list
+          var defaultNode = document.createElement("menuitem");
+          defaultNode.setAttribute("value", "DEFAULT");
+          defaultNode.setAttribute("label", sysDefaultStr);
+          popupNode.appendChild(defaultNode);
+
           while (aDataObject.hasMoreElements()) {
             fontName = aDataObject.getNext();
             fontName = fontName.QueryInterface(Components.interfaces.nsISupportsString);
             var fontNameStr = fontName.toString();
-            if (strDefaultFontFace == "")
-              strDefaultFontFace = fontNameStr;
+
+            // Make sure to set our default so that we know that
+            // there's at least one font in the list.
+            if (strDefaultFontFace == "") {
+                strDefaultFontFace = "DEFAULT";
+            }
+
             var itemNode = document.createElement( "menuitem" );
             itemNode.setAttribute( "value", fontNameStr );
             itemNode.setAttribute( "label", fontNameStr );
+
             popupNode.appendChild( itemNode );
           }
+
+          // If there were no fonts listed for this font, just disable
+          // the list.
           if (strDefaultFontFace != "") {
             this.listElement.removeAttribute( "disabled" );
           } else {
@@ -264,6 +293,7 @@
                                     gPrefutilitiesBundle.getString("nofontsforlang") );
             this.listElement.setAttribute( "disabled", "true" );
           }
+
           this.listElement.appendChild( popupNode ); 
           return strDefaultFontFace;
         } 
@@ -295,8 +325,21 @@
             catch(e)
               {
               }
-            if( currValue != dataObject.languageData[language].types[type] )
+
+            // If someone is using the "default" font then unset the
+            // pref entirely
+            if( dataObject.languageData[language].types[type] == "DEFAULT") {
+              // If there's a default but no user setting,
+              // ClearUserPref throws an exception.  Lame.
+              try {
+                pref.ClearUserPref( fontPrefString );
+              }
+              catch (e) {
+              }
+            }
+            else if( currValue != dataObject.languageData[language].types[type] ) {
               pref.SetUnicharPref( fontPrefString, dataObject.languageData[language].types[type] );
+            }
           }
         var variableSizePref = "font.size.variable." + language;
         var fixedSizePref = "font.size.fixed." + language;
--- mozilla/xpfe/components/prefwindow/resources/locale/en-US/pref-fonts.properties.foo	Wed Jan 22 17:28:11 2003
+++ mozilla/xpfe/components/prefwindow/resources/locale/en-US/pref-fonts.properties	Wed Jan 22 17:28:11 2003
@@ -0,0 +1 @@
+systemDefault=[System Default]
--- mozilla/xpfe/components/jar.mn.foo	Tue Oct  8 02:20:38 2002
+++ mozilla/xpfe/components/jar.mn	Wed Jan 22 17:28:11 2003
@@ -122,6 +122,7 @@
     locale/en-US/communicator/pref/pref-debug2.dtd              (prefwindow/resources/locale/en-US/pref-debug2.dtd)
     locale/en-US/communicator/pref/pref-download.dtd            (prefwindow/resources/locale/en-US/pref-download.dtd)
     locale/en-US/communicator/pref/pref-fonts.dtd               (prefwindow/resources/locale/en-US/pref-fonts.dtd)
+    locale/en-US/communicator/pref/pref-fonts.properties        (prefwindow/resources/locale/en-US/pref-fonts.properties)
     locale/en-US/communicator/pref/pref-history.dtd             (prefwindow/resources/locale/en-US/pref-history.dtd)
     locale/en-US/communicator/pref/pref-http.dtd                (prefwindow/resources/locale/en-US/pref-http.dtd)
     locale/en-US/communicator/pref/pref-languages.dtd           (prefwindow/resources/locale/en-US/pref-languages.dtd)
