mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 16:54:52 +00:00
[ios] Restore ability to disable kerning
This commit is contained in:
+19
-6
@@ -230,17 +230,30 @@ static double RNSVGTSpan_radToDeg = 180 / M_PI;
|
|||||||
*/
|
*/
|
||||||
// OpenType.js font data
|
// OpenType.js font data
|
||||||
NSDictionary * fontData = font->fontData;
|
NSDictionary * fontData = font->fontData;
|
||||||
|
NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
NSNumber *lig = [NSNumber numberWithInt:allowOptionalLigatures ? 2 : 1];
|
NSNumber *lig = [NSNumber numberWithInt:allowOptionalLigatures ? 2 : 1];
|
||||||
|
attrs[NSLigatureAttributeName] = lig;
|
||||||
CFDictionaryRef attributes;
|
CFDictionaryRef attributes;
|
||||||
if (fontRef != nil) {
|
if (fontRef != nil) {
|
||||||
attributes = (__bridge CFDictionaryRef)@{
|
attrs[NSFontAttributeName] = (__bridge id)fontRef;
|
||||||
(NSString *)kCTFontAttributeName: (__bridge id)fontRef,
|
|
||||||
(NSString *)NSLigatureAttributeName: lig };
|
|
||||||
} else {
|
|
||||||
attributes = (__bridge CFDictionaryRef)@{
|
|
||||||
(NSString *)NSLigatureAttributeName: lig };
|
|
||||||
}
|
}
|
||||||
|
if (!autoKerning) {
|
||||||
|
NSNumber *noAutoKern = [NSNumber numberWithFloat:0.0f];
|
||||||
|
|
||||||
|
#if DTCORETEXT_SUPPORT_NS_ATTRIBUTES
|
||||||
|
if (___useiOS6Attributes)
|
||||||
|
{
|
||||||
|
[attrs setObject:noAutoKern forKey:NSKernAttributeName];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
[attrs setObject:noAutoKern forKey:(id)kCTKernAttributeName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes = (__bridge CFDictionaryRef)attrs;
|
||||||
|
|
||||||
CFStringRef string = (__bridge CFStringRef)str;
|
CFStringRef string = (__bridge CFStringRef)str;
|
||||||
CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes);
|
CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes);
|
||||||
|
|||||||
Reference in New Issue
Block a user