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

Unified Diff: content/child/dwrite_font_proxy/dwrite_font_proxy_init_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/dwrite_font_proxy/dwrite_font_proxy_init_win.cc
diff --git a/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc b/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc
index f71e0d81143fc7c8720a7f7da927338aca506e40..245897740b760fab958ef028b4a0756c0ba2e430 100644
--- a/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc
+++ b/content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc
@@ -5,6 +5,7 @@
#include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h"
#include <dwrite.h>
+#include <dwrite_2.h>
#include "base/bind.h"
#include "base/callback.h"
@@ -83,8 +84,17 @@ void InitializeDWriteFontProxy(
}
}
- skia::RefPtr<SkFontMgr> skia_font_manager = skia::AdoptRef(
- SkFontMgr_New_DirectWrite(factory.Get(), g_font_collection.Get()));
+ // DirectWrite font fallback does not work if it is initialized after the
+ // sandbox starts.
+ mswr::ComPtr<IDWriteFactory2> factory2;
+ factory.As<IDWriteFactory2>(&factory2); // QueryInterface
+ mswr::ComPtr<IDWriteFontFallback> font_fallback;
+ if (factory2.Get())
+ factory2->GetSystemFontFallback(&font_fallback);
+
+ skia::RefPtr<SkFontMgr> skia_font_manager =
+ skia::AdoptRef(SkFontMgr_New_DirectWrite(
+ factory.Get(), g_font_collection.Get(), font_fallback.Get()));
blink::WebFontRendering::setSkiaFontManager(skia_font_manager.get());
// Add an extra ref for SetDefaultSkiaFactory, which keeps a ref but doesn't
« no previous file with comments | « no previous file | content/child/font_warmup_win.cc » ('j') | third_party/WebKit/Source/platform/fonts/FontDescription.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698