[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 18:22:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7be215a5e80930bf51b538fbe525260a9eded331
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 10 09:54:17 2010 +0000

    2010-12-10  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [Gtk] style="font-family: courier" makes text disappear
            https://bugs.webkit.org/show_bug.cgi?id=47452
    
            Added a GTK+ test for invalid fonts.
    
            * platform/gtk/fonts/font-with-no-valid-encoding-expected.checksum: Added.
            * platform/gtk/fonts/font-with-no-valid-encoding-expected.png: Added.
            * platform/gtk/fonts/font-with-no-valid-encoding-expected.txt: Added.
            * platform/gtk/fonts/font-with-no-valid-encoding.html: Added.
    2010-12-10  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [Gtk] style="font-family: courier" makes text disappear
            https://bugs.webkit.org/show_bug.cgi?id=47452
    
            Don't ever use fonts that do not have any of the three charmaps that
            Fontconfig supports (Unicode, Apple Roman and Symbol). If we select
            a font that doesn't have one of these charmaps, use the next font in
            the list.
    
            Test: platform/gtk/fonts/font-with-no-valid-encoding.html
    
            * platform/graphics/freetype/FontCacheFreeType.cpp:
            (WebCore::FontCache::createFontPlatformData): Check whether the
            font we selected has a valid Fontconfig charmap.
            * platform/graphics/freetype/FontPlatformData.h: Added new method definition.
            * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
            (WebCore::FontPlatformData::hasCompatibleCharmap): Added this method which
            verifies that a font has a valid Fontconfig charmap.
    2010-12-10  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [Gtk] style="font-family: courier" makes text disappear
            https://bugs.webkit.org/show_bug.cgi?id=47452
    
            Add a test that verifies that fonts without valid charmaps are
            never selected.
    
            * DumpRenderTree/gtk/DumpRenderTree.cpp:
            (initializeFonts): Initialize DRT with our font (derived from Ahem)
            that has no valid charmap.
            * DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon: Added.
            * DumpRenderTree/gtk/fonts/fonts.conf: Updated settings to override users'
            settings which may disable selection of bitmap fonts.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73695 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index fc79010..1fbf9f0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-10  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] style="font-family: courier" makes text disappear
+        https://bugs.webkit.org/show_bug.cgi?id=47452
+
+        Added a GTK+ test for invalid fonts.
+
+        * platform/gtk/fonts/font-with-no-valid-encoding-expected.checksum: Added.
+        * platform/gtk/fonts/font-with-no-valid-encoding-expected.png: Added.
+        * platform/gtk/fonts/font-with-no-valid-encoding-expected.txt: Added.
+        * platform/gtk/fonts/font-with-no-valid-encoding.html: Added.
+
 2010-12-10  Csaba Osztrogonác  <ossy at webkit.org>
 
         Unreviewed fix after r73687.
