WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
No caching yet
bug-147722-20150805220603.patch (text/plain), 5.08 KB, created by
Myles C. Maxfield
on 2015-08-05 22:06:11 PDT
(
hide
)
Description:
No caching yet
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2015-08-05 22:06:11 PDT
Size:
5.08 KB
patch
obsolete
>Subversion Revision: 187994 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 54eb0ed73d9bb4d39a783bbcc4dde18c1101c33d..1f968e6c0332ec4a4fdff6924cac3031b3f939a3 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2015-08-05 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ Implement font-feature-settings >+ https://bugs.webkit.org/show_bug.cgi?id=147722 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * platform/graphics/mac/FontCacheMac.mm: >+ (WebCore::fontWithFamily): >+ (WebCore::FontCache::createFontPlatformData): >+ > 2015-08-05 Zalan Bujtas <zalan@apple.com> > > [Frame flattening] Return early when child RenderView is not available. >diff --git a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm >index aebbe984c4ad6007dcf10629e9d1d121d7165f04..a3e00b249de169caa9cbee6a80fd8d756d397ecb 100644 >--- a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm >+++ b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm >@@ -264,7 +264,7 @@ static Optional<NSFont*> fontWithFamilySpecialCase(const AtomicString& family, F > // Family name is somewhat of a misnomer here. We first attempt to find an exact match > // comparing the desiredFamily to the PostScript name of the installed fonts. If that fails > // we then do a search based on the family names of the installed fonts. >-static NSFont *fontWithFamily(const AtomicString& family, NSFontTraitMask desiredTraits, FontWeight weight, float size) >+static NSFont *fontWithFamily(const AtomicString& family, NSFontTraitMask desiredTraits, FontWeight weight, const FontFeatureSettings* features, float size) > { > if (const auto& specialCase = fontWithFamilySpecialCase(family, weight, desiredTraits, size)) > return specialCase.value(); >@@ -286,7 +286,25 @@ static NSFont *fontWithFamily(const AtomicString& family, NSFontTraitMask desire > requestedTraits |= kCTFontBoldTrait; > > NSString *desiredFamily = family; >- font = CFBridgingRelease(CTFontCreateForCSS((CFStringRef)desiredFamily, toCoreTextFontWeight(weight), requestedTraits, size)); >+ RetainPtr<CTFontRef> foundFont = adoptCF(CTFontCreateForCSS((CFStringRef)desiredFamily, toCoreTextFontWeight(weight), requestedTraits, size)); >+ if (foundFont && features && features->size()) { >+ RetainPtr<CFMutableArrayRef> featureArray = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, features->size(), &kCFTypeArrayCallBacks)); >+ CFStringRef featureDictionaryKeys[] = {kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureValue}; >+ for (size_t i = 0; i < features->size(); ++i) { >+ const auto& feature = (*features)[i]; >+ RetainPtr<CFStringRef> featureKey = feature.tag().string().createCFString(); >+ int rawFeatureValue = feature.value(); >+ RetainPtr<CFNumberRef> featureValue = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &rawFeatureValue)); >+ CFTypeRef featureDictionaryValues[] = {featureKey.get(), featureValue.get()}; >+ RetainPtr<CFDictionaryRef> featureDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)featureDictionaryKeys, featureDictionaryValues, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >+ CFArrayAppendValue(featureArray.get(), featureDictionary.get()); >+ } >+ CFArrayRef featureArrayPtr = featureArray.get(); >+ RetainPtr<CFDictionaryRef> dictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)&kCTFontFeatureSettingsAttribute, (const void**)&featureArrayPtr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >+ RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(dictionary.get())); >+ foundFont = adoptCF(CTFontCreateCopyWithAttributes(foundFont.get(), size, nullptr, descriptor.get())); >+ } >+ font = CFBridgingRelease(CFRetain(foundFont.get())); > availableFamily = [font familyName]; > chosenWeight = [fontManager weightOfFont:font]; > >@@ -664,7 +682,7 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe > NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0; > float size = fontDescription.computedPixelSize(); > >- NSFont *nsFont = fontWithFamily(family, traits, fontDescription.weight(), size); >+ NSFont *nsFont = fontWithFamily(family, traits, fontDescription.weight(), fontDescription.featureSettings(), size); > if (!nsFont) { > if (!shouldAutoActivateFontIfNeeded(family)) > return nullptr; >@@ -673,7 +691,7 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe > // Ignore the result because we want to use our own algorithm to actually find the font. > [NSFont fontWithName:family size:size]; > >- nsFont = fontWithFamily(family, traits, fontDescription.weight(), size); >+ nsFont = fontWithFamily(family, traits, fontDescription.weight(), fontDescription.featureSettings(), size); > if (!nsFont) > return nullptr; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 147722
:
258349
|
258425
|
258427
|
258428
|
258431
|
258432
|
258433
|
258435
|
258444
|
258456
|
258472
|
258477
|
258507
|
258511
|
258512