diff --git a/QuestPDF.Examples/TextBenchmark.cs b/QuestPDF.Examples/TextBenchmark.cs index 7082ddd..990a370 100644 --- a/QuestPDF.Examples/TextBenchmark.cs +++ b/QuestPDF.Examples/TextBenchmark.cs @@ -200,7 +200,7 @@ namespace QuestPDF.Examples text.DefaultTextStyle(normalStyle); text.Span("Ten dokument został wygenerowany na podstawie książki w formacie TXT opublikowanej w serwisie "); - text.ExternalLocation("wolnelektury.pl", "https://wolnelektury.pl/", normalStyle.Color(Colors.Blue.Medium).Underlined()); + text.ExternalLocation("wolnelektury.pl", "https://wolnelektury.pl/", normalStyle.Color(Colors.Blue.Medium).Underline()); text.Span(". Dziękuję za wspieranie polskiego czytelnictwa!"); }); }); diff --git a/QuestPDF.Examples/TextExamples.cs b/QuestPDF.Examples/TextExamples.cs index e3d78b8..0c1231b 100644 --- a/QuestPDF.Examples/TextExamples.cs +++ b/QuestPDF.Examples/TextExamples.cs @@ -37,7 +37,7 @@ namespace QuestPDF.Examples text.Line(Placeholders.LoremIpsum()); - text.Span($"This is target text that does not show up. {DateTime.UtcNow:T} > This is a short sentence that will be wrapped into second line hopefully, right? <", TextStyle.Default.Underlined()); + text.Span($"This is target text that does not show up. {DateTime.UtcNow:T} > This is a short sentence that will be wrapped into second line hopefully, right? <", TextStyle.Default.Underline()); }); }); } @@ -102,7 +102,7 @@ namespace QuestPDF.Examples text.Span("This text is a normal text, "); text.Span("this is a bold text, ", TextStyle.Default.Bold()); - text.Span("this is a red and underlined text, ", TextStyle.Default.Color(Colors.Red.Medium).Underlined()); + text.Span("this is a red and underlined text, ", TextStyle.Default.Color(Colors.Red.Medium).Underline()); text.Span("and this is slightly bigger text.", TextStyle.Default.Size(16)); text.EmptyLine(); @@ -162,7 +162,7 @@ namespace QuestPDF.Examples text.Span("This text is a normal text, "); text.Span("this is a bold text, ", TextStyle.Default.Bold()); - text.Span("this is a red and underlined text, ", TextStyle.Default.Color(Colors.Red.Medium).Underlined()); + text.Span("this is a red and underlined text, ", TextStyle.Default.Color(Colors.Red.Medium).Underline()); text.Span("and this is slightly bigger text.", TextStyle.Default.Size(16)); text.Span("The new text element also supports injecting custom content between words: "); diff --git a/QuestPDF/Elements/Text/Items/TextBlockSpan.cs b/QuestPDF/Elements/Text/Items/TextBlockSpan.cs index 92a35e8..2c0e4b2 100644 --- a/QuestPDF/Elements/Text/Items/TextBlockSpan.cs +++ b/QuestPDF/Elements/Text/Items/TextBlockSpan.cs @@ -115,11 +115,11 @@ namespace QuestPDF.Elements.Text.Items request.Canvas.DrawText(text, Position.Zero, Style); // draw underline - if (Style.IsUnderlined && fontMetrics.UnderlinePosition.HasValue) + if (Style.HasUnderline && fontMetrics.UnderlinePosition.HasValue) DrawLine(fontMetrics.UnderlinePosition.Value, fontMetrics.UnderlineThickness.Value); // draw stroke - if (Style.IsStroked && fontMetrics.StrikeoutPosition.HasValue) + if (Style.HasStrikethrough && fontMetrics.StrikeoutPosition.HasValue) DrawLine(fontMetrics.StrikeoutPosition.Value, fontMetrics.StrikeoutThickness.Value); void DrawLine(float offset, float thickness) diff --git a/QuestPDF/Fluent/TextStyleExtensions.cs b/QuestPDF/Fluent/TextStyleExtensions.cs index 32d5c17..64cae02 100644 --- a/QuestPDF/Fluent/TextStyleExtensions.cs +++ b/QuestPDF/Fluent/TextStyleExtensions.cs @@ -43,14 +43,14 @@ namespace QuestPDF.Fluent return style.Mutate(x => x.IsItalic = value); } - public static TextStyle Stroked(this TextStyle style, bool value = true) + public static TextStyle Strikethrough(this TextStyle style, bool value = true) { - return style.Mutate(x => x.IsStroked = value); + return style.Mutate(x => x.HasStrikethrough = value); } - public static TextStyle Underlined(this TextStyle style, bool value = true) + public static TextStyle Underline(this TextStyle style, bool value = true) { - return style.Mutate(x => x.IsUnderlined = value); + return style.Mutate(x => x.HasUnderline = value); } #region Weight diff --git a/QuestPDF/Infrastructure/TextStyle.cs b/QuestPDF/Infrastructure/TextStyle.cs index 623fa18..76bbd99 100644 --- a/QuestPDF/Infrastructure/TextStyle.cs +++ b/QuestPDF/Infrastructure/TextStyle.cs @@ -11,8 +11,8 @@ namespace QuestPDF.Infrastructure internal float LineHeight { get; set; } = 1.2f; internal FontWeight FontWeight { get; set; } = FontWeight.Normal; internal bool IsItalic { get; set; } = false; - internal bool IsStroked { get; set; } = false; - internal bool IsUnderlined { get; set; } = false; + internal bool HasStrikethrough { get; set; } = false; + internal bool HasUnderline { get; set; } = false; public static TextStyle Default => new TextStyle(); @@ -20,7 +20,7 @@ namespace QuestPDF.Infrastructure public override string ToString() { - KeyCache ??= $"{Color}|{BackgroundColor}|{FontType}|{Size}|{LineHeight}|{FontWeight}|{IsItalic}|{IsStroked}|{IsUnderlined}"; + KeyCache ??= $"{Color}|{BackgroundColor}|{FontType}|{Size}|{LineHeight}|{FontWeight}|{IsItalic}|{HasStrikethrough}|{HasUnderline}"; return KeyCache; } diff --git a/QuestPDF/QuestPDF.csproj b/QuestPDF/QuestPDF.csproj index 6722dc4..e1f8c99 100644 --- a/QuestPDF/QuestPDF.csproj +++ b/QuestPDF/QuestPDF.csproj @@ -4,7 +4,7 @@ MarcinZiabek CodeFlint QuestPDF - 2021.10.0-beta + 2021.10.0-beta.2 QuestPDF is an open-source, modern and battle-tested library that can help you with generating PDF documents by offering friendly, discoverable and predictable C# fluent API. Enhanced text rendering capabilities. 8