protected override void DoApply(TextLayout layout, TextRange range) { Typography tp = new Typography(this.dwFactory); tp.AddFeature(new FontFeature() { NameTag = tag, Value = 1 }); layout.SetTypography(tp, range); }
private void InitializeMultiformattedText() { _mainForm.MultiformattedTextRenderPanel.InitializeDevice(); _multiformattedTextBrush = new SolidColorBrush(MultiformattedRenderTarget, new Color4(0.0f, 0.0f, 0.0f)); string text = "Hello World using DirectWrite!"; _multiformattedLayout = _writeFactory.CreateTextLayout(text, _textFormat, 640.0f, 480.0f); _multiformattedLayout.SetFontSize(100.0f, new TextRange(20, 6)); _multiformattedLayout.SetUnderline(true, new TextRange(20, 11)); _multiformattedLayout.SetFontWeight(FontWeight.Bold, new TextRange(20, 11)); using (Typography typography = _writeFactory.CreateTypography()) { typography.AddFeature(new FontFeature(FontFeatureTag.StylisticSet7, 1)); _multiformattedLayout.SetTypography(typography, new TextRange(0, text.Length)); } }