Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1815)

Unified Diff: content/shell/app/webkit_test_platform_support_win.cc

Issue 231763003: Support sideloaded fonts via command line option for blink layout_tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: guard for xp Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
« no previous file with comments | « content/renderer/renderer_main_platform_delegate_win.cc ('k') | content/shell/browser/shell_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698