Title: [132969] trunk
Revision
132969
Author
[email protected]
Date
2012-10-30 17:45:16 -0700 (Tue, 30 Oct 2012)

Log Message

local(Helvetica) in src descriptor prevent fallback
https://bugs.webkit.org/show_bug.cgi?id=100446

Reviewed by Dan Bernstein.

Source/WebCore:

FontCache::getCachedFontData() has a mechanism that aliases a few pairs
of font family names, so that if the family name specified in the font-family
property is not available on the system, but the its alias is available,
it will be used instead. This is appropriate for the font-family property,
but not for font family names specified in the local() function of the src
descriptor in a @font-face rule.

This patch disables the mechanism while checking src descriptor of @font-face.

No new tests. It's difficult to test the change because 'Helvetica' can
be mapped any other font. For example, chromium DRT uses FontConfig to
map Helvetica to Times New Roman. Other ports may map Helvetica to other
fonts. We can't define the expected result.

* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData):
Call fontCache()->getCachedFontData() with checkingAlternateName = true.
This disables aliasing font family names in FontCache.

LayoutTests:

Add alternate font family names to src descriptor of @font-face rules
so that the change doesn't change the expectations of tests.

* fast/css/font-face-implicit-local-font.html:
* fast/css/font-face-multiple-faces.html:
* svg/custom/font-face-simple.svg:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (132968 => 132969)


--- trunk/LayoutTests/ChangeLog	2012-10-31 00:18:18 UTC (rev 132968)
+++ trunk/LayoutTests/ChangeLog	2012-10-31 00:45:16 UTC (rev 132969)
@@ -1,3 +1,17 @@
+2012-10-30  Kenichi Ishibashi  <[email protected]>
+
+        local(Helvetica) in src descriptor prevent fallback
+        https://bugs.webkit.org/show_bug.cgi?id=100446
+
+        Reviewed by Dan Bernstein.
+
+        Add alternate font family names to src descriptor of @font-face rules
+        so that the change doesn't change the expectations of tests.
+
+        * fast/css/font-face-implicit-local-font.html:
+        * fast/css/font-face-multiple-faces.html:
+        * svg/custom/font-face-simple.svg:
+
 2012-10-30  Rick Byers  <[email protected]>
 
         cssText for cursor property doesn't include hotspot

Modified: trunk/LayoutTests/fast/css/font-face-implicit-local-font.html (132968 => 132969)


--- trunk/LayoutTests/fast/css/font-face-implicit-local-font.html	2012-10-31 00:18:18 UTC (rev 132968)
+++ trunk/LayoutTests/fast/css/font-face-implicit-local-font.html	2012-10-31 00:45:16 UTC (rev 132969)
@@ -1,7 +1,7 @@
 <style>
     @font-face {
         font-family: 'courier';
-        src: local('Times');
+        src: local('Times'), local('Times New Roman');
         unicode-range: U+003?;
     }
 </style>

Modified: trunk/LayoutTests/fast/css/font-face-multiple-faces.html (132968 => 132969)


--- trunk/LayoutTests/fast/css/font-face-multiple-faces.html	2012-10-31 00:18:18 UTC (rev 132968)
+++ trunk/LayoutTests/fast/css/font-face-multiple-faces.html	2012-10-31 00:45:16 UTC (rev 132969)
@@ -2,13 +2,13 @@
     @font-face {
         font-family: webkit-one;
         font-style: italic;
-        src: local(Courier);
+        src: local(Courier), local('Courier New');
     }
 
     @font-face {
         font-family: webkit-one;
         font-style: normal;
-        src: local(Helvetica);
+        src: local(Helvetica), local(Arial);
     }
 
     @font-face {
@@ -44,13 +44,13 @@
     @font-face {
         font-family: webkit-six;
         font-weight: 400;
-        src: local(Courier);
+        src: local(Courier), local('Courier New');
     }
 
     @font-face {
         font-family: webkit-six;
         font-weight: 700;
-        src: local(Helvetica);
+        src: local(Helvetica), local(Arial);
     }
 
     @font-face {
@@ -62,25 +62,25 @@
     @font-face {
         font-family: webkit-seven;
         font-weight: 300;
-        src: local(Courier);
+        src: local(Courier), local('Courier New');
     }
 
     @font-face {
         font-family: webkit-seven;
         font-weight: 600;
-        src: local(Helvetica);
+        src: local(Helvetica), local(Arial);
     }
 
     @font-face {
         font-family: webkit-eight;
         font-weight: 100;
-        src: local(Courier);
+        src: local(Courier), local('Courier New');
     }
 
     @font-face {
         font-family: webkit-eight;
         font-weight: 900;
-        src: local(Helvetica);
+        src: local(Helvetica), local(Arial);
     }
 
     div { border: 1px solid lightblue; margin: 4px; }

Modified: trunk/LayoutTests/svg/custom/font-face-simple.svg (132968 => 132969)


--- trunk/LayoutTests/svg/custom/font-face-simple.svg	2012-10-31 00:18:18 UTC (rev 132968)
+++ trunk/LayoutTests/svg/custom/font-face-simple.svg	2012-10-31 00:45:16 UTC (rev 132969)
@@ -10,7 +10,7 @@
   }
   @font-face {
     font-family: "csstest";
-    src: local("Courier");
+    src: local("Courier"), local("Courier New");
   }
 </style>
 <defs>

Modified: trunk/Source/WebCore/ChangeLog (132968 => 132969)


--- trunk/Source/WebCore/ChangeLog	2012-10-31 00:18:18 UTC (rev 132968)
+++ trunk/Source/WebCore/ChangeLog	2012-10-31 00:45:16 UTC (rev 132969)
@@ -1,3 +1,29 @@
+2012-10-30  Kenichi Ishibashi  <[email protected]>
+
+        local(Helvetica) in src descriptor prevent fallback
+        https://bugs.webkit.org/show_bug.cgi?id=100446
+
+        Reviewed by Dan Bernstein.
+
+        FontCache::getCachedFontData() has a mechanism that aliases a few pairs
+        of font family names, so that if the family name specified in the font-family
+        property is not available on the system, but the its alias is available,
+        it will be used instead. This is appropriate for the font-family property,
+        but not for font family names specified in the local() function of the src
+        descriptor in a @font-face rule.
+
+        This patch disables the mechanism while checking src descriptor of @font-face.
+
+        No new tests. It's difficult to test the change because 'Helvetica' can
+        be mapped any other font. For example, chromium DRT uses FontConfig to
+        map Helvetica to Times New Roman. Other ports may map Helvetica to other
+        fonts. We can't define the expected result.
+
+        * css/CSSFontFaceSource.cpp:
+        (WebCore::CSSFontFaceSource::getFontData):
+        Call fontCache()->getCachedFontData() with checkingAlternateName = true.
+        This disables aliasing font family names in FontCache.
+
 2012-10-30  Beth Dakin  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=100796

Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (132968 => 132969)


--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp	2012-10-31 00:18:18 UTC (rev 132968)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp	2012-10-31 00:45:16 UTC (rev 132969)
@@ -106,7 +106,8 @@
 #endif
     ) {
         // We're local. Just return a SimpleFontData from the normal cache.
-        return fontCache()->getCachedFontData(fontDescription, m_string);
+        // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter.
+        return fontCache()->getCachedFontData(fontDescription, m_string, true);
     }
 
     // See if we have a mapping in our FontData cache.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to