protected override void OnGotContext(RenderContext context) { base.OnGotContext(context); var fontPath = Path.GetFullPath(GetFontFilePath()); var familyName = DirectWriteHelper.GetFontFamilyName(fontPath); _font = new D2DFont(context.DirectWriteFactory, familyName, FontSize, FontStyle.Regular, 10); _textBrush = new D2DSolidBrush(context, FillColor); }
protected override void OnGotContext(RenderContext context) { base.OnGotContext(context); var fontPath = Path.GetFullPath(GetFontFilePath()); var familyName = DirectWriteHelper.GetFontFamilyName(fontPath); _font = new D2DFont(context.DirectWriteFactory, familyName, FontSize, FontStyle.Regular, 10); _textFill = new D2DSolidBrush(context, FillColor); _textStroke = new D2DPen(context, StrokeColor, StrokeWidth); _fontFile = new FontFile(context.DirectWriteFactory, fontPath); _fontFace = new FontFace(context.DirectWriteFactory, FontFaceType.OpenTypeCollection, new[] { _fontFile }, 0, FontSimulations.None); _glyphRun = new GlyphRun { FontFace = _fontFace, FontSize = FontSize }; RegenerateFontPath(context); }