Changeset 121684 in webkit
- Timestamp:
- Jul 2, 2012 9:10:49 AM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r121681 r121684 1 2012-07-02 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Read fonts path when running layout tests from alternative fonts dir when main dir doesn't exist 4 https://bugs.webkit.org/show_bug.cgi?id=89437 5 6 Reviewed by Martin Robinson. 7 8 If main fonts directory doesn't exist, try with an alternative 9 fonts directory at build directory. 10 11 * DumpRenderTree/gtk/DumpRenderTree.cpp: 12 (getOutputDir): 13 (getFontsPath): 14 (initializeFonts): 15 * WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp: 16 (WTR::getOutputDir): 17 (WTR): 18 (WTR::getFontsPath): 19 (WTR::inititializeFontConfigSetting): 20 1 21 2012-07-02 Carlos Garcia Campos <cgarcia@igalia.com> 2 22 -
trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
r121568 r121684 170 170 } 171 171 172 CString getOutputDir() 173 { 174 const char* webkitOutputDir = g_getenv("WEBKITOUTPUTDIR"); 175 if (webkitOutputDir) 176 return webkitOutputDir; 177 178 CString topLevelPath = getTopLevelPath(); 179 GOwnPtr<char> outputDir(g_build_filename(topLevelPath.data(), "WebKitBuild", NULL)); 180 return outputDir.get(); 181 } 182 183 static CString getFontsPath() 184 { 185 CString webkitOutputDir = getOutputDir(); 186 GOwnPtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); 187 if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) 188 return fontsPath.get(); 189 190 // Try alternative fonts path. 191 fontsPath.set(g_build_filename(webkitOutputDir.data(), "webkitgtk-test-fonts", NULL)); 192 if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) 193 return fontsPath.get(); 194 195 return CString(); 196 } 197 172 198 static void initializeFonts(const char* testURL = 0) 173 199 { … … 191 217 g_error("Couldn't load font configuration file from: %s", fontConfigFilename.get()); 192 218 193 GOwnPtr<char> fontsPath; 194 const char* webkitOutputDir = g_getenv("WEBKITOUTPUTDIR"); 195 if (webkitOutputDir) 196 fontsPath.set(g_build_filename(webkitOutputDir, "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); 197 else { 198 CString topLevelPath = getTopLevelPath(); 199 fontsPath.set(g_build_filename(topLevelPath.data(), "WebKitBuild", "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); 200 } 201 202 if (!g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) 203 g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.get()); 219 CString fontsPath = getFontsPath(); 220 if (fontsPath.isNull()) 221 g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.data()); 204 222 205 223 GOwnPtr<GError> error; 206 GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath. get(), 0, &error.outPtr()));224 GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath.data(), 0, &error.outPtr())); 207 225 while (const char* directoryEntry = g_dir_read_name(fontsDirectory.get())) { 208 226 if (!g_str_has_suffix(directoryEntry, ".ttf") && !g_str_has_suffix(directoryEntry, ".otf")) 209 227 continue; 210 GOwnPtr<gchar> fontPath(g_build_filename(fontsPath. get(), directoryEntry, NULL));228 GOwnPtr<gchar> fontPath(g_build_filename(fontsPath.data(), directoryEntry, NULL)); 211 229 if (!FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(fontPath.get()))) 212 230 g_error("Could not load font at %s!", fontPath.get()); -
trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp
r121499 r121684 67 67 } 68 68 69 CString getOutputDir() 70 { 71 const char* webkitOutputDir = g_getenv("WEBKITOUTPUTDIR"); 72 if (webkitOutputDir) 73 return webkitOutputDir; 74 75 CString topLevelPath = getTopLevelPath(); 76 GOwnPtr<char> outputDir(g_build_filename(topLevelPath.data(), "WebKitBuild", NULL)); 77 return outputDir.get(); 78 } 79 80 static CString getFontsPath() 81 { 82 CString webkitOutputDir = getOutputDir(); 83 GOwnPtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); 84 if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) 85 return fontsPath.get(); 86 87 // Try alternative fonts path. 88 fontsPath.set(g_build_filename(webkitOutputDir.data(), "webkitgtk-test-fonts", NULL)); 89 if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) 90 return fontsPath.get(); 91 92 return CString(); 93 } 94 69 95 void inititializeFontConfigSetting() 70 96 { … … 87 113 g_error("Couldn't load font configuration file from: %s", fontConfigFilename.get()); 88 114 89 GOwnPtr<char> fontsPath; 90 const char* webkitOutputDir = g_getenv("WEBKITOUTPUTDIR"); 91 if (webkitOutputDir) 92 fontsPath.set(g_build_filename(webkitOutputDir, "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); 93 else { 94 CString topLevelPath = getTopLevelPath(); 95 fontsPath.set(g_build_filename(topLevelPath.data(), "WebKitBuild", "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); 96 } 97 98 if (!g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) 99 g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.get()); 115 CString fontsPath = getFontsPath(); 116 if (fontsPath.isNull()) 117 g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.data()); 100 118 101 119 GOwnPtr<GError> error; 102 GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath. get(), 0, &error.outPtr()));120 GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath.data(), 0, &error.outPtr())); 103 121 while (const char* directoryEntry = g_dir_read_name(fontsDirectory.get())) { 104 122 if (!g_str_has_suffix(directoryEntry, ".ttf") && !g_str_has_suffix(directoryEntry, ".otf")) 105 123 continue; 106 GOwnPtr<gchar> fontPath(g_build_filename(fontsPath. get(), directoryEntry, NULL));124 GOwnPtr<gchar> fontPath(g_build_filename(fontsPath.data(), directoryEntry, NULL)); 107 125 if (!FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(fontPath.get()))) 108 126 g_error("Could not load font at %s!", fontPath.get());
Note: See TracChangeset
for help on using the changeset viewer.