mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 07:06:04 +00:00
set unrecognized font family to default.
This commit is contained in:
@@ -47,8 +47,8 @@
|
|||||||
clipPaths = nil;
|
clipPaths = nil;
|
||||||
templates = nil;
|
templates = nil;
|
||||||
brushConverters = nil;
|
brushConverters = nil;
|
||||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
||||||
_boundingBox = rect;
|
_boundingBox = rect;
|
||||||
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||||
|
|
||||||
for (RNSVGNode *node in self.subviews) {
|
for (RNSVGNode *node in self.subviews) {
|
||||||
if ([node isKindOfClass:[RNSVGNode class]]) {
|
if ([node isKindOfClass:[RNSVGNode class]]) {
|
||||||
|
|||||||
@@ -99,7 +99,13 @@ RCT_ENUM_CONVERTER(RNSVGVBMOS, (@{
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSDictionary *fontDict = dict[@"font"];
|
NSDictionary *fontDict = dict[@"font"];
|
||||||
CTFontRef font = (__bridge CTFontRef)[self UIFont:nil withFamily:fontDict[@"fontFamily"] size:fontDict[@"fontSize"] weight:fontDict[@"fontWeight"] style:fontDict[@"fontStyle"] scaleMultiplier:1.0];
|
NSString *fontFamily = fontDict[@"fontFamily"];
|
||||||
|
|
||||||
|
if (![[UIFont familyNames] containsObject:fontFamily]) {
|
||||||
|
fontFamily = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTFontRef font = (__bridge CTFontRef)[self UIFont:nil withFamily:fontFamily size:fontDict[@"fontSize"] weight:fontDict[@"fontWeight"] style:fontDict[@"fontStyle"] scaleMultiplier:1.0];
|
||||||
if (!font) {
|
if (!font) {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
@@ -262,12 +268,15 @@ RCT_ENUM_CONVERTER(RNSVGVBMOS, (@{
|
|||||||
RNSVGCGFloatArray colorsAndOffsets = [self RNSVGCGFloatArray:arr];
|
RNSVGCGFloatArray colorsAndOffsets = [self RNSVGCGFloatArray:arr];
|
||||||
size_t stops = colorsAndOffsets.count / 5;
|
size_t stops = colorsAndOffsets.count / 5;
|
||||||
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
|
||||||
|
|
||||||
CGGradientRef gradient = CGGradientCreateWithColorComponents(
|
CGGradientRef gradient = CGGradientCreateWithColorComponents(
|
||||||
rgb,
|
rgb,
|
||||||
colorsAndOffsets.array,
|
colorsAndOffsets.array,
|
||||||
colorsAndOffsets.array + stops * 4,
|
colorsAndOffsets.array + stops * 4,
|
||||||
stops
|
stops
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CGColorSpaceRelease(rgb);
|
CGColorSpaceRelease(rgb);
|
||||||
free(colorsAndOffsets.array);
|
free(colorsAndOffsets.array);
|
||||||
return (CGGradientRef)CFAutorelease(gradient);
|
return (CGGradientRef)CFAutorelease(gradient);
|
||||||
|
|||||||
Reference in New Issue
Block a user