<rdar://problem/5966961> REGRESSION: Font previews in the Web
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 May 2008 02:45:14 +0000 (02:45 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 May 2008 02:45:14 +0000 (02:45 +0000)
Inspector always show in Lucida Grande (not the real font)

Reviewed by Adam Roben.

* page/inspector/FontView.js: Add a style element that loads the
@font-face rule that is excepted by the preview element.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34162 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/inspector/FontView.js

index fd752bd..a51ba03 100644 (file)
@@ -1,5 +1,15 @@
 2008-05-27  Timothy Hatcher  <timothy@apple.com>
 
+        <rdar://problem/5966961> REGRESSION: Font previews in the Web
+        Inspector always show in Lucida Grande (not the real font)
+
+        Reviewed by Adam Roben.
+
+        * page/inspector/FontView.js: Add a style element that loads the
+        @font-face rule that is excepted by the preview element.
+
+2008-05-27  Timothy Hatcher  <timothy@apple.com>
+
         Fixes a regression where the Image and Font preview views do not
         size correctly.
 
index f4c2a84..4e1c931 100644 (file)
@@ -34,6 +34,10 @@ WebInspector.FontView = function(resource)
 
     var uniqueFontName = "WebInspectorFontPreview" + this.resource.identifier;
 
+    this.fontStyleElement = document.createElement("style");
+    this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.resource.url + "); }";
+    document.getElementsByTagName("head").item(0).appendChild(this.fontStyleElement);
+
     this.fontPreviewElement = document.createElement("div");
     this.fontPreviewElement.className = "preview";
     this.contentElement.appendChild(this.fontPreviewElement);