diff --git a/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.checksum b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.checksum
new file mode 100644
index 0000000..b5c0609
--- /dev/null
+++ b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.checksum
@@ -0,0 +1 @@
+f62a0decb7c9782b09d44c378fa466b8
\ No newline at end of file
diff --git a/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.png b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.png
new file mode 100644
index 0000000..7466fae
Binary files /dev/null and b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.png differ
diff --git a/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.txt b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.txt
new file mode 100644
index 0000000..f54d250
--- /dev/null
+++ b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding-expected.txt
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x576
+      RenderBlock {DIV} at (0,0) size 784x54
+        RenderBlock {P} at (0,0) size 784x19
+          RenderText {#text} at (0,0) size 713x19
+            text run at (0,0) width 713: "This test verifies that the fonts which do not have an encoding that Fontconfig does not understand are not loaded"
+        RenderBlock {P} at (0,35) size 784x19
+          RenderText {#text} at (0,0) size 274x19
+            text run at (0,0) width 274: "The following text should be in a serif face."
diff --git a/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding.html b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding.html
new file mode 100644
index 0000000..91c6716
--- /dev/null
+++ b/LayoutTests/platform/gtk/fonts/font-with-no-valid-encoding.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+</head>
+<body>
+<div>
+<p>This test verifies that the fonts which do not have an encoding that Fontconfig
+does not understand are not loaded</p>
+<p style="font-family: FontWithNoValidEncoding,serif">The following text should be in a serif face.</p>
+</div>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bbc485b..2d5fef7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-12-10  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] style="font-family: courier" makes text disappear
+        https://bugs.webkit.org/show_bug.cgi?id=47452
+
+        Don't ever use fonts that do not have any of the three charmaps that
+        Fontconfig supports (Unicode, Apple Roman and Symbol). If we select
+        a font that doesn't have one of these charmaps, use the next font in
+        the list.
+
+        Test: platform/gtk/fonts/font-with-no-valid-encoding.html
+
+        * platform/graphics/freetype/FontCacheFreeType.cpp:
+        (WebCore::FontCache::createFontPlatformData): Check whether the
+        font we selected has a valid Fontconfig charmap.
+        * platform/graphics/freetype/FontPlatformData.h: Added new method definition.
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::hasCompatibleCharmap): Added this method which
+        verifies that a font has a valid Fontconfig charmap.
+
 2010-12-09  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Ojan Vafai.
diff --git a/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp b/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
index 61ee625..1430124 100644
--- a/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
+++ b/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
@@ -181,19 +181,26 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
     FcChar8* fontConfigFamilyNameAfterMatching;
     FcPatternGetString(resultPattern.get(), FC_FAMILY, 0, &fontConfigFamilyNameAfterMatching);
     String familyNameAfterMatching = String::fromUTF8(reinterpret_cast<char*>(fontConfigFamilyNameAfterMatching));
-    if (equalIgnoringCase(familyNameAfterConfiguration, familyNameAfterMatching))
-        return new FontPlatformData(resultPattern.get(), fontDescription);
 
     // If Fontconfig gave use a different font family than the one we requested, we should ignore it
     // and allow WebCore to give us the next font on the CSS fallback list. The only exception is if
     // this family name is a commonly used generic family.
-    if (equalIgnoringCase(familyNameString, "sans") || equalIgnoringCase(familyNameString, "sans-serif")
-        || equalIgnoringCase(familyNameString, "serif") || equalIgnoringCase(familyNameString, "monospace")
-        || equalIgnoringCase(familyNameString, "fantasy") || equalIgnoringCase(familyNameString, "cursive"))
-        return new FontPlatformData(resultPattern.get(), fontDescription);
+    if (!equalIgnoringCase(familyNameAfterConfiguration, familyNameAfterMatching)
+        && !(equalIgnoringCase(familyNameString, "sans") || equalIgnoringCase(familyNameString, "sans-serif")
+          || equalIgnoringCase(familyNameString, "serif") || equalIgnoringCase(familyNameString, "monospace")
+          || equalIgnoringCase(familyNameString, "fantasy") || equalIgnoringCase(familyNameString, "cursive")))
+        return 0;
 
-    // Fontconfig did not return a good match.
-    return 0;
+    // Verify that this font has an encoding compatible with Fontconfig. Fontconfig currently
+    // supports three encodings in FcFreeTypeCharIndex: Unicode, Symbol and AppleRoman.
+    // If this font doesn't have one of these three encodings, don't select it.
+    FontPlatformData* platformData = new FontPlatformData(resultPattern.get(), fontDescription);
+    if (!platformData->hasCompatibleCharmap()) {
+        delete platformData;
+        return 0;
+    }
+
+    return platformData;
 }
 
 }
