NSTextView 的疯狂字体问题
目前我对 NSTextView 的字体指标很感兴趣。我希望这里的开发人员能够阐明正在发生的事情。
在默认 NSTextView 中使用 Myriad Pro(从 IB 拖动并在新项目中运行),您将得到以下结果:
注意选定的矩形与插入点的高度相同。
现在,页面的行为:
请注意所选矩形与常规文本视图版本相似,但插入点高度实际上更具反射性字体(并且更小!)。
诡异的。
我为什么关心?这是我的应用程序使用 Helvetica 和 Myriad 的屏幕:
请注意,在这两种情况下,轮廓符号都与插入点高度完全居中。这些符号实际上是子视图,而不是在文本流中。注意页面中的那些符号。他们仍然以 Myriad 为中心。显然苹果意识到了一些事情并修复了它。他们做了什么有什么想法吗?
谢谢!
I'm knee deep in font metrics with NSTextView at the moment. I was hoping a developer here could shed some light as to what's going on.
With Myriad Pro in a default NSTextView (dragged from IB and run in a fresh project), here's what you get:
Notice how the selected rect has the same height as the insertion point.
Now for behavior from Pages:
Notice how the selected rect is similar to the regular text view version, but the insertion point height is actually more reflective of the font (and smaller!).
Weird.
Why do I care? Here is a screen of my application with Helvetica, and then with Myriad:
Notice that in both cases, the outline symbol is perfectly centered with the insertion point height. Those symbols are actually subviews, and not in the text stream. Notice those symbols in Pages. They remain centered for Myriad. Clearly Apple realized something and fixed it. Any ideas what they did?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是 Apple 的错误,而是您的假设。这是字体规格和行高的函数。插入点占据整个行高;绘制的字体部分则不然。
我以为我指的是你 字体处理指南 几天前。无论哪种方式,您都需要彻底理解这个主题,以便确定在哪里画点。
This isn't a mistake on Apple's part but rather an assumption on yours. This is a function of font metrics as well as line height.The insertion point takes the whole line height; the drawn font parts don't.
I thought it was you who I pointed to the Font Handling guide a few days ago. Either way, you need to understand this topic thoroughly so you can determine where to draw your dot.