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

Unified Diff: content/child/font_warmup_win.cc

Issue 1740593002: Use Skia's matchFamilyStyleCharacter API for font fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/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;

Powered by Google App Engine
This is Rietveld 408576698