|
Lines 28-38
a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp_sec1
|
| 28 |
|
28 |
|
| 29 |
namespace WebCore { |
29 |
namespace WebCore { |
| 30 |
|
30 |
|
| 31 |
static inline void appendTrueTypeFeature(CFMutableArrayRef features, const FontFeature& feature) |
31 |
static inline void appendTrueTypeFeature(CFMutableArrayRef, const FontFeature&) |
| 32 |
{ |
32 |
{ |
| 33 |
// FIXME: We should map OpenType feature strings to the TrueType feature type identifiers listed in <CoreText/SFNTLayoutTypes.h> |
33 |
// FIXME: We should map OpenType feature strings to the TrueType feature type identifiers listed in <CoreText/SFNTLayoutTypes.h>. |
| 34 |
UNUSED_PARAM(features); |
|
|
| 35 |
UNUSED_PARAM(feature); |
| 36 |
} |
34 |
} |
| 37 |
|
35 |
|
| 38 |
static inline void appendOpenTypeFeature(CFMutableArrayRef features, const FontFeature& feature) |
36 |
static inline void appendOpenTypeFeature(CFMutableArrayRef features, const FontFeature& feature) |
|
Lines 41-49
static inline void appendOpenTypeFeature(CFMutableArrayRef features, const FontF
a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp_sec2
|
| 41 |
RetainPtr<CFStringRef> featureKey = feature.tag().string().createCFString(); |
39 |
RetainPtr<CFStringRef> featureKey = feature.tag().string().createCFString(); |
| 42 |
int rawFeatureValue = feature.value(); |
40 |
int rawFeatureValue = feature.value(); |
| 43 |
RetainPtr<CFNumberRef> featureValue = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &rawFeatureValue)); |
41 |
RetainPtr<CFNumberRef> featureValue = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &rawFeatureValue)); |
| 44 |
CFStringRef featureDictionaryKeys[] = {kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureValue}; |
42 |
CFStringRef featureDictionaryKeys[] = { kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureValue }; |
| 45 |
CFTypeRef featureDictionaryValues[] = {featureKey.get(), featureValue.get()}; |
43 |
CFTypeRef featureDictionaryValues[] = { featureKey.get(), featureValue.get() }; |
| 46 |
RetainPtr<CFDictionaryRef> featureDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)featureDictionaryKeys, featureDictionaryValues, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); |
44 |
RetainPtr<CFDictionaryRef> featureDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)featureDictionaryKeys, featureDictionaryValues, WTF_ARRAY_LENGTH(featureDictionaryValues), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); |
| 47 |
CFArrayAppendValue(features, featureDictionary.get()); |
45 |
CFArrayAppendValue(features, featureDictionary.get()); |
| 48 |
#else |
46 |
#else |
| 49 |
UNUSED_PARAM(features); |
47 |
UNUSED_PARAM(features); |
|
Lines 51-62
static inline void appendOpenTypeFeature(CFMutableArrayRef features, const FontF
a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp_sec3
|
| 51 |
#endif |
49 |
#endif |
| 52 |
} |
50 |
} |
| 53 |
|
51 |
|
| 54 |
RetainPtr<CTFontRef> applyFontFeatureSettings(CTFontRef originalFont, const FontFeatureSettings& features) |
52 |
RetainPtr<CTFontRef> applyFontFeatureSettings(CTFontRef originalFont, const FontFeatureSettings* features) |
| 55 |
{ |
53 |
{ |
| 56 |
RetainPtr<CFMutableArrayRef> featureArray = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, features.size(), &kCFTypeArrayCallBacks)); |
54 |
if (!originalFont || !features || !features->size()) |
| 57 |
for (size_t i = 0; i < features.size(); ++i) { |
55 |
return originalFont; |
| 58 |
appendTrueTypeFeature(featureArray.get(), features[i]); |
56 |
|
| 59 |
appendOpenTypeFeature(featureArray.get(), features[i]); |
57 |
RetainPtr<CFMutableArrayRef> featureArray = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, features->size(), &kCFTypeArrayCallBacks)); |
|
|
58 |
for (size_t i = 0; i < features->size(); ++i) { |
| 59 |
appendTrueTypeFeature(featureArray.get(), (*features)[i]); |
| 60 |
appendOpenTypeFeature(featureArray.get(), (*features)[i]); |
| 60 |
} |
61 |
} |
| 61 |
CFArrayRef featureArrayPtr = featureArray.get(); |
62 |
CFArrayRef featureArrayPtr = featureArray.get(); |
| 62 |
RetainPtr<CFDictionaryRef> dictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)&kCTFontFeatureSettingsAttribute, (const void**)&featureArrayPtr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); |
63 |
RetainPtr<CFDictionaryRef> dictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, (const void**)&kCTFontFeatureSettingsAttribute, (const void**)&featureArrayPtr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); |