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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for review issues. Created 4 years, 9 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, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (m_fontManager) { 167 if (m_fontManager) {
168 return adoptRef(useDirectWrite() 168 return adoptRef(useDirectWrite()
169 ? m_fontManager->matchFamilyStyle(name.data(), fontStyle(fontDescrip tion)) 169 ? m_fontManager->matchFamilyStyle(name.data(), fontStyle(fontDescrip tion))
170 : m_fontManager->legacyCreateTypeface(name.data(), style) 170 : m_fontManager->legacyCreateTypeface(name.data(), style)
171 ); 171 );
172 } 172 }
173 #endif 173 #endif
174 174
175 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of 175 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of
176 // CreateFromName on all platforms. 176 // CreateFromName on all platforms.
177 return adoptRef(SkTypeface::CreateFromName(name.data(), static_cast<SkTypefa ce::Style>(style))); 177 const SkFontStyle fontStyle(style);
178 return adoptRef(SkTypeface::CreateFromName(name.data(), fontStyle));
178 } 179 }
179 180
180 #if !OS(WIN) 181 #if !OS(WIN)
181 PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescrip tion& fontDescription, 182 PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescrip tion& fontDescription,
182 const FontFaceCreationParams& creationParams, float fontSize) 183 const FontFaceCreationParams& creationParams, float fontSize)
183 { 184 {
184 CString name; 185 CString name;
185 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name)) ; 186 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name)) ;
186 if (!tf) 187 if (!tf)
187 return nullptr; 188 return nullptr;
188 189
189 return adoptPtr(new FontPlatformData(tf, 190 return adoptPtr(new FontPlatformData(tf,
190 name.data(), 191 name.data(),
191 fontSize, 192 fontSize,
192 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(), 193 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(),
193 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), 194 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(),
194 fontDescription.orientation(), 195 fontDescription.orientation(),
195 fontDescription.useSubpixelPositioning())); 196 fontDescription.useSubpixelPositioning()));
196 } 197 }
197 #endif // !OS(WIN) 198 #endif // !OS(WIN)
198 199
199 } // namespace blink 200 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698