|
|
@@ -13,16 +13,20 @@ namespace QuestPDF.Fluent
|
|
|
return style.FontColor(value);
|
|
|
}
|
|
|
|
|
|
- public static TextStyle FontColor(this TextStyle style, string value)
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.fontColor"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="colorParam"]/*' />
|
|
|
+ public static TextStyle FontColor(this TextStyle style, string color)
|
|
|
{
|
|
|
- ColorValidator.Validate(value);
|
|
|
- return style.Mutate(TextStyleProperty.Color, value);
|
|
|
+ ColorValidator.Validate(color);
|
|
|
+ return style.Mutate(TextStyleProperty.Color, color);
|
|
|
}
|
|
|
|
|
|
- public static TextStyle BackgroundColor(this TextStyle style, string value)
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.backgroundColor"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="colorParam"]/*' />
|
|
|
+ public static TextStyle BackgroundColor(this TextStyle style, string color)
|
|
|
{
|
|
|
- ColorValidator.Validate(value);
|
|
|
- return style.Mutate(TextStyleProperty.BackgroundColor, value);
|
|
|
+ ColorValidator.Validate(color);
|
|
|
+ return style.Mutate(TextStyleProperty.BackgroundColor, color);
|
|
|
}
|
|
|
|
|
|
[Obsolete("This element has been renamed since version 2022.3. Please use the FontFamily method.")]
|
|
|
@@ -31,6 +35,7 @@ namespace QuestPDF.Fluent
|
|
|
return style.FontFamily(value);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.fontFamily"]/*' />
|
|
|
public static TextStyle FontFamily(this TextStyle style, string value)
|
|
|
{
|
|
|
return style.Mutate(TextStyleProperty.FontFamily, value);
|
|
|
@@ -42,41 +47,52 @@ namespace QuestPDF.Fluent
|
|
|
return style.FontSize(value);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.fontSize"]/*' />
|
|
|
public static TextStyle FontSize(this TextStyle style, float value)
|
|
|
{
|
|
|
+ if (value <= 0)
|
|
|
+ throw new ArgumentException("Font size must be greater than 0.");
|
|
|
+
|
|
|
return style.Mutate(TextStyleProperty.Size, value);
|
|
|
}
|
|
|
|
|
|
- public static TextStyle LineHeight(this TextStyle style, float value)
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.lineHeight"]/*' />
|
|
|
+ public static TextStyle LineHeight(this TextStyle style, float factor = 1)
|
|
|
{
|
|
|
- return style.Mutate(TextStyleProperty.LineHeight, value);
|
|
|
+ if (factor <= 0)
|
|
|
+ throw new ArgumentException("Line height must be greater than 0.");
|
|
|
+
|
|
|
+ return style.Mutate(TextStyleProperty.LineHeight, factor);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Letter spacing controls space between characters. Value 0 corresponds to normal spacing defined by a font.
|
|
|
- /// Positive values create additional space, whereas negative values reduce space between characters.
|
|
|
- /// Added / reduced space is relative to the font size.
|
|
|
- /// </summary>
|
|
|
- public static TextStyle LetterSpacing(this TextStyle style, float value)
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.letterSpacing"]/*' />
|
|
|
+ public static TextStyle LetterSpacing(this TextStyle style, float factor = 1)
|
|
|
{
|
|
|
- return style.Mutate(TextStyleProperty.LetterSpacing, value);
|
|
|
+ if (factor <= 0)
|
|
|
+ throw new ArgumentException("Letter spacing must be greater than 0.");
|
|
|
+
|
|
|
+ return style.Mutate(TextStyleProperty.LetterSpacing, factor);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.italic"]/*' />
|
|
|
public static TextStyle Italic(this TextStyle style, bool value = true)
|
|
|
{
|
|
|
return style.Mutate(TextStyleProperty.IsItalic, value);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.strikethrough"]/*' />
|
|
|
public static TextStyle Strikethrough(this TextStyle style, bool value = true)
|
|
|
{
|
|
|
return style.Mutate(TextStyleProperty.HasStrikethrough, value);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.underline"]/*' />
|
|
|
public static TextStyle Underline(this TextStyle style, bool value = true)
|
|
|
{
|
|
|
return style.Mutate(TextStyleProperty.HasUnderline, value);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.wrapAnywhere"]/*' />
|
|
|
public static TextStyle WrapAnywhere(this TextStyle style, bool value = true)
|
|
|
{
|
|
|
return style.Mutate(TextStyleProperty.WrapAnywhere, value);
|
|
|
@@ -89,51 +105,71 @@ namespace QuestPDF.Fluent
|
|
|
return style.Mutate(TextStyleProperty.FontWeight, weight);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.thin"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle Thin(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.Thin);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.extraLight"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle ExtraLight(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.ExtraLight);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.light"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle Light(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.Light);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.normal"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle NormalWeight(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.Normal);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.medium"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle Medium(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.Medium);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.semiBold"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle SemiBold(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.SemiBold);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.bold"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle Bold(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.Bold);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.extraBold"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle ExtraBold(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.ExtraBold);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.black"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle Black(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.Black);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.extraBlack"]/*' />
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.weight.remarks"]/*' />
|
|
|
public static TextStyle ExtraBlack(this TextStyle style)
|
|
|
{
|
|
|
return style.Weight(FontWeight.ExtraBlack);
|
|
|
@@ -143,16 +179,19 @@ namespace QuestPDF.Fluent
|
|
|
|
|
|
#region Position
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.position.normal"]/*' />
|
|
|
public static TextStyle NormalPosition(this TextStyle style)
|
|
|
{
|
|
|
return style.Position(FontPosition.Normal);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.position.subscript"]/*' />
|
|
|
public static TextStyle Subscript(this TextStyle style)
|
|
|
{
|
|
|
return style.Position(FontPosition.Subscript);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.position.superscript"]/*' />
|
|
|
public static TextStyle Superscript(this TextStyle style)
|
|
|
{
|
|
|
return style.Position(FontPosition.Superscript);
|
|
|
@@ -167,11 +206,13 @@ namespace QuestPDF.Fluent
|
|
|
|
|
|
#region Fallback
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.fontFallback"]/*' />
|
|
|
public static TextStyle Fallback(this TextStyle style, TextStyle? value = null)
|
|
|
{
|
|
|
return style.Mutate(TextStyleProperty.Fallback, value);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.fontFallback"]/*' />
|
|
|
public static TextStyle Fallback(this TextStyle style, Func<TextStyle, TextStyle> handler)
|
|
|
{
|
|
|
return style.Fallback(handler(TextStyle.Default));
|
|
|
@@ -186,16 +227,19 @@ namespace QuestPDF.Fluent
|
|
|
return style.Mutate(TextStyleProperty.Direction, textDirection);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.direction.auto"]/*' />
|
|
|
public static TextStyle DirectionAuto(this TextStyle style)
|
|
|
{
|
|
|
return style.TextDirection(Infrastructure.TextDirection.Auto);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.direction.ltr"]/*' />
|
|
|
public static TextStyle DirectionFromLeftToRight(this TextStyle style)
|
|
|
{
|
|
|
return style.TextDirection(Infrastructure.TextDirection.LeftToRight);
|
|
|
}
|
|
|
|
|
|
+ /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.direction.rtl"]/*' />
|
|
|
public static TextStyle DirectionFromRightToLeft(this TextStyle style)
|
|
|
{
|
|
|
return style.TextDirection(Infrastructure.TextDirection.RightToLeft);
|