From d823fd37c5afff18335f6532fb474cf4bc99ab3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E5=85=8B?= Date: Tue, 19 Mar 2013 17:19:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5ctrundelegate=20=E7=9A=84?= =?UTF-8?q?=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _posts/2013/2013-03-11-core-text.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/_posts/2013/2013-03-11-core-text.md b/_posts/2013/2013-03-11-core-text.md index b68505b..dcf4343 100644 --- a/_posts/2013/2013-03-11-core-text.md +++ b/_posts/2013/2013-03-11-core-text.md @@ -161,6 +161,25 @@ callbacks的结构体为CTRunDelegateCallbacks,主要是包含一些回调函 {% highlight objc %} +void RunDelegateDeallocCallback( void* refCon ){ + +} + +CGFloat RunDelegateGetAscentCallback( void *refCon ){ + NSString *imageName = (NSString *)refCon; + return [UIImage imageNamed:imageName].size.height; +} + +CGFloat RunDelegateGetDescentCallback(void *refCon){ + return 0; +} + +CGFloat RunDelegateGetWidthCallback(void *refCon){ + NSString *imageName = (NSString *)refCon; + return [UIImage imageNamed:imageName].size.width; +} + + - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext();