mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-08 17:15:04 +00:00
Finish TSpan
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
+ (RNSVGTextAnchor)RNSVGTextAnchor:(id)json;
|
||||
+ (RNSVGCGFCRule)RNSVGCGFCRule:(id)json;
|
||||
+ (RNSVGVBMOS)RNSVGVBMOS:(id)json;
|
||||
+ (CTFontRef)RNSVGFont:(id)json;
|
||||
+ (RNSVGCGFloatArray)RNSVGCGFloatArray:(id)json;
|
||||
+ (RNSVGBrush *)RNSVGBrush:(id)json;
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Horcrux.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT-style license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
float x;
|
||||
float deltaX;
|
||||
BOOL isDeltaXSet;
|
||||
float positionX;
|
||||
BOOL isPositionXSet;
|
||||
|
||||
float y;
|
||||
float deltaY;
|
||||
BOOL isDeltaYSet;
|
||||
float positionY;
|
||||
BOOL isPositionYSet;
|
||||
} RNSVGGlyphPoint;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user