public void CanDefaultFont() { var builder = new RichTextBuilder(); builder.SetDefaultFont("Arial"); var rtf = builder.Text("Hello").ToRtf(); _output.WriteLine(rtf); int i = rtf.IndexOf("\\fonttbl", StringComparison.Ordinal); int j = rtf.IndexOf(" Arial;", StringComparison.Ordinal); int k = rtf.IndexOf("Hello", StringComparison.Ordinal); Assert.True(i > 0 && j > i && k > j); }
public void CanFontChange() { var builder = new RichTextBuilder(); builder.SetDefaultFont("Arial"); builder.Text("Start").LineBreak(); builder.Begin().Font("Times New Roman"); builder.Text("Times New Roman").End().LineBreak(); builder.Begin().Font("Arial").Text("Arial").End().LineBreak(); var rtf = builder.ToRtf(); _output.WriteLine(rtf); int i = rtf.IndexOf(@"{\f1 Times New Roman}", StringComparison.Ordinal); int j = rtf.IndexOf(@"{\f0 Arial}", StringComparison.Ordinal); Assert.True(i > 0 && j > i); }