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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if (character <= 0xFFFF) { | 110 if (character <= 0xFFFF) { |
111 codeUnits[0] = character; | 111 codeUnits[0] = character; |
112 codeUnitsLength = 1; | 112 codeUnitsLength = 1; |
113 } else { | 113 } else { |
114 codeUnits[0] = U16_LEAD(character); | 114 codeUnits[0] = U16_LEAD(character); |
115 codeUnits[1] = U16_TRAIL(character); | 115 codeUnits[1] = U16_TRAIL(character); |
116 codeUnitsLength = 2; | 116 codeUnitsLength = 2; |
117 } | 117 } |
118 | 118 |
119 const FontPlatformData& platformData = fontDataToSubstitute->platformData(); | 119 const FontPlatformData& platformData = fontDataToSubstitute->platformData(); |
120 NSFont *nsFont = platformData.font(); | 120 const NSFont *platformDataFont = platformData.font(); |
| 121 NSFont* nsFont = [platformDataFont copyWithZone:NULL]; |
121 | 122 |
122 NSString *string = [[NSString alloc] initWithCharactersNoCopy:codeUnits leng
th:codeUnitsLength freeWhenDone:NO]; | 123 NSString *string = [[NSString alloc] initWithCharactersNoCopy:codeUnits leng
th:codeUnitsLength freeWhenDone:NO]; |
123 NSFont *substituteFont = [NSFont findFontLike:nsFont forString:string withRa
nge:NSMakeRange(0, codeUnitsLength) inLanguage:nil]; | 124 NSFont *substituteFont = [NSFont findFontLike:nsFont forString:string withRa
nge:NSMakeRange(0, codeUnitsLength) inLanguage:nil]; |
124 [string release]; | 125 [string release]; |
125 | 126 |
126 // FIXME: Remove this SPI usage: http://crbug.com/255122 | 127 // FIXME: Remove this SPI usage: http://crbug.com/255122 |
127 if (!substituteFont && codeUnitsLength == 1) | 128 if (!substituteFont && codeUnitsLength == 1) |
128 substituteFont = [NSFont findFontLike:nsFont forCharacter:codeUnits[0] i
nLanguage:nil]; | 129 substituteFont = [NSFont findFontLike:nsFont forCharacter:codeUnits[0] i
nLanguage:nil]; |
129 if (!substituteFont) | 130 if (!substituteFont) |
130 return nullptr; | 131 return nullptr; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 221 |
221 // FontPlatformData::font() can be null for the case of Chromium out-of-proc
ess font loading. | 222 // 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. | 223 // In that case, we don't want to use the platformData. |
223 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); | 224 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo
rmFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); |
224 if (!platformData->font()) | 225 if (!platformData->font()) |
225 return 0; | 226 return 0; |
226 return platformData.leakPtr(); | 227 return platformData.leakPtr(); |
227 } | 228 } |
228 | 229 |
229 } // namespace blink | 230 } // namespace blink |
OLD | NEW |