确定渲染到黑框左侧的字体部分?

发布于 2024-10-11 15:30:19 字数 887 浏览 1 评论 0原文

我有一种字体 - 'Saginaw',在渲染时,字形的某些部分位于起始位置/框的“左侧”:

[此处图片] http://i.imgur.com/1lP3C.png

上面的片段是 Photoshop 中的字体..我做了一个“全选”来显示黑框..

我试图弄清楚偏移量/值是什么是 [在框外左侧呈现的 W 部分]

到目前为止,我一直在研究System.Windows.Media.GlyphTypeFace 它有很多有趣的好处,包括 AdvancedWidths、LeftSideBearings、DistancesFromHorizo​​ntalBaselienToBlackBottom 等。

但是,我不太明白如何应用我的值我从字体中看到计算与该偏移量相对应的值。

最后,我尝试获取此字体元数据并在 Flex RichEditableTextArea 中渲染字体/文本,其中字体的弯曲左侧被切断:

[图片] http://i.imgur.com/Hjm7V.png

我在 Flex TLF 中还没有看到任何可以让我查看字体数据部分的内容。

[我确信它可能只是对我隐藏]

通过实验,我发现我可以在 RichEditableTextArea 中设置填充来移动字体,然后在其内部呈现“切断”部分。

我希望找到字体/字形“左移”的数量;然后应用适当的填充进行补偿。

[或者,如果有人知道如何强制 RichEditableTextArea 渲染被切断的部分,那也可以!]

如果有人有任何见解,我将不胜感激!

——埃里克

I have a font - 'Saginaw' that when renders has some portion of the glyph to the 'left' of the starting position/box:

[Picture here]
http:// i.imgur.com/1lP3C.png

The above snip is of the font in Photoshop.. I did a 'select all' to show the black box..

I'm trying to figure out what that offset/value is [portion of the W rendered on the left outside the box]

Thus far, I've been delving through System.Windows.Media.GlyphTypeFace which has much interesting goodies, including AdvancedWidths, LeftSideBearings, DistancesFromHorizontalBaselienToBlackBottom, etc.

However, I don't quite grok how to apply the values I'm seeing from the font to calculate a value that corresponds to that offset.

In the end, I'm trying to take this font metadata and render the font/text up in a Flex RichEditableTextArea, where the curvy left hand side of the font is getting cut off:

[Picture Here]
http:// i.imgur.com/Hjm7V.png

I'd not seen anything yet in the Flex TLF that lets me peer at that part of the Font data.

[I'm sure it's probably just hiding from me]

Via experimentation I'd seen I can set the padding in the RichEditableTextArea to shift the font over, then it renders the 'cut off' portion inside itself.

I was hoping to find the amount of the font/glyph 'left shift'; then apply appropriate padding to compensate.

[Alternately, if someone knows how to force the RichEditableTextArea to render that portion that is getting cut off, that would work as well!]

If anyone has any insight I would be deeply grateful!

--Erik

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

平生欢 2024-10-18 15:30:19

您确定 LeftSideBearings 不包含此内容吗?

财产价值

类型:
System.Collections.Generic.IDictionary 一个 IDictionary
包含键/值对的对象
代表距离信息
对于字形。关键是 UInt16
标识字形索引。这
值是一个 Double 值,表示
距离。

备注

左侧轴承
当左边缘时值为正
黑匣子的内
对齐矩形定义为
提前宽度和字体单元格高度。

LeftSideBearings 值为负数
当黑框的左边缘
伸出对齐矩形。

这将为您提供所需的负数。

Are you sure that the LeftSideBearings doesn't cover this?

Property Value

Type:
System.Collections.Generic.IDictionary An IDictionary
object that contains key/value pairs
that represent distance information
for the glyphs. The key is a UInt16
that identifies the glyph index. The
value is a Double that represents the
distance.

Remarks

The LeftSideBearings
value is positive when the left edge
of the black box is within the
alignment rectangle defined by the
advance width and font cell height.

The LeftSideBearings value is negative
when the left edge of the black box
overhangs the alignment rectangle.

This should give you the number you need as a negative.

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