开发者

How can we extract actual font family from a CompositeFontFamily applied to a run in WPF RichTextBox

A composite font family is a collection of FontFamilies. On applying the composite font to a run, appropriate font from its font-collection is applied depending on text.

How can we get which actual font is being used in a run on which a composite font has been applied?

EDIT2: Suppose I have a run

<Run Text="Some text with different unicode characters not available in applied FontFamily" FontFamily="Global User Interface"/>

Now if I check run.FontFamily it returns "Global User Interface", but actual font applied is one from the FontFamily collection of this composite font. So I want to find out which font it is?

EDIT1: One way I can think of is - to find it the way WPF applies a font. For each language, the composite font specifies a set of fonts corresponding to specified range of characters. So we can find each of the character in a run of text, then lookup the font corresponding to this character in the fontfamilymap for current language.

Is this the right way? Are there any cases where it may fail? Is it the only way? Is there an开发者_开发技巧y API\straightforward way instead?

Thanks

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