如何从FormattedText只获得大写X高度?

时间:2014-08-30 18:59:35

标签: wpf formatted-text

我的结论是,由于我似乎无法访问formattedtext对象的ascender高度,因此无法完成此操作。作为粗略的近似,我正在使用:

public static double GetCapitalX(this FormattedText text)
    {
         double bottom = text.Height + text.OverhangAfter;      // bottom most inked pixel

        /* this is wrong since the Extent includes the ascender height. But it's the best I can do. */
         double capitalX = text.Extent - (bottom - text.Baseline);
         return capitalX;
    }

有更好(更准确)的方式吗?任何帮助表示赞赏。

0 个答案:

没有答案