| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 NSFontManager *fontManager = [NSFontManager sharedFontManager]; | 223 NSFontManager *fontManager = [NSFontManager sharedFontManager]; |
| 224 NSFontTraitMask actualTraits = 0; | 224 NSFontTraitMask actualTraits = 0; |
| 225 if (fontDescription.italic()) | 225 if (fontDescription.italic()) |
| 226 actualTraits = [fontManager traitsOfFont:nsFont]; | 226 actualTraits = [fontManager traitsOfFont:nsFont]; |
| 227 NSInteger actualWeight = [fontManager weightOfFont:nsFont]; | 227 NSInteger actualWeight = [fontManager weightOfFont:nsFont]; |
| 228 | 228 |
| 229 NSFont *platformFont = fontDescription.usePrinterFont() ? [nsFont printerFon
t] : [nsFont screenFont]; | 229 NSFont *platformFont = fontDescription.usePrinterFont() ? [nsFont printerFon
t] : [nsFont screenFont]; |
| 230 bool syntheticBold = isAppKitFontWeightBold(weight) && !isAppKitFontWeightBo
ld(actualWeight); | 230 bool syntheticBold = isAppKitFontWeightBold(weight) && !isAppKitFontWeightBo
ld(actualWeight); |
| 231 bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSF
ontItalicTrait); | 231 bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSF
ontItalicTrait); |
| 232 | 232 |
| 233 return new FontPlatformData(platformFont, size, syntheticBold, syntheticObli
que, fontDescription.orientation(), fontDescription.textOrientation(), fontDescr
iption.widthVariant()); | 233 // FontPlatformData::font() can be null for the case of Chromium out-of-proc
ess font loading. |
| 234 // In that case, we don't want to use the platformData. |
| 235 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, syntheticBold, syntheticOblique, fontDescription.orientation(), fo
ntDescription.textOrientation(), fontDescription.widthVariant())); |
| 236 if (!platformData->font()) |
| 237 return 0; |
| 238 return platformData.leakPtr(); |
| 234 } | 239 } |
| 235 | 240 |
| 236 } // namespace WebCore | 241 } // namespace WebCore |
| OLD | NEW |