Chromium Code Reviews| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 // Bold emoji look the same as normal emoji, so syntheticBold isn't needed. | 209 // Bold emoji look the same as normal emoji, so syntheticBold isn't needed. |
| 210 bool syntheticBold = | 210 bool syntheticBold = |
| 211 isAppKitFontWeightBold(weight) && | 211 isAppKitFontWeightBold(weight) && |
| 212 !isAppKitFontWeightBold(substituteFontWeight) && | 212 !isAppKitFontWeightBold(substituteFontWeight) && |
| 213 ![substituteFont.familyName isEqual:@"Apple Color Emoji"]; | 213 ![substituteFont.familyName isEqual:@"Apple Color Emoji"]; |
| 214 | 214 |
| 215 FontPlatformData alternateFont( | 215 FontPlatformData alternateFont( |
| 216 substituteFont, platformData.size(), syntheticBold, | 216 substituteFont, platformData.size(), syntheticBold, |
| 217 (traits & NSFontItalicTrait) && | 217 (traits & NSFontItalicTrait) && |
| 218 !(substituteFontTraits & NSFontItalicTrait), | 218 !(substituteFontTraits & NSFontItalicTrait), |
| 219 platformData.orientation()); | 219 platformData.orientation(), |
| 220 nullptr); // No variation paramaters in fallback. | |
| 220 | 221 |
| 221 return fontDataFromFontPlatformData(&alternateFont, DoNotRetain); | 222 return fontDataFromFontPlatformData(&alternateFont, DoNotRetain); |
| 222 } | 223 } |
| 223 | 224 |
| 224 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont( | 225 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont( |
| 225 const FontDescription& fontDescription, | 226 const FontDescription& fontDescription, |
| 226 ShouldRetain shouldRetain) { | 227 ShouldRetain shouldRetain) { |
| 227 DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times")); | 228 DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times")); |
| 228 | 229 |
| 229 // 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. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 fontDescription.isSyntheticBold(); | 275 fontDescription.isSyntheticBold(); |
| 275 | 276 |
| 276 bool syntheticItalic = | 277 bool syntheticItalic = |
| 277 ((traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait)) || | 278 ((traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait)) || |
| 278 fontDescription.isSyntheticItalic(); | 279 fontDescription.isSyntheticItalic(); |
| 279 | 280 |
| 280 // FontPlatformData::typeface() is null in the case of Chromium out-of-process | 281 // FontPlatformData::typeface() is null in the case of Chromium out-of-process |
| 281 // font loading failing. Out-of-process loading occurs for registered fonts | 282 // font loading failing. Out-of-process loading occurs for registered fonts |
| 282 // stored in non-system locations. When loading fails, we do not want to use | 283 // stored in non-system locations. When loading fails, we do not want to use |
| 283 // the returned FontPlatformData since it will not have a valid SkTypeface. | 284 // the returned FontPlatformData since it will not have a valid SkTypeface. |
| 284 std::unique_ptr<FontPlatformData> platformData = WTF::wrapUnique( | 285 std::unique_ptr<FontPlatformData> platformData = |
| 285 new FontPlatformData(platformFont, size, syntheticBold, syntheticItalic, | 286 WTF::wrapUnique(new FontPlatformData( |
|
kojii
2016/12/21 14:53:12
nit: nice to change to makeUnique in this opportun
drott
2016/12/21 15:22:00
Done.
| |
| 286 fontDescription.orientation())); | 287 platformFont, size, syntheticBold, syntheticItalic, |
| 288 fontDescription.orientation(), fontDescription.variationSettings())); | |
| 287 if (!platformData->typeface()) { | 289 if (!platformData->typeface()) { |
| 288 return nullptr; | 290 return nullptr; |
| 289 } | 291 } |
| 290 return platformData; | 292 return platformData; |
| 291 } | 293 } |
| 292 | 294 |
| 293 } // namespace blink | 295 } // namespace blink |
| OLD | NEW |