| 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..78913638696a33bf6510925bc6061296490868c9 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,27 @@ 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.
|
| + CHECK(dwrite_create_factory_proc);
|
| +
|
| + 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);
|
| }
|
| }
|
|
|
|
|