Chromium Code Reviews| Index: content/browser/browser_main_runner.cc |
| diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc |
| index 981ed02ba92494b5449b7691dfd779caa40b95ca..1cec2619978a186cae842f2f57f065110b3e4af9 100644 |
| --- a/content/browser/browser_main_runner.cc |
| +++ b/content/browser/browser_main_runner.cc |
| @@ -28,6 +28,7 @@ |
| #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 |
| @@ -119,9 +120,30 @@ void MaybeEnableDirectWriteFontRendering() { |
| if (gfx::win::ShouldUseDirectWrite() && |
| CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnableDirectWriteForUI) && |
| - CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kEnableHarfBuzzRenderText)) { |
| - SetDefaultSkiaFactory(SkFontMgr_New_DirectWrite(NULL)); |
| + !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. |
| + if (!dwrite_create_factory_proc) { |
| + CHECK(false); |
| + return; |
|
scottmg
2014/10/29 21:33:32
no return
ananta
2014/10/29 21:56:18
Done.
|
| + } |
| + |
| + IDWriteFactory* factory = NULL; |
| + |
| + CHECK(SUCCEEDED( |
| + dwrite_create_factory_proc(DWRITE_FACTORY_TYPE_SHARED, |
| + __uuidof(IDWriteFactory), |
| + reinterpret_cast<IUnknown**>(&factory)))); |
| + SetDefaultSkiaFactory(SkFontMgr_New_DirectWrite(factory)); |
| + gfx::PlatformFontWin::set_direct_write_factory(factory); |
| } |
| } |