--- mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp.foo	Mon Nov  4 16:51:09 2002
+++ mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp	Wed Dec 18 11:51:49 2002
@@ -42,6 +42,8 @@
 
 #include "nspr.h"
 #include "nsIPref.h"
+#include "nsIPrefService.h"
+#include "nsIPrefBranch.h"
 #include "nsIServiceManager.h"
 #include "nsCRT.h"
 
@@ -952,6 +954,23 @@
       fontName.Append(PRUnichar(','));
     }
   }
+
+  // Allow the values calculated above to be overidden by preferences
+  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
+  if (prefBranch) {
+    nsXPIDLCString name;
+    prefBranch->GetCharPref("font.uifont.name", getter_Copies(name));
+
+    if (name)
+      aFont->name.AssignWithConversion(name);
+
+    PRInt32 pointheight = 0;
+    prefBranch->GetIntPref("font.uifont.pointheight", &pointheight);
+
+    if (pointheight)
+      aFont->size = NSIntPointsToTwips(pointheight);
+  }
+
   return NS_OK;
 }
 #endif /* MOZ_WIDGET_GTK */
