Bug 587319: We do not know the metrics yet for DWrite fonts. Disable when using DWrite. r=joedrew
authorBas Schouten <bschouten@mozilla.com>
Mon, 16 Aug 2010 09:15:03 +0200
changeset 50656 ad71fe3f1827d377961a14c6f69df23f72476a99
parent 50655 2a04d4e8ba195563fdf55fa1e75cddf8278ba8d6
child 50657 2470cae3c28537048f8343a756b5a95f480f1b88
push idunknown
push userunknown
push dateunknown
reviewersjoedrew
bugs587319
milestone2.0b4pre
Bug 587319: We do not know the metrics yet for DWrite fonts. Disable when using DWrite. r=joedrew
layout/generic/test/test_selection_underline.html
--- a/layout/generic/test/test_selection_underline.html
+++ b/layout/generic/test/test_selection_underline.html
@@ -58,25 +58,29 @@ const kIsLinux = navigator.platform.inde
  *   0: font-family: Ahem.ttf;             font-size: 16px;
  *   1: font-family: mplus-1p-regular.ttf; font-size: 16px;
  *   2: font-family: Ahem.ttf;             font-size: 32px;
  *   3: font-family: mplus-1p-regular.ttf; font-size: 32px;
  *   4: font-family: Ahem.ttf;             font-size: 52px;
  *   5: font-family: mplus-1p-regular.ttf; font-size: 52px;
  */
 var gFontMetrics = [];
+
 if (kIsWin) {
-  gFontMetrics = [
-    { emHeight: 16, ascent: 13, offset: -2, lineHeight: 1, descentLimit:  3 },
-    { emHeight: 16, ascent: 17, offset: -2, lineHeight: 1, descentLimit:  5 },
-    { emHeight: 32, ascent: 26, offset: -4, lineHeight: 1, descentLimit:  6 },
-    { emHeight: 32, ascent: 34, offset: -4, lineHeight: 2, descentLimit: 10 },
-    { emHeight: 52, ascent: 42, offset: -7, lineHeight: 1, descentLimit: 10 },
-    { emHeight: 52, ascent: 56, offset: -7, lineHeight: 3, descentLimit: 17 }
-  ];
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+  if (!Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).DWriteEnabled) {
+    gFontMetrics = [
+      { emHeight: 16, ascent: 13, offset: -2, lineHeight: 1, descentLimit:  3 },
+      { emHeight: 16, ascent: 17, offset: -2, lineHeight: 1, descentLimit:  5 },
+      { emHeight: 32, ascent: 26, offset: -4, lineHeight: 1, descentLimit:  6 },
+      { emHeight: 32, ascent: 34, offset: -4, lineHeight: 2, descentLimit: 10 },
+      { emHeight: 52, ascent: 42, offset: -7, lineHeight: 1, descentLimit: 10 },
+      { emHeight: 52, ascent: 56, offset: -7, lineHeight: 3, descentLimit: 17 }
+    ];
+  }
 }
 
 /*
 
 if (kIsMac) {
   // XXX mnakano: I got following metrics on my Mac (both 10.4 and 10.5).
   // However, on tinderbox machines, they are different values.  I'm not sure
   // the reason.