public ChatFormatter(Typeface typeface, double fontSize, Brush foreground, IDictionary<string,Brush> palette) { _runProperties = new CustomTextRunProperties(typeface, fontSize, foreground, Brushes.Transparent, false); _paraProperties = new CustomParagraphProperties(_runProperties); _formatter = TextFormatter.Create(TextFormattingMode.Display); _palette = palette; }
public ChatFormatter(Typeface typeface, double fontSize, Brush foreground, IDictionary <string, Brush> palette) { _runProperties = new CustomTextRunProperties(typeface, fontSize, foreground, Brushes.Transparent, false); _paraProperties = new CustomParagraphProperties(_runProperties); _formatter = TextFormatter.Create(TextFormattingMode.Display); _palette = palette; }
public IEnumerable <TextLine> Format(string text, IChatSpanProvider spans, double width, Brush foreground, Brush background, TextWrapping textWrapping) { _text = text; _spans = spans; _background = background; _runProperties = new CustomTextRunProperties(_runProperties.Typeface, _runProperties.FontRenderingEmSize, foreground, Brushes.Transparent, false); _paraProperties = new CustomParagraphProperties(_runProperties); if (width < 0) { width = 0; text = ""; } int idx = 0; while (idx < _text.Length) { var line = _formatter.FormatLine(this, idx, width, _paraProperties, null); idx += line.Length; yield return(line); } }
public IEnumerable<TextLine> Format(string text, IChatSpanProvider spans, double width, Brush foreground, Brush background, TextWrapping textWrapping) { _text = text; _spans = spans; _background = background; _runProperties = new CustomTextRunProperties(_runProperties.Typeface, _runProperties.FontRenderingEmSize, foreground, Brushes.Transparent, false); _paraProperties = new CustomParagraphProperties(_runProperties); if (width < 0) { width = 0; text = ""; } int idx = 0; while(idx < _text.Length) { var line = _formatter.FormatLine(this, idx, width, _paraProperties, null); idx += line.Length; yield return line; } }