| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 traits = fontDescription.style() ? NSFontItalicTrait : 0; | 148 traits = fontDescription.style() ? NSFontItalicTrait : 0; |
| 149 weight = toAppKitFontWeight(fontDescription.weight()); | 149 weight = toAppKitFontWeight(fontDescription.weight()); |
| 150 size = fontDescription.computedPixelSize(); | 150 size = fontDescription.computedPixelSize(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteF
ont]; | 153 NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteF
ont]; |
| 154 NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont]; | 154 NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont]; |
| 155 | 155 |
| 156 if (traits != substituteFontTraits || weight != substituteFontWeight || !nsF
ont) { | 156 if (traits != substituteFontTraits || weight != substituteFontWeight || !nsF
ont) { |
| 157 if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont
familyName] traits:traits weight:weight size:size]) { | 157 if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont
familyName] traits:traits weight:weight size:size]) { |
| 158 if (!nsFont || (([fontManager traitsOfFont:bestVariation] != substit
uteFontTraits || [fontManager weightOfFont:bestVariation] != substituteFontWeigh
t) | 158 if ((!nsFont || [fontManager traitsOfFont:bestVariation] != substitu
teFontTraits || [fontManager weightOfFont:bestVariation] != substituteFontWeight
) |
| 159 && [[bestVariation coveredCharacterSet] longCharacterIsMember:ch
aracter])) | 159 && [[bestVariation coveredCharacterSet] longCharacterIsMember:ch
aracter]) |
| 160 substituteFont = bestVariation; | 160 substituteFont = bestVariation; |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Enable hinting, which is equivalent to using the screen font, | 164 // Enable hinting, which is equivalent to using the screen font, |
| 165 // only when running the set of standard non-subpixel layout tests, | 165 // only when running the set of standard non-subpixel layout tests, |
| 166 // otherwise use subpixel glyph positioning. | 166 // otherwise use subpixel glyph positioning. |
| 167 substituteFont = !isRunningLayoutTest() || isFontAntialiasingEnabledForTest(
) ? [substituteFont printerFont] : [substituteFont screenFont]; | 167 substituteFont = !isRunningLayoutTest() || isFontAntialiasingEnabledForTest(
) ? [substituteFont printerFont] : [substituteFont screenFont]; |
| 168 | 168 |
| 169 substituteFontTraits = [fontManager traitsOfFont:substituteFont]; | 169 substituteFontTraits = [fontManager traitsOfFont:substituteFont]; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 220 |
| 221 // FontPlatformData::font() can be null for the case of Chromium out-of-proc
ess font loading. | 221 // FontPlatformData::font() can be null for the case of Chromium out-of-proc
ess font loading. |
| 222 // In that case, we don't want to use the platformData. | 222 // In that case, we don't want to use the platformData. |
| 223 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, syntheticBold, syntheticOblique, fontDescription.orientation(), fo
ntDescription.widthVariant())); | 223 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, syntheticBold, syntheticOblique, fontDescription.orientation(), fo
ntDescription.widthVariant())); |
| 224 if (!platformData->font()) | 224 if (!platformData->font()) |
| 225 return 0; | 225 return 0; |
| 226 return platformData.leakPtr(); | 226 return platformData.leakPtr(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace WebCore | 229 } // namespace WebCore |
| OLD | NEW |