OLD | NEW |
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 Loading... |
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 SkFontStyle::Slant slant = style() == FontStyleItalic |
| 285 ? SkFontStyle::kItalic_Slant |
| 286 : SkFontStyle::kUpright_Slant; |
| 287 return SkFontStyle(numericFontWeight(weight()), width, slant); |
| 288 static_assert( |
| 289 static_cast<int>(FontStretchUltraCondensed) == static_cast<int>(SkFontSt
yle::kUltraCondensed_Width), |
| 290 "FontStretchUltraCondensed should map to kUltraCondensed_Width"); |
| 291 static_assert( |
| 292 static_cast<int>(FontStretchNormal) == static_cast<int>(SkFontStyle::kNo
rmal_Width), |
| 293 "FontStretchNormal should map to kNormal_Width"); |
| 294 static_assert( |
| 295 static_cast<int>(FontStretchUltraExpanded) == static_cast<int>(SkFontSty
le::kUltaExpanded_Width), |
| 296 "FontStretchUltraExpanded should map to kUltaExpanded_Width"); |
| 297 } |
| 298 |
281 } // namespace blink | 299 } // namespace blink |
OLD | NEW |