Changeset 64601 in webkit


Ignore:
Timestamp:
Aug 3, 2010 3:55:12 PM (14 years ago)
Author:
jhoneycutt@apple.com
Message:

WebKitTestRunner needs to support loading custom fonts (via the
WEBKIT_TESTFONTS environment variable)
https://bugs.webkit.org/show_bug.cgi?id=42782

Reviewed by Adam Roben.

  • WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp:

(WTR::fontsPath):
Copied from DRT code. Removed the fallback to DumpRenderTree.resources/,
as this directory doesn't appear to be created anymore.
(WTR::activateFonts):
Loop through the fonts, and call AddFontResourceExW() for each.

Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r64589 r64601  
    135135
    136136        * Scripts/old-run-webkit-tests:
     137
     1382010-08-02  Jon Honeycutt  <jhoneycutt@apple.com>
     139
     140        WebKitTestRunner needs to support loading custom fonts (via the
     141        WEBKIT_TESTFONTS environment variable)
     142        https://bugs.webkit.org/show_bug.cgi?id=42782
     143
     144        Reviewed by Adam Roben.
     145
     146        * WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp:
     147        (WTR::fontsPath):
     148        Copied from DRT code. Removed the fallback to DumpRenderTree.resources/,
     149        as this directory doesn't appear to be created anymore.
     150        (WTR::activateFonts):
     151        Loop through the fonts, and call AddFontResourceExW() for each.
    137152
    1381532010-08-02  Jon Honeycutt  <jhoneycutt@apple.com>
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/win/ActivateFonts.cpp

    r63187 r64601  
    2626#include "ActivateFonts.h"
    2727
     28#include <string>
     29#include <wtf/Vector.h>
     30
     31static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS";
     32
    2833namespace WTR {
     34
     35using namespace std;
     36
     37static const wstring& fontsPath()
     38{
     39    static wstring path;
     40    static bool initialized;
     41
     42    if (initialized)
     43        return path;
     44    initialized = true;
     45
     46    DWORD size = ::GetEnvironmentVariableW(fontsEnvironmentVariable, 0, 0);
     47    Vector<WCHAR> buffer(size);
     48    if (!::GetEnvironmentVariableW(fontsEnvironmentVariable, buffer.data(), buffer.size()))
     49        return path;
     50
     51    path = buffer.data();
     52    if (path[path.length() - 1] != '\\')
     53        path.append(L"\\");
     54
     55    return path;
     56}
     57
    2958
    3059void activateFonts()
    3160{
    32     // FIXME: Not implemented.
     61    static LPCWSTR fontsToInstall[] = {
     62        TEXT("AHEM____.ttf"),
     63        TEXT("Apple Chancery.ttf"),
     64        TEXT("Courier Bold.ttf"),
     65        TEXT("Courier.ttf"),
     66        TEXT("Helvetica Bold Oblique.ttf"),
     67        TEXT("Helvetica Bold.ttf"),
     68        TEXT("Helvetica Oblique.ttf"),
     69        TEXT("Helvetica.ttf"),
     70        TEXT("Helvetica Neue Bold Italic.ttf"),
     71        TEXT("Helvetica Neue Bold.ttf"),
     72        TEXT("Helvetica Neue Condensed Black.ttf"),
     73        TEXT("Helvetica Neue Condensed Bold.ttf"),
     74        TEXT("Helvetica Neue Italic.ttf"),
     75        TEXT("Helvetica Neue Light Italic.ttf"),
     76        TEXT("Helvetica Neue Light.ttf"),
     77        TEXT("Helvetica Neue UltraLight Italic.ttf"),
     78        TEXT("Helvetica Neue UltraLight.ttf"),
     79        TEXT("Helvetica Neue.ttf"),
     80        TEXT("Lucida Grande.ttf"),
     81        TEXT("Lucida Grande Bold.ttf"),
     82        TEXT("Monaco.ttf"),
     83        TEXT("Papyrus.ttf"),
     84        TEXT("Times Bold Italic.ttf"),
     85        TEXT("Times Bold.ttf"),
     86        TEXT("Times Italic.ttf"),
     87        TEXT("Times Roman.ttf"),
     88        TEXT("WebKit Layout Tests 2.ttf"),
     89        TEXT("WebKit Layout Tests.ttf"),
     90        TEXT("WebKitWeightWatcher100.ttf"),
     91        TEXT("WebKitWeightWatcher200.ttf"),
     92        TEXT("WebKitWeightWatcher300.ttf"),
     93        TEXT("WebKitWeightWatcher400.ttf"),
     94        TEXT("WebKitWeightWatcher500.ttf"),
     95        TEXT("WebKitWeightWatcher600.ttf"),
     96        TEXT("WebKitWeightWatcher700.ttf"),
     97        TEXT("WebKitWeightWatcher800.ttf"),
     98        TEXT("WebKitWeightWatcher900.ttf")
     99    };
     100
     101    wstring resourcesPath = fontsPath();
     102
     103    for (unsigned i = 0; i < ARRAYSIZE(fontsToInstall); ++i)
     104        ::AddFontResourceExW(wstring(resourcesPath + fontsToInstall[i]).c_str(), FR_PRIVATE, 0);
    33105}
    34106
Note: See TracChangeset for help on using the changeset viewer.