From 82cd1d783511cfb928d17beccc440b92767a3efc Mon Sep 17 00:00:00 2001 From: Bebo-Maker Date: Tue, 12 Apr 2022 18:49:34 +0200 Subject: [PATCH] Add example for superscript/subscript. --- QuestPDF.Examples/TextExamples.cs | 46 ++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/QuestPDF.Examples/TextExamples.cs b/QuestPDF.Examples/TextExamples.cs index 1b26a24..0987ba9 100644 --- a/QuestPDF.Examples/TextExamples.cs +++ b/QuestPDF.Examples/TextExamples.cs @@ -36,7 +36,51 @@ namespace QuestPDF.Examples }); }); } - + + [Test] + public void SuperscriptSubscript() + { + RenderingTest + .Create() + .PageSize(500, 300) + + .ProduceImages() + .ShowResults() + .Render(container => + { + container + .Padding(5) + .MinimalBox() + .Border(1) + .Padding(10) + .Text(text => + { + text.Span("E=mc"); + text.Span("2").Superscript(); + + text.EmptyLine(); + + text.Span("H"); + text.Span("2").Subscript(); + text.Span("O"); + + text.EmptyLine(); + + text.ParagraphSpacing(2); + + var style = TextStyle.Default.Underline(); + + text.Span("Subscript").Style(style).Subscript().BackgroundColor(Colors.Green.Medium); + text.Span("Normal").Style(style).NormalPosition().BackgroundColor(Colors.Blue.Medium); + text.Line("Superscript").Style(style).Superscript().BackgroundColor(Colors.Red.Medium); + + text.Line("Superscript").Style(style).Superscript().BackgroundColor(Colors.Green.Medium); + text.Line("Normal").Style(style).NormalPosition().BackgroundColor(Colors.Blue.Medium); + text.Line("Subscript").Style(style).Subscript().BackgroundColor(Colors.Red.Medium); + }); + }); + } + [Test] public void ParagraphSpacing() {