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

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

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, 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) 2007 Nicholas Shanks <contact@nickshanks.com> 2 * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com>
3 * Copyright (C) 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2008 Apple 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 addFloatToHash(hash, m_adjustedSize); 271 addFloatToHash(hash, m_adjustedSize);
272 addFloatToHash(hash, m_sizeAdjust); 272 addFloatToHash(hash, m_sizeAdjust);
273 addFloatToHash(hash, m_letterSpacing); 273 addFloatToHash(hash, m_letterSpacing);
274 addFloatToHash(hash, m_wordSpacing); 274 addFloatToHash(hash, m_wordSpacing);
275 addToHash(hash, m_fieldsAsUnsigned[0]); 275 addToHash(hash, m_fieldsAsUnsigned[0]);
276 addToHash(hash, m_fieldsAsUnsigned[1]); 276 addToHash(hash, m_fieldsAsUnsigned[1]);
277 277
278 return hash; 278 return hash;
279 } 279 }
280 280
281 SkFontStyle FontDescription::skiaFontStyle() const
282 {
283 int width = static_cast<int>(stretch());
284 int fontWeight = (weight() - FontWeight100 + 1) * 100;
eae 2016/02/29 23:11:26 We might want to add a helper for this. numericFon
Ilya Kulshin 2016/03/01 03:31:14 Done. Added a helper, although perhaps the actual
285 SkFontStyle::Slant slant = style() == FontStyleItalic
286 ? SkFontStyle::kItalic_Slant
287 : SkFontStyle::kUpright_Slant;
288 return SkFontStyle(fontWeight, width, slant);
289 static_assert(static_cast<int>(FontStretchUltraCondensed) == static_cast<int >(SkFontStyle::kUltraCondensed_Width),
290 "FontStretchUltraCondensed should map to kUltraCondensed_Width");
291 static_assert(static_cast<int>(FontStretchNormal) == static_cast<int>(SkFont Style::kNormal_Width),
292 "FontStretchNormal should map to kNormal_Width");
293 static_assert(static_cast<int>(FontStretchUltraExpanded) == static_cast<int> (SkFontStyle::kUltaExpanded_Width),
294 "FontStretchUltraExpanded should map to kUltaExpanded_Width");
295 }
296
281 } // namespace blink 297 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698