如何在TextFormatter中使用新的OpenType功能?

时间:2014-03-13 18:04:41

标签: wpf opentype

Typography类可用于使用OpenType字体的新颖字体功能。您可以通过在xaml中装饰Run来使用它们,如下所示:

<Run Typography.Capitals="SmallCaps">Capitals</Run>

这很好,但我不想直接渲染,而是将其转换为Geometry进行进一步处理。

这可以定期使用FormattedText类,如此代码段所示:

var tf = new Typeface(
  new System.Windows.Media.FontFamily("Pericles"),
  FontStyles.Normal,
  FontWeights.Normal,
  new FontStretch()
);

var brush = new SolidColorBrush(Colors.Black);

var ftext = new FormattedText(
  text,
  CultureInfo.CurrentCulture,
  FlowDirection.LeftToRight,
  tf,
  72,
  brush
);

var geometry = ftext.BuildGeometry(new Point());

虽然我在Typography类中找不到任何参数。

有没有人有任何想法?

0 个答案:

没有答案
相关问题