Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }