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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp

Issue 1591883002: Add plumbing in blink to allow overriding the default font collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add back the option to use blink with DirectWrite without specifying a font manager, which was appa… 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. 2 * Copyright (C) 2006, 2007 Apple Computer, Inc.
3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // static 90 // static
91 void FontCache::setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig ht) 91 void FontCache::setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig ht)
92 { 92 {
93 s_statusFontFamilyName = new AtomicString(familyName); 93 s_statusFontFamilyName = new AtomicString(familyName);
94 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); 94 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight);
95 } 95 }
96 96
97 FontCache::FontCache() 97 FontCache::FontCache()
98 : m_purgePreventCount(0) 98 : m_purgePreventCount(0)
99 { 99 {
100 SkFontMgr* fontManager; 100 if (s_fontManager) {
101 101 adopted(s_fontManager);
bungeman-chromium 2016/02/09 22:25:17 The adoption checks are only done in debug, so 'ad
jbroman 2016/02/09 22:31:30 Well, it does exist here: https://code.google.com/
bungeman-chromium 2016/02/09 22:36:05 Note that adding 'using WTF::adopted' should work
102 if (s_useDirectWrite) { 102 m_fontManager = s_fontManager;
103 fontManager = SkFontMgr_New_DirectWrite(s_directWriteFactory); 103 } else if (s_useDirectWrite) {
104 s_useSubpixelPositioning = true; 104 m_fontManager = adoptRef(SkFontMgr_New_DirectWrite());
bungeman-chromium 2016/02/04 21:40:32 I'm assuming this is only true then not running in
Ilya Kulshin 2016/02/05 02:02:47 Yes, I believe this case only happens during tests
105 } else { 105 } else {
106 fontManager = SkFontMgr_New_GDI(); 106 m_fontManager = adoptRef(SkFontMgr_New_GDI());
107 // Subpixel text positioning is not supported by the GDI backend.
108 s_useSubpixelPositioning = false;
109 } 107 }
110 108
111 ASSERT(fontManager); 109 // Subpixel text positioning is only supported by the DirectWrite backend (n ot GDI).
112 m_fontManager = adoptPtr(fontManager); 110 s_useSubpixelPositioning = s_useDirectWrite;
111
112 ASSERT(m_fontManager.get());
113 } 113 }
114 114
115 115
116 // Given the desired base font, this will create a SimpleFontData for a specific 116 // Given the desired base font, this will create a SimpleFontData for a specific
117 // font that can be used to render the given range of characters. 117 // font that can be used to render the given range of characters.
118 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( 118 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(
119 const FontDescription& fontDescription, UChar32 character, 119 const FontDescription& fontDescription, UChar32 character,
120 const SimpleFontData* originalFontData) 120 const SimpleFontData* originalFontData)
121 { 121 {
122 // First try the specified font with standard style & weight. 122 // First try the specified font with standard style & weight.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (typefacesMatchesFamily(tf.get(), family)) { 420 if (typefacesMatchesFamily(tf.get(), family)) {
421 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); 421 result->setMinSizeForSubpixel(minSizeForSubpixelForFont);
422 break; 422 break;
423 } 423 }
424 } 424 }
425 425
426 return result.release(); 426 return result.release();
427 } 427 }
428 428
429 } // namespace blink 429 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontCache.cpp ('k') | third_party/WebKit/Source/web/win/WebFontRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698