在 Adobe Text Layout Framework 中获取渲染字体尺寸
我目前正在努力实现 TLF 中的文本浮动。它本身不支持它,到目前为止我发现的唯一解决方案是使用链接容器,然后使用 flowComposer 将控制器组合为单个 textFlow。
但是,我需要在我的列布局中实现“删除首字母”功能。首字母只是段落中的第一个大字母,由文本的其余部分浮动。它看起来像这样 -
这里的问题是对于那个大字母,生成的 TLF textFlow sprite 比实际字母大。这是因为基线(例如小 q 与大 A)。但我不想要这些额外的间隙。渲染 textFlow 后,我想了解生成的字母到底有多大(以像素为单位),以便我可以裁剪/移动基线等。
ContainerController.getContentBounds().height 或 ContainerController.compositionHeight
给我添加了间隙的整个精灵的高度,而不是字母的高度。
有某种测量方法吗? 这可以用不同的方式解决吗?
I'm currently struggling with implementing text floating in TLF. It does not support it natively, and the only solution I've found so far is to use linked containers and then combine controllers using flowComposer for single textFlow.
However, I need to implement Dropped Initial letter feature in my column layout. Initial is just a first big letter in paragraph, floated by the rest of the text. It looks like this -
The issue here is that for that big letter, the resulting TLF textFlow sprite is bigger than the actual letter. It's because of the baselines (small q vs big A for example). But I don't want these extra gaps. After textFlow is rendered, I would like to learn how big the resulting letter exactly is (in pixels) so that I can crop/shift baseline, etc.
ContainerController.getContentBounds().height or
ContainerController.compositionHeight
gives me height of whole sprite with gaps added, not the letter.
Is there some kind of measure method for this?
Can this be solved differently?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Paul Taylor 的 Tiny TLF 框架。我认为他解决了这个问题以及许多其他很酷的事情。
看看:https://github.com/trxcllnt/tinytlf
check out the Tiny TLF framework by Paul Taylor. I think he addressed this issue along with many other cool things.
Check it out: https://github.com/trxcllnt/tinytlf