diff --git a/WebCore/platform/graphics/freetype/FontPlatformData.h b/WebCore/platform/graphics/freetype/FontPlatformData.h
index 0793746..2841b14 100644
--- a/WebCore/platform/graphics/freetype/FontPlatformData.h
+++ b/WebCore/platform/graphics/freetype/FontPlatformData.h
@@ -68,6 +68,7 @@ public:
     void setSize(float size) { m_size = size; }
     bool syntheticBold() const { return m_syntheticBold; }
     bool syntheticOblique() const { return m_syntheticOblique; }
+    bool hasCompatibleCharmap();
 
     FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
 
diff --git a/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp b/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
index c0756ee..7340e76 100644
--- a/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
+++ b/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
@@ -272,5 +272,17 @@ void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace)
     cairo_font_options_destroy(options);
 }
 
+bool FontPlatformData::hasCompatibleCharmap()
+{
+    if (!m_scaledFont)
+        return false;
+
+    FT_Face freeTypeFace = cairo_ft_scaled_font_lock_face(m_scaledFont);
+    bool hasCompatibleCharmap = !(FT_Select_Charmap(freeTypeFace, ft_encoding_unicode)
+                                && FT_Select_Charmap(freeTypeFace, ft_encoding_symbol)
+                                && FT_Select_Charmap(freeTypeFace, ft_encoding_apple_roman));
+    cairo_ft_scaled_font_unlock_face(m_scaledFont);
+    return hasCompatibleCharmap;
+}
 
 }
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 7e33c1d..bb14a0b 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-10  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] style="font-family: courier" makes text disappear
+        https://bugs.webkit.org/show_bug.cgi?id=47452
+
+        Add a test that verifies that fonts without valid charmaps are
+        never selected.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (initializeFonts): Initialize DRT with our font (derived from Ahem)
+        that has no valid charmap.
+        * DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon: Added.
+        * DumpRenderTree/gtk/fonts/fonts.conf: Updated settings to override users'
+        settings which may disable selection of bitmap fonts.
+
 2010-12-10  Eric Seidel  <eric at webkit.org>
 
         Unreviewed.
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index a20ef99..6bf0cb8 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -231,6 +231,11 @@ static void initializeFonts(const char* testURL = 0)
     if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(ahemFontFilename.get())))
         g_error("Could not load font at %s!", ahemFontFilename.get()); 
 
+    // A font with no valid Fontconfig encoding to test https://bugs.webkit.org/show_bug.cgi?id=47452
+    GOwnPtr<gchar> fontWithNoValidEncodingFilename(g_build_filename(FONTS_CONF_DIR, "FontWithNoValidEncoding.fon", NULL));
+    if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(fontWithNoValidEncodingFilename.get())))
+        g_error("Could not load font at %s!", fontWithNoValidEncodingFilename.get()); 
+
     if (!FcConfigSetCurrent(config))
         g_error("Could not set the current font configuration!");
 
diff --git a/WebKitTools/DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon b/WebKitTools/DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon
new file mode 100644
index 0000000..8fff7d9
Binary files /dev/null and b/WebKitTools/DumpRenderTree/gtk/fonts/FontWithNoValidEncoding.fon differ
diff --git a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf b/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf
index 2d9af17..81c2e4a 100644
--- a/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf
+++ b/WebKitTools/DumpRenderTree/gtk/fonts/fonts.conf
@@ -15,6 +15,21 @@
         </edit>
     </match>
 
+    <!-- This system may have turned off selection of bitmap fonts, but
+         we must turn it on again, because we want to be able to test that
+         bitmap fonts with no valid encodings are *never* selected regardless
+         of the Fontconfig settings. So force Fontconfig to select our cruddy
+         bitmap font -->
+    <selectfont>
+        <acceptfont>
+            <pattern>
+                <patelt name="family">
+                    <string>FontWithNoValidEncoding</string>
+                </patelt>
+            </pattern>
+        </acceptfont>
+    </selectfont>
+
     <!-- The sans-serif font should be Liberation Serif -->
     <match target="pattern">
         <test qual="any" name="family">

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list