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

abecsi at webkit.org abecsi at webkit.org
Wed Dec 22 14:25:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 54848450c743bc3fbf242f8431cdb15b6b88a593
Author: abecsi at webkit.org <abecsi at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 8 12:29:18 2010 +0000

    2010-10-08  Andras Becsi  <abecsi at webkit.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Add an activateFonts() implementation similar to DRT's initializeFonts().
            Original code by Simon Hausmann.
            https://bugs.webkit.org/show_bug.cgi?id=47402
    
            * WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp: Added.
            (WTR::activateFonts):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69392 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 0abc208..52c6166 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,16 @@
 2010-10-08  Andras Becsi  <abecsi at webkit.org>
 
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Add an activateFonts() implementation similar to DRT's initializeFonts().
+        Original code by Simon Hausmann.
+        https://bugs.webkit.org/show_bug.cgi?id=47402
+
+        * WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp: Added.
+        (WTR::activateFonts):
+
+2010-10-08  Andras Becsi  <abecsi at webkit.org>
+
         Reviewed by Csaba Osztrogonác.
 
         [Qt] Add support for Qt's WebKitTestRunner to old-run-webkit-tests.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
new file mode 100644
index 0000000..7bd8b74
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ActivateFonts.h"
+
+#include <QByteArray>
+#include <QDir>
+
+#ifdef Q_WS_X11
+#include <fontconfig/fontconfig.h>
+#endif
+
+namespace WTR {
+
+void activateFonts()
+{
+#if defined(Q_WS_X11)
+    static int numFonts = -1;
+
+    // Some test cases may add or remove application fonts (via @font-face).
+    // Make sure to re-initialize the font set if necessary.
+    FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication);
+    if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts)
+        return;
+
+    QByteArray fontDir = getenv("WEBKIT_TESTFONTS");
+    if (fontDir.isEmpty() || !QDir(fontDir).exists()) {
+        fprintf(stderr,
+                "\n\n"
+                "----------------------------------------------------------------------\n"
+                "WEBKIT_TESTFONTS environment variable is not set correctly.\n"
+                "This variable has to point to the directory containing the fonts\n"
+                "you can clone from git://gitorious.org/qtwebkit/testfonts.git\n"
+                "----------------------------------------------------------------------\n"
+               );
+        exit(1);
+    }
+    char currentPath[PATH_MAX+1];
+    if (!getcwd(currentPath, PATH_MAX))
+        qFatal("Couldn't get current working directory");
+    QByteArray configFile = currentPath;
+    FcConfig* config = FcConfigCreate();
+    configFile += "/WebKitTools/DumpRenderTree/qt/fonts.conf";
+    if (!FcConfigParseAndLoad (config, (FcChar8*) configFile.data(), true))
+        qFatal("Couldn't load font configuration file");
+    if (!FcConfigAppFontAddDir (config, (FcChar8*) fontDir.data()))
+        qFatal("Couldn't add font dir!");
+    FcConfigSetCurrent(config);
+
+    appFontSet = FcConfigGetFonts(config, FcSetApplication);
+    numFonts = appFontSet->nfont;
+#endif
+}
+
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list