在 Adob​​e Text Layout Framework 中获取渲染字体尺寸

发布于 2024-08-29 01:20:40 字数 614 浏览 4 评论 0原文

我目前正在努力实现 TLF 中的文本浮动。它本身不支持它,到目前为止我发现的唯一解决方案是使用链接容器,然后使用 flowComposer 将控制器组合为单个 textFlow。

但是,我需要在我的列布局中实现“删除首字母”功能。首字母只是段落中的第一个大字母,由文本的其余部分浮动。它看起来像这样 -

alt text

这里的问题是对于那个大字母,生成的 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 -

alt text

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温暖的光 2024-09-05 01:20:40

查看 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文