Title: [111598] trunk/Tools
Revision
111598
Author
[email protected]
Date
2012-03-21 13:24:11 -0700 (Wed, 21 Mar 2012)

Log Message

[EFL] Use jhbuild downloaded fonts instead of hardcoded system font paths
https://bugs.webkit.org/show_bug.cgi?id=81507

Now that we're only loading from one directory, no need to
iterate over a list of directories anymore.

Patch by Dominik Röttsches <[email protected]> on 2012-03-21
Reviewed by Martin Robinson.

* DumpRenderTree/efl/CMakeLists.txt:
* DumpRenderTree/efl/FontManagement.cpp:
(addFontDirectory):
(addFontsToEnvironment):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (111597 => 111598)


--- trunk/Tools/ChangeLog	2012-03-21 20:08:49 UTC (rev 111597)
+++ trunk/Tools/ChangeLog	2012-03-21 20:24:11 UTC (rev 111598)
@@ -1,3 +1,18 @@
+2012-03-21  Dominik Röttsches  <[email protected]>
+
+        [EFL] Use jhbuild downloaded fonts instead of hardcoded system font paths
+        https://bugs.webkit.org/show_bug.cgi?id=81507
+
+        Now that we're only loading from one directory, no need to
+        iterate over a list of directories anymore.
+
+        Reviewed by Martin Robinson.
+
+        * DumpRenderTree/efl/CMakeLists.txt:
+        * DumpRenderTree/efl/FontManagement.cpp:
+        (addFontDirectory):
+        (addFontsToEnvironment):
+
 2012-03-21  Zeno Albisser  <[email protected]>
 
         [Qt][Mac] ranlib segfaults when creating symbol tables for libWebCore.a.

Modified: trunk/Tools/DumpRenderTree/efl/CMakeLists.txt (111597 => 111598)


--- trunk/Tools/DumpRenderTree/efl/CMakeLists.txt	2012-03-21 20:08:49 UTC (rev 111597)
+++ trunk/Tools/DumpRenderTree/efl/CMakeLists.txt	2012-03-21 20:24:11 UTC (rev 111598)
@@ -109,6 +109,7 @@
 )
 
 ADD_DEFINITIONS(-DFONTS_CONF_DIR="${TOOLS_DIR}/DumpRenderTree/gtk/fonts"
+                -DDOWNLOADED_FONTS_DIR="${CMAKE_BINARY_DIR}/../Dependencies/Source/webkitgtk-test-fonts-0.0.1"
                 -DDATA_DIR="${THEME_BINARY_DIR}")
 
 INCLUDE_DIRECTORIES(${DumpRenderTree_INCLUDE_DIRECTORIES})

Modified: trunk/Tools/DumpRenderTree/efl/FontManagement.cpp (111597 => 111598)


--- trunk/Tools/DumpRenderTree/efl/FontManagement.cpp	2012-03-21 20:08:49 UTC (rev 111597)
+++ trunk/Tools/DumpRenderTree/efl/FontManagement.cpp	2012-03-21 20:24:11 UTC (rev 111598)
@@ -33,22 +33,6 @@
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
-static Vector<String> getFontDirectories()
-{
-    Vector<String> fontDirPaths;
-
-    fontDirPaths.append(String("/usr/share/fonts/TTF/"));
-    fontDirPaths.append(String("/usr/share/fonts/truetype/ttf-liberation/"));
-    fontDirPaths.append(String("/usr/share/fonts/liberation/"));
-    fontDirPaths.append(String("/usr/share/fonts/truetype/ttf-dejavu/"));
-    fontDirPaths.append(String("/usr/share/fonts/dejavu/"));
-    fontDirPaths.append(String("/usr/share/fonts/OTF/")); // MathML
-    fontDirPaths.append(String("/usr/share/fonts/opentype/stix/")); // MathML
-    fontDirPaths.append(String("/usr/share/fonts/stix/")); // MathML
-
-    return fontDirPaths;
-}
-
 static Vector<String> getFontFiles()
 {
     Vector<String> fontFilePaths;
@@ -69,26 +53,16 @@
     return fontFilePaths;
 }
 
-static size_t addFontDirectories(const Vector<String>& fontDirectories, FcConfig* config)
+static bool addFontDirectory(const CString& fontDirectory, FcConfig* config)
 {
-    size_t addedDirectories = 0;
+    const char* path = fontDirectory.data();
 
-    for (Vector<String>::const_iterator it = fontDirectories.begin();
-         it != fontDirectories.end(); ++it) {
-        const CString currentDirectory = (*it).utf8();
-        const char* path = currentDirectory.data();
-
-        if (ecore_file_is_dir(path)) {
-            if (!FcConfigAppFontAddDir(config, reinterpret_cast<const FcChar8*>(path))) {
-                fprintf(stderr, "Could not load font at %s!\n", path);
-                continue;
-            }
-
-            ++addedDirectories;
-        }
+    if (!ecore_file_is_dir(path)
+        || !FcConfigAppFontAddDir(config, reinterpret_cast<const FcChar8*>(path))) {
+        fprintf(stderr, "Could not add font directory %s!\n", path);
+        return false;
     }
-
-    return addedDirectories;
+    return true;
 }
 
 static void addFontFiles(const Vector<String>& fontFiles, FcConfig* config)
@@ -115,7 +89,7 @@
         exit(1);
     }
 
-    if (!addFontDirectories(getFontDirectories(), config)) {
+    if (!addFontDirectory(DOWNLOADED_FONTS_DIR, config)) {
         fprintf(stderr, "None of the font directories could be added. Either install them "
                         "or file a bug at http://bugs.webkit.org if they are installed in "
                         "another location.\n");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to