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

Side by Side Diff: content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.cc

Issue 1883483002: Add code to call skia's matchFamilyStyleCharacter API, which uses the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fallbackproxy
Patch Set: Add expectation for font-fallback failure on Win7 and revert DEPS change Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h" 5 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_init_win.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 sk_sp<SkFontMgr> skia_font_manager(SkFontMgr_New_DirectWrite( 82 sk_sp<SkFontMgr> skia_font_manager(SkFontMgr_New_DirectWrite(
83 factory.Get(), g_font_collection.Get(), font_fallback.Get())); 83 factory.Get(), g_font_collection.Get(), font_fallback.Get()));
84 blink::WebFontRendering::setSkiaFontManager(skia_font_manager.get()); 84 blink::WebFontRendering::setSkiaFontManager(skia_font_manager.get());
85 85
86 // Add an extra ref for SetDefaultSkiaFactory, which keeps a ref but doesn't 86 // Add an extra ref for SetDefaultSkiaFactory, which keeps a ref but doesn't
87 // addref. 87 // addref.
88 skia_font_manager->ref(); 88 skia_font_manager->ref();
89 SetDefaultSkiaFactory(skia_font_manager.get()); 89 SetDefaultSkiaFactory(skia_font_manager.get());
90
91 // When IDWriteFontFallback is not available (prior to Win8.1) Skia will
92 // still attempt to use DirectWrite to determine fallback fonts (in
93 // SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter), which will likely
94 // result in trying to load the system font collection. To avoid that and
95 // instead fall back on WebKit's fallback logic, we don't use Skia's font
96 // fallback if IDWriteFontFallback is not available.
97 // This flag can be removed when Win8.0 and earlier are no longer supported.
98 bool fallback_available = font_fallback.Get() != nullptr;
99 DCHECK_EQ(fallback_available,
100 base::win::GetVersion() > base::win::VERSION_WIN8);
101 blink::WebFontRendering::setUseSkiaFontFallback(fallback_available);
90 } 102 }
91 103
92 void UninitializeDWriteFontProxy() { 104 void UninitializeDWriteFontProxy() {
93 if (g_font_collection) 105 if (g_font_collection)
94 g_font_collection->Unregister(); 106 g_font_collection->Unregister();
95 } 107 }
96 108
97 void SetDWriteFontProxySenderForTesting(IPC::Sender* sender) { 109 void SetDWriteFontProxySenderForTesting(IPC::Sender* sender) {
98 g_sender_override = sender; 110 g_sender_override = sender;
99 } 111 }
100 112
101 } // namespace content 113 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698