diff --git a/_posts/2013/2013-03-11-core-text.md b/_posts/2013/2013-03-11-core-text.md index cdc89c7..ced2901 100644 --- a/_posts/2013/2013-03-11-core-text.md +++ b/_posts/2013/2013-03-11-core-text.md @@ -162,15 +162,16 @@ callbacks的结构体为CTRunDelegateCallbacks,主要是包含一些回调函 { CGContextRef context = UIGraphicsGetCurrentContext(); + //这四行代码只是简单测试drawRect中context的坐标系 CGContextSetRGBFillColor (context, 1, 0, 0, 1); CGContextFillRect (context, CGRectMake (0, 200, 200, 100 )); CGContextSetRGBFillColor (context, 0, 0, 1, .5); CGContextFillRect (context, CGRectMake (0, 200, 100, 200)); + + CGContextSetTextMatrix(context, CGAffineTransformIdentity);//设置字形变换矩阵为CGAffineTransformIdentity,也就是说每一个字形都不做图形变换 - - CGContextSetTextMatrix(context, CGAffineTransformIdentity); - CGAffineTransform flipVertical = CGAffineTransformMake(1,0,0,-1,0,self.bounds.size.height); - CGContextConcatCTM(context, flipVertical); + CGAffineTransform flipVertical = CGAffineTransformMake(1,0,0,-1,0,self.bounds.size.height); + CGContextConcatCTM(context, flipVertical);//将当前context的坐标系进行flip NSMutableAttributedString *attributedString = [[[NSMutableAttributedString alloc] initWithString:@"测试富文本显示"] autorelease];