Changeset 91209 in webkit
- Timestamp:
- Jul 18, 2011 2:10:52 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r91206 r91209 1 2011-07-18 Dan Bernstein <mitz@apple.com> 2 3 Specify a cascade list consisting of the last resort font for Core Text 4 https://bugs.webkit.org/show_bug.cgi?id=64747 5 6 Reviewed by Sam Weinig. 7 8 No new tests, because this does not affect behavior. 9 10 This prevents Core Text from taking its default, longer fallback list when the primary font does 11 not include a character. This is OK to do because WebKit never uses the results of Core Text 12 fallback anyway. 13 14 * platform/graphics/cocoa/FontPlatformDataCocoa.mm: 15 (WebCore::cascadeToLastResortFontDescriptor): Added. Returns a CTFontDescriptor with a cascade 16 list consisting of the last resort font. 17 (WebCore::FontPlatformData::ctFont): Changed to include the cascadeToLastResortFontDescriptor 18 in the returned font. 19 1 20 2011-07-18 James Robinson <jamesr@chromium.org> 2 21 -
trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
r87524 r91209 177 177 } 178 178 179 static CTFontDescriptorRef cascadeToLastResortFontDescriptor() 180 { 181 static CTFontDescriptorRef descriptor; 182 if (descriptor) 183 return descriptor; 184 185 const void* keys[] = { kCTFontCascadeListAttribute }; 186 const void* descriptors[] = { CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0) }; 187 const void* values[] = { CFArrayCreate(kCFAllocatorDefault, descriptors, sizeof(descriptors) / sizeof(*descriptors), &kCFTypeArrayCallBacks) }; 188 RetainPtr<CFDictionaryRef> attributes(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault, keys, values, sizeof(keys) / sizeof(*keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 189 190 descriptor = CTFontDescriptorCreateWithAttributes(attributes.get()); 191 192 return descriptor; 193 } 194 179 195 CTFontRef FontPlatformData::ctFont() const 180 196 { 181 if (m_widthVariant == RegularWidth) { 182 if (m_font) 183 return toCTFontRef(m_font); 184 if (!m_CTFont) 185 m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, 0)); 197 if (m_CTFont) 186 198 return m_CTFont.get(); 187 } 188 189 if (!m_CTFont) { 199 200 m_CTFont = toCTFontRef(m_font); 201 if (m_CTFont) 202 m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_size, 0, cascadeToLastResortFontDescriptor())); 203 else 204 m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor())); 205 206 if (m_widthVariant != RegularWidth) { 190 207 int featureTypeValue = kTextSpacingType; 191 208 int featureSelectorValue = mapFontWidthVariantToCTFeatureSelector(m_widthVariant); 192 RetainPtr<CTFontRef> sourceFont(AdoptCF, CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, 0)); 193 RetainPtr<CTFontDescriptorRef> sourceDescriptor(AdoptCF, CTFontCopyFontDescriptor(sourceFont.get())); 209 RetainPtr<CTFontDescriptorRef> sourceDescriptor(AdoptCF, CTFontCopyFontDescriptor(m_CTFont.get())); 194 210 RetainPtr<CFNumberRef> featureType(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeValue)); 195 211 RetainPtr<CFNumberRef> featureSelector(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorValue)); … … 197 213 RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(newDescriptor.get(), m_size, 0)); 198 214 199 m_CTFont = newFont.get() ? newFont : sourceFont; 215 if (newFont) 216 m_CTFont = newFont; 200 217 } 218 201 219 return m_CTFont.get(); 202 220 }
Note: See TracChangeset
for help on using the changeset viewer.