add letter spacing to TextStyle

This commit is contained in:
Bennet Bo Fenner
2022-11-03 16:43:29 +01:00
parent 65990ebf59
commit bbf3d71e7e
3 changed files with 15 additions and 2 deletions
@@ -55,7 +55,13 @@ namespace QuestPDF.Fluent
descriptor.MutateTextStyle(x => x.LineHeight(value));
return descriptor;
}
public static T LetterSpacing<T>(this T descriptor, float value) where T : TextSpanDescriptor
{
descriptor.MutateTextStyle(x => x.LetterSpacing(value));
return descriptor;
}
public static T Italic<T>(this T descriptor, bool value = true) where T : TextSpanDescriptor
{
descriptor.MutateTextStyle(x => x.Italic(value));
+6 -1
View File
@@ -48,7 +48,12 @@ namespace QuestPDF.Fluent
{
return style.Mutate(TextStyleProperty.LineHeight, value);
}
public static TextStyle LetterSpacing(this TextStyle style, float value)
{
return style.Mutate(TextStyleProperty.LetterSpacing, value);
}
public static TextStyle Italic(this TextStyle style, bool value = true)
{
return style.Mutate(TextStyleProperty.IsItalic, value);
+2
View File
@@ -10,6 +10,7 @@ namespace QuestPDF.Infrastructure
internal string? FontFamily { get; set; }
internal float? Size { get; set; }
internal float? LineHeight { get; set; }
internal float? LetterSpacing { get; set; }
internal FontWeight? FontWeight { get; set; }
internal FontPosition? FontPosition { get; set; }
internal bool? IsItalic { get; set; }
@@ -26,6 +27,7 @@ namespace QuestPDF.Infrastructure
FontFamily = Fonts.Lato,
Size = 12,
LineHeight = 1.2f,
LetterSpacing = 0,
FontWeight = Infrastructure.FontWeight.Normal,
FontPosition = Infrastructure.FontPosition.Normal,
IsItalic = false,