mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-02 06:35:04 +00:00
finish basic Text features on iOS
This commit is contained in:
+1
-42
@@ -17,13 +17,6 @@
|
||||
[self invalidate];
|
||||
_alignment = alignment;
|
||||
}
|
||||
//
|
||||
//- (void)setTextFrame:(RNSVGTextFrame)textFrame
|
||||
//{
|
||||
// RNSVGFreeTextFrame(_textFrame);
|
||||
// [self invalidate];
|
||||
// _textFrame = textFrame;
|
||||
//}
|
||||
|
||||
- (void)setPath:(NSArray *)path
|
||||
{
|
||||
@@ -34,15 +27,10 @@
|
||||
_path = path;
|
||||
}
|
||||
|
||||
//- (void)dealloc
|
||||
//{
|
||||
// RNSVGFreeTextFrame(_textFrame);
|
||||
//}
|
||||
|
||||
- (void)renderLayerTo:(CGContextRef)context
|
||||
{
|
||||
CGFloat shift = [self getShift:context path:nil];
|
||||
// translate path by alignment offset
|
||||
// Translate path by alignment offset
|
||||
CGContextSaveGState(context);
|
||||
CGContextConcatCTM(context, CGAffineTransformMakeTranslation(-shift, 0));
|
||||
[super renderLayerTo:context];
|
||||
@@ -86,33 +74,4 @@
|
||||
return shift;
|
||||
}
|
||||
|
||||
//- (CGPathRef)getPath:(CGContextRef)context
|
||||
//{
|
||||
// CGMutablePathRef path = CGPathCreateMutable();
|
||||
// RNSVGTextFrame frame = self.textFrame;
|
||||
// for (int i = 0; i < frame.count; i++) {
|
||||
// CGFloat shift;
|
||||
// CGFloat width = frame.widths[i];
|
||||
// switch (self.alignment) {
|
||||
// case kCTTextAlignmentRight:
|
||||
// shift = width;
|
||||
// break;
|
||||
// case kCTTextAlignmentCenter:
|
||||
// shift = width / 2;
|
||||
// break;
|
||||
// default:
|
||||
// shift = 0;
|
||||
// break;
|
||||
// }
|
||||
// // We should consider snapping this shift to device pixels to improve rendering quality
|
||||
// // when a line has subpixel width.
|
||||
// CGAffineTransform offset = CGAffineTransformMakeTranslation(-shift, frame.baseLine + frame.lineHeight * i + (self.path ? -frame.lineHeight : 0));
|
||||
//
|
||||
// CGMutablePathRef line = [self setLinePath:frame.lines[i]];
|
||||
// CGPathAddPath(path, &offset, line);
|
||||
// CGPathRelease(line);
|
||||
// }
|
||||
|
||||
// return (CGPathRef)CFAutorelease(path);
|
||||
//}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user