CTLine的"optical bounds"是什么?

What's "optical bounds" of CTLine?

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.

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.

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.

(查找完整的会话记录 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.