Changeset 188146 in webkit
- Timestamp:
- Aug 7, 2015 12:09:59 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r188143 r188146 1 2015-08-07 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Implement font-feature-settings 4 https://bugs.webkit.org/show_bug.cgi?id=147722 5 6 Reviewed by Simon Fraser. 7 8 Until I can make a custom font for reference tests, use a simple dump-render-tree test. 9 10 * css3/font-feature-settings-preinstalled-fonts.html: Added. 11 * platform/mac-yosemite/css3/font-feature-settings-preinstalled-fonts-expected.txt: Added. 12 1 13 2015-08-07 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r188145 r188146 1 2015-08-07 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Implement font-feature-settings 4 https://bugs.webkit.org/show_bug.cgi?id=147722 5 6 Reviewed by Simon Fraser. 7 8 Fonts with features are simply modeled as new font objects. Font 9 feature information is contained within FontDescription, and our 10 caches are correctly sensitive to this information. Therefore, 11 we just need to make our font lookup code honor the request to 12 use certain features. 13 14 This patch creates a file, FontCacheCoreText.cpp, which will be the 15 new home of all shared OS X / iOS FontCache code. Over time, I will 16 be moving more and more source into this file, until there is 17 nothing left of FontCacheMac.mm and FontCacheIOS.mm. For now, the 18 only function in this file is the code which applies font features. 19 20 Test: css3/font-feature-settings-preinstalled-fonts.html 21 22 * WebCore.xcodeproj/project.pbxproj: Add FontCacheCoreText.cpp. 23 * platform/graphics/FontCache.h: 24 * platform/graphics/cocoa/FontCacheCoreText.cpp: Added. 25 (WebCore::appendTrueTypeFeature): What the name says. 26 (WebCore::appendOpenTypeFeature): Ditto. 27 (WebCore::applyFontFeatureSettings): Ditto. 28 * platform/graphics/ios/FontCacheIOS.mm: 29 (WebCore::FontCache::getSystemFontFallbackForCharacters): Call 30 applyFontFeatureSettings(). 31 (WebCore::FontCache::createFontPlatformData): Ditto. 32 * platform/graphics/mac/FontCacheMac.mm: 33 (WebCore::fontWithFamily): Ditto. 34 (WebCore::FontCache::systemFallbackForCharacters): Ditto. 35 (WebCore::FontCache::createFontPlatformData): Ditto. 36 * platform/graphics/mac/FontCustomPlatformData.cpp: 37 (WebCore::FontCustomPlatformData::fontPlatformData): Ditto. 38 * rendering/RenderThemeIOS.mm: 39 (WebCore::RenderThemeIOS::updateCachedSystemFontDescription): 40 Ditto. 41 1 42 2015-08-07 Commit Queue <commit-queue@webkit.org> 2 43 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r188127 r188146 952 952 1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C2649790D7E248A00BD10F2 /* DocumentLoaderMac.cpp */; }; 953 953 1C26497C0D7E24EC00BD10F2 /* PageMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */; }; 954 1C3969D01B74211E002BCFA7 /* FontCacheCoreText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C3969CF1B74211E002BCFA7 /* FontCacheCoreText.cpp */; }; 954 955 1C6466251A12C38E0094603C /* CoreTextSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C5E980F1A02CEFA002DB55F /* CoreTextSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 955 956 1C6466281A12C4200094603C /* NSFontSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C6466271A12C3F90094603C /* NSFontSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8117 8118 1C2649790D7E248A00BD10F2 /* DocumentLoaderMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentLoaderMac.cpp; sourceTree = "<group>"; }; 8118 8119 1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageMac.cpp; sourceTree = "<group>"; }; 8120 1C3969CF1B74211E002BCFA7 /* FontCacheCoreText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontCacheCoreText.cpp; sourceTree = "<group>"; }; 8119 8121 1C5E980F1A02CEFA002DB55F /* CoreTextSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreTextSPI.h; sourceTree = "<group>"; }; 8120 8122 1C6466271A12C3F90094603C /* NSFontSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSFontSPI.h; sourceTree = "<group>"; }; … … 21259 21261 isa = PBXGroup; 21260 21262 children = ( 21263 1C3969CF1B74211E002BCFA7 /* FontCacheCoreText.cpp */, 21261 21264 B2AFFC780D00A5C10030074D /* FontCascadeCocoa.mm */, 21262 21265 7C4EDD731A7B607800198C4D /* FontCocoa.mm */, … … 29997 30000 93F19AD508245E59001E9ABC /* RenderTreeAsText.cpp in Sources */, 29998 30001 5824ABAA1AE849C8009074B7 /* RenderTreePosition.cpp in Sources */, 30002 1C3969D01B74211E002BCFA7 /* FontCacheCoreText.cpp in Sources */, 29999 30003 E44614510CD68A3500FADA75 /* RenderVideo.cpp in Sources */, 30000 30004 BCEA4867097D93020094C9E4 /* RenderView.cpp in Sources */, -
trunk/Source/WebCore/platform/graphics/FontCache.h
r188114 r188146 41 41 #include <wtf/text/WTFString.h> 42 42 43 #if PLATFORM( IOS)43 #if PLATFORM(COCOA) 44 44 #include <CoreText/CTFont.h> 45 45 #endif … … 215 215 }; 216 216 217 #if PLATFORM(COCOA) 218 RetainPtr<CTFontRef> applyFontFeatureSettings(CTFontRef, const FontFeatureSettings&); 219 #endif 220 217 221 #if !PLATFORM(MAC) 218 222 inline void FontCache::platformPurgeInactiveFontData() -
trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
r188104 r188146 86 86 return nullptr; 87 87 88 if (substituteFont && description.featureSettings() && description.featureSettings()->size()) 89 substituteFont = applyFontFeatureSettings(substituteFont.get(), *description.featureSettings()); 90 88 91 CTFontSymbolicTraits originalTraits = CTFontGetSymbolicTraits(ctFont); 89 92 CTFontSymbolicTraits actualTraits = 0; … … 693 696 return nullptr; 694 697 698 if (ctFont && fontDescription.featureSettings() && fontDescription.featureSettings()->size()) 699 ctFont = applyFontFeatureSettings(ctFont.get(), *fontDescription.featureSettings()); 700 695 701 CTFontSymbolicTraits actualTraits = 0; 696 702 if (isFontWeightBold(fontDescription.weight()) || fontDescription.italic()) -
trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
r187985 r188146 265 265 // comparing the desiredFamily to the PostScript name of the installed fonts. If that fails 266 266 // we then do a search based on the family names of the installed fonts. 267 static NSFont *fontWithFamily(const AtomicString& family, NSFontTraitMask desiredTraits, FontWeight weight, float size)267 static NSFont *fontWithFamily(const AtomicString& family, NSFontTraitMask desiredTraits, FontWeight weight, const FontFeatureSettings* featureSettings, float size) 268 268 { 269 269 if (const auto& specialCase = fontWithFamilySpecialCase(family, weight, desiredTraits, size)) … … 287 287 288 288 NSString *desiredFamily = family; 289 font = CFBridgingRelease(CTFontCreateForCSS((CFStringRef)desiredFamily, toCoreTextFontWeight(weight), requestedTraits, size)); 289 RetainPtr<CTFontRef> foundFont = adoptCF(CTFontCreateForCSS((CFStringRef)desiredFamily, toCoreTextFontWeight(weight), requestedTraits, size)); 290 if (!foundFont) 291 return nil; 292 if (featureSettings && featureSettings->size()) 293 foundFont = applyFontFeatureSettings(foundFont.get(), *featureSettings); 294 font = CFBridgingRelease(CFRetain(foundFont.get())); 290 295 availableFamily = [font familyName]; 291 296 chosenWeight = [fontManager weightOfFont:font]; 292 297 293 298 #else 299 300 UNUSED_PARAM(featureSettings); 294 301 295 302 NSFontTraitMask desiredTraitsForNameMatch = desiredTraits | (weight >= FontWeight600 ? NSBoldFontMask : 0); … … 507 514 NSFont *nsFont = platformData.nsFont(); 508 515 RetainPtr<CTFontRef> result = lookupCTFont(platformData.font(), platformData.size(), characters, length); 516 if (result && description.featureSettings() && description.featureSettings()->size()) 517 result = applyFontFeatureSettings(result.get(), *description.featureSettings()); 509 518 if (!result) 510 519 return nullptr; … … 665 674 float size = fontDescription.computedPixelSize(); 666 675 667 NSFont *nsFont = fontWithFamily(family, traits, fontDescription.weight(), size);676 NSFont *nsFont = fontWithFamily(family, traits, fontDescription.weight(), fontDescription.featureSettings(), size); 668 677 if (!nsFont) { 669 678 if (!shouldAutoActivateFontIfNeeded(family)) … … 674 683 [NSFont fontWithName:family size:size]; 675 684 676 nsFont = fontWithFamily(family, traits, fontDescription.weight(), size);685 nsFont = fontWithFamily(family, traits, fontDescription.weight(), fontDescription.featureSettings(), size); 677 686 if (!nsFont) 678 687 return nullptr; -
trunk/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
r188130 r188146 22 22 #include "FontCustomPlatformData.h" 23 23 24 #include "FontCache.h" 24 25 #include "FontDescription.h" 25 26 #include "FontPlatformData.h" … … 40 41 FontWidthVariant widthVariant = fontDescription.widthVariant(); 41 42 #if CORETEXT_WEB_FONTS 42 return FontPlatformData(adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr)).get(), size, bold, italic, orientation, widthVariant); 43 RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(m_fontDescriptor.get(), size, nullptr)); 44 if (font && fontDescription.featureSettings() && fontDescription.featureSettings()->size()) 45 font = applyFontFeatureSettings(font.get(), *fontDescription.featureSettings()); 46 return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant); 43 47 #else 44 48 return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant); -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r187878 r188146 1262 1262 ASSERT(fontDescriptor); 1263 1263 RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr)); 1264 if (font && fontDescription.featureSettings() && fontDescription.featureSettings()->size()) 1265 font = applyFontFeatureSettings(font.get(), *fontDescription.featureSettings()); 1264 1266 fontDescription.setIsAbsoluteSize(true); 1265 1267 fontDescription.setOneFamily(textStyle);
Note: See TracChangeset
for help on using the changeset viewer.