- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
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.
(查找完整的 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/
我有一个 CTLine,我可以获得打印边界,但这并没有告诉我在这一行之后和下一行之前会有多少空间。 我是否必须检查段落样式并确定此行之后的最大段落间距,还是有一种更简单的方法来确定将与 CTTypes
我是核心文本新手。有没有办法找出 NSAttributedString 中的某个 NSRange 字符是否在多行上(CTLine)? 我正在做的是设置 NSAttributedString,然后使用该
我正在为我的项目创建自定义 CTLine 结构。这是一个非常简单的实现,因为它不使用 CFAttributeString 来创建行。整条线只有一种颜色,所有字形都具有相同的大小。但CFString越长
我正在尝试解决 hairy problem with UILabel ,我已经弄清楚了其中的大部分内容,除了一件事:我很难理解 CTLine 具有“字符串访问权限”的含义。 我想使用的方法是 CTLi
我是一名优秀的程序员,十分优秀!