Example #1
0
 public TextItem(float dx, float dy, Text.Font font, Fill fill, DominantBaseline dominantBaseline, string text)
 {
     Dx               = dx;
     Dy               = dy;
     Font             = font;
     Text             = text;
     Fill             = fill;
     DominantBaseline = dominantBaseline;
 }
Example #2
0
        public DW.FontFace GetFontFace(Text.Font font)
        {
            var fontFamily = _fontDictionary.GetFontFamily(font.Family);

            var xFont = fontFamily.GetFirstMatchingFont(
                GetFontWeight(font.Weight),
                GetFontStretch(font.Stretch),
                GetFontStyle(font.Style)
                );

            return(new DW.FontFace(xFont));
        }
Example #3
0
        public DW.TextFormat GetTextFormat(Text.Font font)
        {
            var fontName = _fontDictionary.SelectFontFamilyName(font.Family, out var fontCollection);

            return(new DW.TextFormat(
                       _factory,
                       fontName,
                       fontCollection,
                       GetFontWeight(font.Weight),
                       GetFontStyle(font.Style),
                       GetFontStretch(font.Stretch),
                       font.Size
                       ));
        }
Example #4
0
        public DW.TextLayout GetTextLayout(Text.Font font, string text, float maxWidth)
        {
            var tl = new DW.TextLayout(
                _factory,
                text,
                GetTextFormat(font),
                maxWidth,
                9999999
                );

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (font.TextDecoration)
            {
            case TextDecoration.LineThrough:
                tl.SetStrikethrough(true, new DW.TextRange(0, text.Length));
                break;

            case TextDecoration.Underline:
                tl.SetUnderline(true, new DW.TextRange(0, text.Length));
                break;
            }

            return(tl);
        }
Example #5
0
 public DW.TextLayout CreateTextLayout(Text.Font font, string text, float width)
 {
     return(_fontManager.GetTextLayout(font, text, width));
 }