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