gpt4 book ai didi

ios - CTLine的 "optical bounds"是什么?

转载 作者:行者123 更新时间:2023-11-29 11:29:42 24 4
gpt4 key购买 nike

CTLineGetBoundsWithOptions() 使用 CTLineBoundsOptions。其中一个选项是 kCTLineBoundsUseOpticalBounds 其文档说:

Pass this option to use optical bounds.

但是我不明白optical bounds的意思。

最佳答案

字体设计者可以指定字形的光学边界与其打印边界分开。在 TrueType 字体中,the opbd table ,如果存在,则包含光学边界。

来自 WWDC 2012 Session 226: Core Text and Fonts :

Now, as I advance to the next few slides, I want to call your attention in particular to the left and right sides of this rectangle on screen because I’m going to start passing some different options to this API and it’s going to have an effect on either side.

typographic bounds

Let’s go ahead and advance now as I invoke use optical bounds. This is a very slight difference here, but you may have noticed that the edges of the box have been pulled in a little bit here. What’s going on here is that optical bounds are very closely related to the typographic bounds, the regular measurement of the line.

optical bounds

But, in this case, the font designer has specified that the way that the font is likely to be perceived by our eyes means that they don’t line up exactly with just the glyph measurements. The optical bounds in this case have been designed to pull in on either of these curly quotes here because the way our eyes see rounded shapes. It’s a bit different than the way we see straight lines, so the font designer has compensated for that by providing us information in the font.

(查找完整的 session 记录 here 。)

Microsoft describes it this way :

Aligns glyphs by their apparent left or right extents in horizontal setting, or apparent top or bottom extents in vertical setting, replacing the default behavior of aligning glyphs by their origins. Another name for this behavior would be visual justification. The optical edge of a given glyph is only indirectly related to its advance width or bounding box; this feature provides a means for getting true visual alignment.

关于ios - CTLine的 "optical bounds"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54872502/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com