开发者

Determine portion of font rendered to left of black box?

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开发者_Python百科 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