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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 NSFont *nsFont = platformData.font(); | 109 NSFont *nsFont = platformData.font(); |
110 | 110 |
111 NSString *string = [[NSString alloc] initWithCharactersNoCopy:codeUnits leng
th:codeUnitsLength freeWhenDone:NO]; | 111 NSString *string = [[NSString alloc] initWithCharactersNoCopy:codeUnits leng
th:codeUnitsLength freeWhenDone:NO]; |
112 NSFont *substituteFont = [NSFont findFontLike:nsFont forString:string withRa
nge:NSMakeRange(0, codeUnitsLength) inLanguage:nil]; | 112 NSFont *substituteFont = [NSFont findFontLike:nsFont forString:string withRa
nge:NSMakeRange(0, codeUnitsLength) inLanguage:nil]; |
113 [string release]; | 113 [string release]; |
114 | 114 |
115 // FIXME: Remove this SPI usage: http://crbug.com/255122 | 115 // FIXME: Remove this SPI usage: http://crbug.com/255122 |
116 if (!substituteFont && codeUnitsLength == 1) | 116 if (!substituteFont && codeUnitsLength == 1) |
117 substituteFont = [NSFont findFontLike:nsFont forCharacter:codeUnits[0] i
nLanguage:nil]; | 117 substituteFont = [NSFont findFontLike:nsFont forCharacter:codeUnits[0] i
nLanguage:nil]; |
118 if (!substituteFont) | 118 if (!substituteFont) |
119 return 0; | 119 return nullptr; |
120 | 120 |
121 // Chromium can't render AppleColorEmoji. | 121 // Chromium can't render AppleColorEmoji. |
122 if ([[substituteFont familyName] isEqual:@"Apple Color Emoji"]) | 122 if ([[substituteFont familyName] isEqual:@"Apple Color Emoji"]) |
123 return 0; | 123 return nullptr; |
124 | 124 |
125 // Use the family name from the AppKit-supplied substitute font, requesting
the | 125 // Use the family name from the AppKit-supplied substitute font, requesting
the |
126 // traits, weight, and size we want. One way this does better than the origi
nal | 126 // traits, weight, and size we want. One way this does better than the origi
nal |
127 // AppKit request is that it takes synthetic bold and oblique into account. | 127 // AppKit request is that it takes synthetic bold and oblique into account. |
128 // But it does create the possibility that we could end up with a font that | 128 // But it does create the possibility that we could end up with a font that |
129 // doesn't actually cover the characters we need. | 129 // doesn't actually cover the characters we need. |
130 | 130 |
131 NSFontManager *fontManager = [NSFontManager sharedFontManager]; | 131 NSFontManager *fontManager = [NSFontManager sharedFontManager]; |
132 | 132 |
133 NSFontTraitMask traits; | 133 NSFontTraitMask traits; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 // FontPlatformData::font() can be null for the case of Chromium out-of-proc
ess font loading. | 214 // FontPlatformData::font() can be null for the case of Chromium out-of-proc
ess font loading. |
215 // In that case, we don't want to use the platformData. | 215 // In that case, we don't want to use the platformData. |
216 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique,
fontDescription.orientation(), fontDescription.widthVariant())); | 216 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique,
fontDescription.orientation(), fontDescription.widthVariant())); |
217 if (!platformData->font()) | 217 if (!platformData->font()) |
218 return 0; | 218 return 0; |
219 return platformData.leakPtr(); | 219 return platformData.leakPtr(); |
220 } | 220 } |
221 | 221 |
222 } // namespace WebCore | 222 } // namespace WebCore |
OLD | NEW |