Index: content/browser/browser_main_runner.cc |
diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc |
index 491f6c0fd8e5a20438dd955f660c79e05a7d4a00..2975ef864747646aec4a2fa68028d0c697b1bb66 100644 |
--- a/content/browser/browser_main_runner.cc |
+++ b/content/browser/browser_main_runner.cc |
@@ -20,17 +20,11 @@ |
#include "ui/base/ime/input_method_initializer.h" |
#if defined(OS_WIN) |
-#include <dwrite.h> |
-#include "base/win/scoped_comptr.h" |
#include "base/win/win_util.h" |
#include "base/win/windows_version.h" |
#include "net/cert/sha256_legacy_support_win.h" |
#include "sandbox/win/src/sidestep/preamble_patcher.h" |
-#include "skia/ext/fontmgr_default_win.h" |
-#include "third_party/skia/include/ports/SkFontMgr.h" |
-#include "third_party/skia/include/ports/SkTypeface_win.h" |
#include "ui/base/win/scoped_ole_initializer.h" |
-#include "ui/gfx/platform_font_win.h" |
#include "ui/gfx/switches.h" |
#include "ui/gfx/win/direct_write.h" |
#endif |
@@ -118,43 +112,6 @@ void InstallSha256LegacyHooks() { |
#endif // _WIN64 |
} |
-void MaybeEnableDirectWriteFontRendering() { |
- if (gfx::win::ShouldUseDirectWrite() && |
- !CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kDisableDirectWriteForUI) && |
- !CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kDisableHarfBuzzRenderText)) { |
- typedef decltype(DWriteCreateFactory)* DWriteCreateFactoryProc; |
- HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll"); |
- if (!dwrite_dll) |
- return; |
- |
- DWriteCreateFactoryProc dwrite_create_factory_proc = |
- reinterpret_cast<DWriteCreateFactoryProc>( |
- GetProcAddress(dwrite_dll, "DWriteCreateFactory")); |
- // Not finding the DWriteCreateFactory function indicates a corrupt dll. |
- CHECK(dwrite_create_factory_proc); |
- |
- base::win::ScopedComPtr<IDWriteFactory> factory; |
- |
- CHECK(SUCCEEDED( |
- dwrite_create_factory_proc( |
- DWRITE_FACTORY_TYPE_SHARED, |
- __uuidof(IDWriteFactory), |
- reinterpret_cast<IUnknown**>(factory.Receive())))); |
- // The skia call to create a new DirectWrite font manager instance can fail |
- // if we are unable to get the system font collection from the DirectWrite |
- // factory. The GetSystemFontCollection method in the IDWriteFactory |
- // interface fails with E_INVALIDARG on certain Windows 7 gold versions |
- // (6.1.7600.*). We should just use GDI in these cases. |
- SkFontMgr* direct_write_font_mgr = SkFontMgr_New_DirectWrite(factory.get()); |
- if (direct_write_font_mgr) { |
- SetDefaultSkiaFactory(direct_write_font_mgr); |
- gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); |
- } |
- } |
-} |
- |
} // namespace |
#endif // OS_WIN |
@@ -208,7 +165,7 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { |
// on Windows 8 Metro mode. |
ole_initializer_.reset(new ui::ScopedOleInitializer); |
// Enable DirectWrite font rendering if needed. |
- MaybeEnableDirectWriteFontRendering(); |
+ gfx::win::MaybeInitializeDirectWrite(); |
#endif // OS_WIN |
main_loop_.reset(new BrowserMainLoop(parameters)); |