Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: Source/platform/fonts/mac/FontCacheMac.mm

Issue 139243002: StringImpl should not be referred from StringImplCF. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed AtomicStringCF.cpp Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande", AtomicS tring::ConstructFromLiteral)); 190 DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande", AtomicS tring::ConstructFromLiteral));
191 return getFontData(fontDescription, lucidaGrandeStr, false, shouldRetain); 191 return getFontData(fontDescription, lucidaGrandeStr, false, shouldRetain);
192 } 192 }
193 193
194 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD escription, const AtomicString& family, float fontSize) 194 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD escription, const AtomicString& family, float fontSize)
195 { 195 {
196 NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0; 196 NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0;
197 NSInteger weight = toAppKitFontWeight(fontDescription.weight()); 197 NSInteger weight = toAppKitFontWeight(fontDescription.weight());
198 float size = fontSize; 198 float size = fontSize;
199 199
200 NSFont *nsFont = [WebFontCache fontWithFamily:family traits:traits weight:we ight size:size]; 200 NSString *nsFontFamily = [[NSString alloc] initWithUTF8String:family.utf8(). data()];
201 NSFont *nsFont = [WebFontCache fontWithFamily:nsFontFamily traits:traits wei ght:weight size:size];
202 [nsFontFamily release];
201 if (!nsFont) 203 if (!nsFont)
202 return 0; 204 return 0;
203 205
204 NSFontManager *fontManager = [NSFontManager sharedFontManager]; 206 NSFontManager *fontManager = [NSFontManager sharedFontManager];
205 NSFontTraitMask actualTraits = 0; 207 NSFontTraitMask actualTraits = 0;
206 if (fontDescription.italic()) 208 if (fontDescription.italic())
207 actualTraits = [fontManager traitsOfFont:nsFont]; 209 actualTraits = [fontManager traitsOfFont:nsFont];
208 NSInteger actualWeight = [fontManager weightOfFont:nsFont]; 210 NSInteger actualWeight = [fontManager weightOfFont:nsFont];
209 211
210 NSFont *platformFont = fontDescription.usePrinterFont() ? [nsFont printerFon t] : [nsFont screenFont]; 212 NSFont *platformFont = fontDescription.usePrinterFont() ? [nsFont printerFon t] : [nsFont screenFont];
211 bool syntheticBold = (isAppKitFontWeightBold(weight) && !isAppKitFontWeightB old(actualWeight)) || fontDescription.isSyntheticBold(); 213 bool syntheticBold = (isAppKitFontWeightBold(weight) && !isAppKitFontWeightB old(actualWeight)) || fontDescription.isSyntheticBold();
212 bool syntheticOblique = ((traits & NSFontItalicTrait) && !(actualTraits & NS FontItalicTrait)) || fontDescription.isSyntheticItalic(); 214 bool syntheticOblique = ((traits & NSFontItalicTrait) && !(actualTraits & NS FontItalicTrait)) || fontDescription.isSyntheticItalic();
213 215
214 // FontPlatformData::font() can be null for the case of Chromium out-of-proc ess font loading. 216 // 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. 217 // 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())); 218 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo rmFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant()));
217 if (!platformData->font()) 219 if (!platformData->font())
218 return 0; 220 return 0;
219 return platformData.leakPtr(); 221 return platformData.leakPtr();
220 } 222 }
221 223
222 } // namespace WebCore 224 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698