如何在CoreText中设置行距?
您可以使用 CTFontGetLeading(aCTFont) 获取它,但是如何设置它呢?
谁能解释一下吗?
还有其他办法解决这个问题吗?也许您必须手动设置行之间的间距?
You can get it with CTFontGetLeading(aCTFont), but how do you SET it?
Can anyone please explain?
Is there another way around this? Do you have to set the space between the lines manually, perhaps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现当我在一个段落中使用多种字体时,设置最小和最大行高是不够的。我还必须将行间距设置为 0,否则行的行距会不一致。这是我的完整解决方案:
I found that when I was using multiple typefaces in a single paragraph, setting the min and max line height was not enough. I also had to set the line spacing to 0, otherwise the lines would have inconsistant leading. Here's my complete solution:
我在这里得到了解决方案:
http://www.iphonedevsdk。 com/forum/iphone-sdk-development/59101-how-set-leading-coretext.html
基本上,只需设置属性 kCTParagraphStyleSpecifierMinimumLineHeight 即可。你可以在CTParagraphStyle.h中找到它
I got the solution here:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/59101-how-set-leading-coretext.html
Basically, just set the attribute kCTParagraphStyleSpecifierMinimumLineHeight. You can find it in CTParagraphStyle.h