Index: content/child/font_warmup_win.cc |
diff --git a/content/child/font_warmup_win.cc b/content/child/font_warmup_win.cc |
index 33d18075f642e518a148ade4e5808f83d791a259..bae981c296f35ae907218daa91f7f3eda8126a31 100644 |
--- a/content/child/font_warmup_win.cc |
+++ b/content/child/font_warmup_win.cc |
@@ -5,6 +5,7 @@ |
#include "content/child/font_warmup_win.h" |
#include <dwrite.h> |
+#include <dwrite_2.h> |
#include <stdint.h> |
#include <map> |
@@ -21,6 +22,7 @@ |
#include "base/sys_byteorder.h" |
#include "base/trace_event/trace_event.h" |
#include "base/win/iat_patch_function.h" |
+#include "base/win/scoped_comptr.h" |
#include "base/win/windows_version.h" |
#include "content/public/common/dwrite_font_platform_win.h" |
#include "ppapi/shared_impl/proxy_lock.h" |
@@ -458,8 +460,16 @@ SkFontMgr* GetPreSandboxWarmupFontMgr() { |
IDWriteFactory* factory; |
CreateDirectWriteFactory(&factory); |
- g_warmup_fontmgr = |
- SkFontMgr_New_DirectWrite(factory, GetCustomFontCollection(factory)); |
+ // DirectWrite font fallback does not work if it is initialized after the |
+ // sandbox starts. |
+ base::win::ScopedComPtr<IDWriteFactory2> factory2; |
+ factory->QueryInterface<IDWriteFactory2>(factory2.Receive()); |
+ base::win::ScopedComPtr<IDWriteFontFallback> font_fallback; |
+ if (factory2.get()) |
+ factory2->GetSystemFontFallback(font_fallback.Receive()); |
+ |
+ g_warmup_fontmgr = SkFontMgr_New_DirectWrite( |
+ factory, GetCustomFontCollection(factory), font_fallback.get()); |
blink::WebFontRendering::setSkiaFontManager(g_warmup_fontmgr); |
} |
return g_warmup_fontmgr; |