Tag: ctfontref

来自CTFontRef的FontName

我有一个CTFontRefvariables。 CTFontRef aFontRef; 获取字体的大小很容易: CGFloat aFontSize = CTFontGetSize(aFontRef); 请帮我检索FontName。 我期待FontName是像MarkerFelt-Wide 。 但是,当我使用类似的方法 CTFontCopyFullName(aFontRef) 我得到标记感觉宽 干杯Roshit

给框架设定器正确的行间距调整

几个post已经注意到了从CTFramesetterSuggestFrameSizeWithConstraints得到一个确切的高度,在这里, (framesetter post) ,@Chris DeSalvo给出了看起来像权威性的修复:添加一个段落风格设置与正确的行距调整。 DeSalvo通过从其lineHeight移除UIFont的上行和下行来获得他的“领导”。 我想知道如何比较CTFontGetLeading 。 我使用像这样创build的字体: CTFontRef fontr = CTFontCreateWithName((CFStringRef)@"Helvetica Neue", 16.0f, NULL); UIFont *font = [UIFont fontWithName:@"Helvetica Neue" size:16.0f]; 价值是非常不同的: 0.448 CTFontGetLeading 2.360 DeSalvo的公式:UIFont lineHeight – ascender + descender 以下是一些其他UIFont值: 21.000 UIFont的lineHeight 15.232 UIFont的上升(从基线起的Y坐标) -3.408 UIFont的下行(从基线起的Y坐标) 08.368 UIFont的xHeight 以下是Ken Thomases询问的CTFont值: 11.568001 CTFontGetCapHeight 08.368 CTFontGetXHeight -15.216001,-7.696001,38.352001,24.928001 CTFontGetBoundingBox 15.232 CTFontGetAscent 03.408 CTFontGetDescent(class ref是指“根据字体大小和字体引用matrix缩放的缩放字体下降度量” […]