Index: content/shell/app/webkit_test_platform_support_win.cc |
diff --git a/content/shell/app/webkit_test_platform_support_win.cc b/content/shell/app/webkit_test_platform_support_win.cc |
index 34c3213b577670ef659f8dd1e64d7aba77a2bd55..536d22e15ba474204906572015071bc4bafb9244 100644 |
--- a/content/shell/app/webkit_test_platform_support_win.cc |
+++ b/content/shell/app/webkit_test_platform_support_win.cc |
@@ -9,11 +9,13 @@ |
#include <list> |
#include <string> |
+#include "base/command_line.h" |
#include "base/file_util.h" |
#include "base/files/file_path.h" |
#include "base/logging.h" |
#include "base/path_service.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "content/shell/common/shell_switches.h" |
#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(struct_name, member) \ |
offsetof(struct_name, member) + \ |
@@ -34,6 +36,12 @@ bool SetupFonts() { |
base::FilePath font_path = |
base_path.Append(FILE_PATH_LITERAL("/AHEM____.TTF")); |
+ // We do two registrations: |
+ // 1. For GDI font rendering via ::AddFontMemResourceEx. |
+ // 2. For DirectWrite rendering by appending a command line flag that tells |
+ // the sandbox policy/warmup to grant access to the given path. |
+ |
+ // GDI registration. |
std::string font_buffer; |
if (!base::ReadFileToString(font_path, &font_buffer)) { |
std::cerr << "Failed to load font " << base::WideToUTF8(font_path.value()) |
@@ -51,6 +59,12 @@ bool SetupFonts() { |
std::cerr << "Failed to register Ahem font\n"; |
return false; |
} |
+ |
+ // DirectWrite sandbox registration. |
+ CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); |
+ command_line.AppendSwitchASCII(switches::kRegisterFontFiles, |
+ base::WideToUTF8(font_path.value())); |
+ |
return true; |
} |