Changeset 80977 in webkit
- Timestamp:
- Mar 13, 2011 5:15:31 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r80947 r80977 1 2011-03-13 Joe Wild <joseph.wild@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] QtLauncher does not load the same set of fonts as the DRT 6 https://bugs.webkit.org/show_bug.cgi?id=34959 7 8 This patch adds the option "-use-test-fonts" to the QtTestBrowser. 9 When this option is used the webkit fonts are loaded the same 10 as they are in DumpRenderTree. This option can be used on 11 QtTestBrowser and run-launcher. It can only be used 12 on Linux systems with FcInit and is configured as such. 13 14 * QtTestBrowser/launcherwindow.h: 15 (WindowOptions::WindowOptions): 16 * QtTestBrowser/main.cpp: 17 (initWebKitTestFonts): 18 (launcherMain): 19 (LauncherApplication::handleUserOptions): 20 1 21 2011-03-12 Dan Bernstein <mitz@apple.com> 2 22 -
trunk/Tools/QtTestBrowser/launcherwindow.h
r79668 r80977 101 101 , useQGLWidgetViewport(false) 102 102 #endif 103 #if defined(Q_WS_X11) 104 , useTestFonts(false) 105 #endif 103 106 { 104 107 } … … 119 122 #if defined(QT_CONFIGURED_WITH_OPENGL) 120 123 bool useQGLWidgetViewport; 124 #endif 125 #if defined(Q_WS_X11) 126 bool useTestFonts; 121 127 #endif 122 128 QUrl inspectorUrl; -
trunk/Tools/QtTestBrowser/main.cpp
r77947 r80977 36 36 WindowOptions windowOptions; 37 37 38 39 #include <QDir> 40 #include <QFile> 41 #include <QFileInfo> 42 #include <QFontDatabase> 43 44 45 #if defined(Q_WS_X11) 46 #include <fontconfig/fontconfig.h> 47 #endif 48 49 50 #if defined(Q_WS_X11) 51 // Very similar to WebCore::DumpRenderTree::initializeFonts(); 52 // Duplicated here so that QtTestBrowser would display contents 53 // with the same fonts as run-webkit-tests/DumpRenderTree. 54 static void initTestFonts() 55 { 56 static int numFonts = -1; 57 58 // Some test cases may add or remove application fonts (via @font-face). 59 // Make sure to re-initialize the font set if necessary. 60 FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication); 61 if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts) 62 return; 63 64 QByteArray fontDir = getenv("WEBKIT_TESTFONTS"); 65 if (fontDir.isEmpty() || !QDir(fontDir).exists()) { 66 fprintf(stderr, 67 "\n\n" 68 "----------------------------------------------------------------------\n" 69 "WEBKIT_TESTFONTS environment variable is not set correctly.\n" 70 "This variable has to point to the directory containing the fonts\n" 71 "you can clone from git://gitorious.org/qtwebkit/testfonts.git\n" 72 "----------------------------------------------------------------------\n" 73 ); 74 exit(1); 75 } 76 // Looks for qt/fonts.conf relative to the directory of the QtTestBrowser 77 // executable. 78 QString configFileString = QCoreApplication::applicationDirPath(); 79 configFileString += "/../../../Tools/DumpRenderTree/qt/fonts.conf"; 80 QByteArray configFileArray = configFileString.toUtf8(); 81 FcConfig* config = FcConfigCreate(); 82 if (!FcConfigParseAndLoad (config, (FcChar8*) configFileArray.data(), true)) 83 qFatal("Couldn't load font configuration file"); 84 if (!FcConfigAppFontAddDir (config, (FcChar8*) fontDir.data())) 85 qFatal("Couldn't add font dir!"); 86 FcConfigSetCurrent(config); 87 88 appFontSet = FcConfigGetFonts(config, FcSetApplication); 89 numFonts = appFontSet->nfont; 90 } 91 #endif 92 38 93 int launcherMain(const QApplication& app) 39 94 { 95 #ifdef Q_WS_X11 96 if (windowOptions.useTestFonts) 97 initTestFonts(); 98 #endif 99 40 100 #ifndef NDEBUG 41 101 int retVal = app.exec(); … … 131 191 << "[-offline-web-application-cache-enabled]" 132 192 << "[-set-offline-storage-default-quota maxSize]" 193 #if defined(Q_WS_X11) 194 << "[-use-test-fonts]" 195 #endif 133 196 << "URLs"; 134 197 appQuit(0); … … 203 266 #endif 204 267 268 #if defined(Q_WS_X11) 269 if (args.contains("-use-test-fonts")) 270 windowOptions.useTestFonts = true; 271 #endif 272 205 273 QString inspectorUrlArg("-inspector-url"); 206 274 int inspectorUrlIndex = args.indexOf(inspectorUrlArg);
Note: See TracChangeset
for help on using the changeset viewer.