protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory) { base.OnCreateDeviceIndependentResources(factory); this._textFormat = DirectWriteFactory.CreateTextFormat("Gabriola", 72); this._textFormat.TextAlignment = TextAlignment.Center; this._textFormat.ParagraphAlignment = ParagraphAlignment.Center; float width = ClientSize.Width / dpiScaleX; float height = ClientSize.Height / dpiScaleY; this._textLayout = DirectWriteFactory.CreateTextLayout("Click on this text Click on this text", this._textFormat, width, height); this._textAnalyzer = DirectWriteFactory.CreateTextAnalyzer(); this._source = new MyTextSource("Click on this text Click on this text"); using (FontCollection coll = this._textFormat.FontCollection) { int count = coll.Count; for (int index = 0; index < count; ++index) { using (FontFamily ff = coll[index]) { using (Font font = ff.GetFirstMatchingFont(FontWeight.Normal, FontStretch.Normal, FontStyle.Normal)) { LocalizedStrings ls = font.FaceNames; LocalizedStrings desc = font.GetInformationalStrings(InformationalStringId.Designer); int cultureIndex = ls.FindCulture(CultureInfo.CurrentCulture); string faceName = ls[cultureIndex]; FontMetrics metrics = font.Metrics; } } } } this._textAnalyzer.AnalyzeLineBreakpoints(_source, 0, (uint)_source.Text.Length); this._textAnalyzer.AnalyzeScript(_source, 0, (uint)_source.Text.Length); }