mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 16:54:52 +00:00
Finish TSpan
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
#import "RNSVGPattern.h"
|
||||
#import "RNSVGSolidColorBrush.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTFont.h"
|
||||
|
||||
@implementation RCTConvert (RNSVG)
|
||||
|
||||
@@ -81,41 +80,6 @@ RCT_ENUM_CONVERTER(RNSVGTextAnchor, (@{
|
||||
@"end": @(kRNSVGTextAnchorEnd)
|
||||
}), kRNSVGTextAnchorAuto, intValue)
|
||||
|
||||
+ (CTFontRef)RNSVGFont:(id)json
|
||||
{
|
||||
NSDictionary *dict = [self NSDictionary:json];
|
||||
|
||||
NSDictionary *fontDict = dict[@"font"];
|
||||
NSString *fontFamily = fontDict[@"fontFamily"];
|
||||
|
||||
BOOL fontFound = NO;
|
||||
NSArray *supportedFontFamilyNames = [UIFont familyNames];
|
||||
|
||||
if ([supportedFontFamilyNames containsObject:fontFamily]) {
|
||||
fontFound = YES;
|
||||
} else {
|
||||
for (NSString *fontFamilyName in supportedFontFamilyNames) {
|
||||
if ([[UIFont fontNamesForFamilyName: fontFamilyName] containsObject:fontFamily]) {
|
||||
fontFound = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fontFamily = fontFound ? fontFamily : nil;
|
||||
|
||||
CTFontRef font = (__bridge CTFontRef)[RCTFont updateFont:nil withFamily:fontFamily size:fontDict[@"fontSize"] weight:fontDict[@"fontWeight"] style:fontDict[@"fontStyle"]
|
||||
variant:nil scaleMultiplier:1.0];
|
||||
if (!font) {
|
||||
return frame;
|
||||
|
||||
}
|
||||
|
||||
fontFamily = fontFound ? fontFamily : nil;
|
||||
|
||||
return (__bridge CTFontRef)[RCTFont updateFont:nil withFamily:fontFamily size:dict[@"fontSize"] weight:dict[@"fontWeight"] style:dict[@"fontStyle"] variant:nil scaleMultiplier:1.0];
|
||||
}
|
||||
|
||||
+ (RNSVGCGFloatArray)RNSVGCGFloatArray:(id)json
|
||||
{
|
||||
NSArray *arr = [self NSNumberArray:json];
|
||||
|
||||
Reference in New Issue
Block a user