| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont( | 225 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont( |
| 226 const FontDescription& fontDescription, | 226 const FontDescription& fontDescription, |
| 227 ShouldRetain shouldRetain) { | 227 ShouldRetain shouldRetain) { |
| 228 DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times")); | 228 DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times")); |
| 229 | 229 |
| 230 // FIXME: Would be even better to somehow get the user's default font here. | 230 // FIXME: Would be even better to somehow get the user's default font here. |
| 231 // For now we'll pick the default that the user would get without changing | 231 // For now we'll pick the default that the user would get without changing |
| 232 // any prefs. | 232 // any prefs. |
| 233 RefPtr<SimpleFontData> simpleFontData = | 233 RefPtr<SimpleFontData> simpleFontData = |
| 234 getFontData(fontDescription, timesStr, false, shouldRetain); | 234 getFontData(fontDescription, timesStr, AlternateFontName::AllowAlternate, |
| 235 shouldRetain); |
| 235 if (simpleFontData) | 236 if (simpleFontData) |
| 236 return simpleFontData.release(); | 237 return simpleFontData.release(); |
| 237 | 238 |
| 238 // The Times fallback will almost always work, but in the highly unusual case | 239 // The Times fallback will almost always work, but in the highly unusual case |
| 239 // where the user doesn't have it, we fall back on Lucida Grande because | 240 // where the user doesn't have it, we fall back on Lucida Grande because |
| 240 // that's guaranteed to be there, according to Nathan Taylor. This is good | 241 // that's guaranteed to be there, according to Nathan Taylor. This is good |
| 241 // enough to avoid a crash at least. | 242 // enough to avoid a crash at least. |
| 242 DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande")); | 243 DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande")); |
| 243 return getFontData(fontDescription, lucidaGrandeStr, false, shouldRetain); | 244 return getFontData(fontDescription, lucidaGrandeStr, |
| 245 AlternateFontName::AllowAlternate, shouldRetain); |
| 244 } | 246 } |
| 245 | 247 |
| 246 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData( | 248 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData( |
| 247 const FontDescription& fontDescription, | 249 const FontDescription& fontDescription, |
| 248 const FontFaceCreationParams& creationParams, | 250 const FontFaceCreationParams& creationParams, |
| 249 float fontSize) { | 251 float fontSize, |
| 252 AlternateFontName) { |
| 250 NSFontTraitMask traits = fontDescription.style() ? NSFontItalicTrait : 0; | 253 NSFontTraitMask traits = fontDescription.style() ? NSFontItalicTrait : 0; |
| 251 float size = fontSize; | 254 float size = fontSize; |
| 252 | 255 |
| 253 NSFont* nsFont = MatchNSFontFamily(creationParams.family(), traits, | 256 NSFont* nsFont = MatchNSFontFamily(creationParams.family(), traits, |
| 254 fontDescription.weight(), size); | 257 fontDescription.weight(), size); |
| 255 if (!nsFont) | 258 if (!nsFont) |
| 256 return nullptr; | 259 return nullptr; |
| 257 | 260 |
| 258 NSFontManager* fontManager = [NSFontManager sharedFontManager]; | 261 NSFontManager* fontManager = [NSFontManager sharedFontManager]; |
| 259 NSFontTraitMask actualTraits = 0; | 262 NSFontTraitMask actualTraits = 0; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 286 WTF::makeUnique<FontPlatformData>( | 289 WTF::makeUnique<FontPlatformData>( |
| 287 platformFont, size, syntheticBold, syntheticItalic, | 290 platformFont, size, syntheticBold, syntheticItalic, |
| 288 fontDescription.orientation(), fontDescription.variationSettings()); | 291 fontDescription.orientation(), fontDescription.variationSettings()); |
| 289 if (!platformData->typeface()) { | 292 if (!platformData->typeface()) { |
| 290 return nullptr; | 293 return nullptr; |
| 291 } | 294 } |
| 292 return platformData; | 295 return platformData; |
| 293 } | 296 } |
| 294 | 297 |
| 295 } // namespace blink | 298 } // namespace blink |
| OLD | NEW |