问题CTLineGetTypographicBounds

| 该代码是从SimpleTextInput样本代码中提取的,但进行了一些修改。 创建框架:
self.font = [UIFont systemFontOfSize:18.f];
CTFontRef ctFont = CTFontCreateWithName((CFStringRef) self.font.fontName, self.font.pointSize, NULL);        
self.attributes = [[NSDictionary dictionaryWithObject:(id)ctFont forKey:(NSString *)kCTFontAttributeName] retain];
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:self.text attributes:self.attributes];    

_framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedString);

// Create the Core Text frame using our current view rect bounds
UIBezierPath *path = [UIBezierPath bezierPathWithRect:self.bounds];
_frame =  CTFramesetterCreateFrame(_framesetter, CFRangeMake(0, 0), [path CGPath], NULL);
下面的行是框架的任何行(按
CTFrameGetLines(_frame)
得到):
CGFloat ascent, descent, leading;
CTLineGetTypographicBounds(line, &ascent, &descent, &leading);
CGPoint origin;
CTFrameGetLineOrigins(_frame, CFRangeMake(i, 1), &origin);
问题: 从CTLineGetTypographicBounds或ctFont获得的ascent为13.860352,而self.font.ascender为16.860352。这三点差异来自何处? 下降是4.139648,前导是0,所以上升+下降+前导= 18,但是self.font.lineHeight和通过减去相邻线原点计算出的线高是22。这4点差异是从哪里来的?     
已邀请:
        http://developer.apple.com/library/mac/#documentation/TextFonts/Conceptual/CocoaTextArchitecture/TypoFeatures/TextSystemFeatures.html 阅读此文档,您将知道如何计算行高,但是我仍然不明白为什么CTLineGetTypographicBounds的前导零     

要回复问题请先登录注册