| OLD | NEW |
| 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 Loading... |
| 167 static inline SkFontStyle fontStyle(const FontDescription& fontDescription) | 167 static inline SkFontStyle fontStyle(const FontDescription& fontDescription) |
| 168 { | 168 { |
| 169 int width = static_cast<int>(fontDescription.stretch()); | 169 int width = static_cast<int>(fontDescription.stretch()); |
| 170 int weight = (fontDescription.weight() - FontWeight100 + 1) * 100; | 170 int weight = (fontDescription.weight() - FontWeight100 + 1) * 100; |
| 171 SkFontStyle::Slant slant = fontDescription.style() == FontStyleItalic | 171 SkFontStyle::Slant slant = fontDescription.style() == FontStyleItalic |
| 172 ? SkFontStyle::kItalic_Slant | 172 ? SkFontStyle::kItalic_Slant |
| 173 : SkFontStyle::kUpright_Slant; | 173 : SkFontStyle::kUpright_Slant; |
| 174 return SkFontStyle(weight, width, slant); | 174 return SkFontStyle(weight, width, slant); |
| 175 } | 175 } |
| 176 | 176 |
| 177 COMPILE_ASSERT(static_cast<int>(FontStretchUltraCondensed) == static_cast<int>(S
kFontStyle::kUltraCondensed_Width), | 177 static_assert(static_cast<int>(FontStretchUltraCondensed) == static_cast<int>(Sk
FontStyle::kUltraCondensed_Width), |
| 178 FontStretchUltraCondensedMapsTokUltraCondensed_Width); | 178 "FontStretchUltraCondensed should map to kUltraCondensed_Width"); |
| 179 COMPILE_ASSERT(static_cast<int>(FontStretchNormal) == static_cast<int>(SkFontSty
le::kNormal_Width), | 179 static_assert(static_cast<int>(FontStretchNormal) == static_cast<int>(SkFontStyl
e::kNormal_Width), |
| 180 FontStretchNormalMapsTokNormal_Width); | 180 "FontStretchNormal should map to kNormal_Width"); |
| 181 COMPILE_ASSERT(static_cast<int>(FontStretchUltraExpanded) == static_cast<int>(Sk
FontStyle::kUltaExpanded_Width), | 181 static_assert(static_cast<int>(FontStretchUltraExpanded) == static_cast<int>(SkF
ontStyle::kUltaExpanded_Width), |
| 182 FontStretchUltraExpandedMapsTokUltaExpanded_Width); | 182 "FontStretchUltraExpanded should map to kUltaExpanded_Width"); |
| 183 #endif | 183 #endif |
| 184 | 184 |
| 185 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) | 185 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) |
| 186 { | 186 { |
| 187 #if !OS(WIN) && !OS(ANDROID) | 187 #if !OS(WIN) && !OS(ANDROID) |
| 188 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { | 188 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { |
| 189 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after | 189 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after |
| 190 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed. | 190 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed. |
| 191 SkTypeface* typeface = nullptr; | 191 SkTypeface* typeface = nullptr; |
| 192 if (Platform::current()->sandboxSupport()) | 192 if (Platform::current()->sandboxSupport()) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 fontSize, | 251 fontSize, |
| 252 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), | 252 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), |
| 253 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), | 253 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), |
| 254 fontDescription.orientation(), | 254 fontDescription.orientation(), |
| 255 fontDescription.useSubpixelPositioning()); | 255 fontDescription.useSubpixelPositioning()); |
| 256 return result; | 256 return result; |
| 257 } | 257 } |
| 258 #endif // !OS(WIN) | 258 #endif // !OS(WIN) |
| 259 | 259 |
| 260 } // namespace blink | 260 } // namespace blink |
| OLD | NEW |