2021.10.0-beta.2 Improved API naming

This commit is contained in:
Marcin Ziąbek
2021-09-14 12:16:49 +02:00
parent 569864d48a
commit 84e896e13b
6 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -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!");
});
});
+3 -3
View File
@@ -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: ");
@@ -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)
+4 -4
View File
@@ -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
+3 -3
View File
@@ -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;
}
+1 -1
View File
@@ -4,7 +4,7 @@
<Authors>MarcinZiabek</Authors>
<Company>CodeFlint</Company>
<PackageId>QuestPDF</PackageId>
<Version>2021.10.0-beta</Version>
<Version>2021.10.0-beta.2</Version>
<PackageDescription>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.</PackageDescription>
<PackageReleaseNotes>Enhanced text rendering capabilities.</PackageReleaseNotes>
<LangVersion>8</LangVersion>