This source file includes following definitions.
- getCFStringAttributes
#include "config.h"
#include "platform/fonts/SimpleFontData.h"
#include <ApplicationServices/ApplicationServices.h>
namespace WebCore {
CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typesettingFeatures, FontOrientation orientation) const
{
unsigned key = typesettingFeatures + 1;
HashMap<unsigned, RetainPtr<CFDictionaryRef> >::AddResult addResult = m_CFStringAttributes.add(key, RetainPtr<CFDictionaryRef>());
RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.storedValue->value;
if (!addResult.isNewEntry)
return attributesDictionary.get();
attributesDictionary.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CFMutableDictionaryRef mutableAttributes = (CFMutableDictionaryRef)attributesDictionary.get();
CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, platformData().ctFont());
if (!(typesettingFeatures & Kerning)) {
const float zero = 0;
static CFNumberRef zeroKerningValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);
CFDictionarySetValue(mutableAttributes, kCTKernAttributeName, zeroKerningValue);
}
bool allowLigatures = (orientation == Horizontal && platformData().allowsLigatures()) || (typesettingFeatures & Ligatures);
if (!allowLigatures) {
const int zero = 0;
static CFNumberRef essentialLigaturesValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &zero);
CFDictionarySetValue(mutableAttributes, kCTLigatureAttributeName, essentialLigaturesValue);
}
if (orientation == Vertical)
CFDictionarySetValue(mutableAttributes, kCTVerticalFormsAttributeName, kCFBooleanTrue);
return attributesDictionary.get();
}
}