首页 > 解决方案 > 让连字在 SharpDX/DirectWrite 中工作

问题描述

我无法让连字出现在 DirectWrite 代码中。我正在使用一种富含连字的字体,并且基本上应用了我可以得到的每个连字标签:

  var typography = new Typography(dwriteFactory);

  var ligatureTags = new[]
  {
    FontFeatureTag.StandardLigatures,
    FontFeatureTag.StylisticAlternates,
    FontFeatureTag.DiscretionaryLigatures,
    FontFeatureTag.RequiredLigatures,
    FontFeatureTag.ContextualLigatures,
    FontFeatureTag.HistoricalLigatures
  };

  foreach (var tag in ligatureTags)
  {
    FontFeature ff;
    ff.NameTag = tag;
    ff.Parameter = DisableLigatures ? 0 : 1;
    typography.AddFontFeature(ff);
  }

  textLayout.SetTypography(typography, EntireRange(text));

从上面的代码,StylisticAlternates并且DiscretionaryLigatures工作。但是,无论我做什么,StandardLigatures都不工作。

任何人都可以就为什么这不起作用提出建议吗?

标签: c#fontsrenderingsharpdxdirectwrite

解决方案


推荐阅读