Class FontProp
Defines the properties of a font, where the font size is in points.
public class FontProp
- Inheritance
-
FontProp
- Derived
- Inherited Members
Examples
StandardFontDef fontDef = new StandardFontDef(StandardFont.Helvetica);
FontProp font = new(fontDef, 12, Color.Blue, FontPropOptions.Underline);
Constructors
FontProp(FontDef, double, Color, FontPropOptions)
Initializes a new instance of the FontProp class with the specified font definition, size, color and options.
public FontProp(FontDef fontDef, double size, Color color, FontPropOptions options = FontPropOptions.None)
Parameters
fontDef
FontDefThe font definition.
size
doubleThe font size in points.
color
ColorThe font color.
options
FontPropOptionsThe font options.
Exceptions
- ArgumentNullException
The font definition is null.
- ArgumentOutOfRangeException
The size of the font must be greater than 0.
FontProp(FontDef, double, FontPropOptions)
Initializes a new instance of the FontProp class with the specified font definition, size and options.
public FontProp(FontDef fontDef, double size, FontPropOptions options = FontPropOptions.None)
Parameters
fontDef
FontDefThe font definition.
size
doubleThe font size in points.
options
FontPropOptionsThe font options.
Exceptions
- ArgumentNullException
The font definition is null.
- ArgumentOutOfRangeException
The size of the font must be greater than 0.
FontProp(FontProp)
Initializes a new instance of the FontProp class based on the properties of the specified source font. The background will not be copied.
public FontProp(FontProp sourceFontProp)
Parameters
sourceFontProp
FontPropThe source font.
Exceptions
- ArgumentNullException
The source font is null.
FontProp(FontProp, Color)
Initializes a new instance of the FontProp class based on the properties of the specified source font, where the color can be specified.
public FontProp(FontProp sourceFontProp, Color color)
Parameters
Exceptions
- ArgumentNullException
The source font is null.
FontProp(FontProp, FontPropOptions)
Initializes a new instance of the FontProp class based on the properties of the specified source font, where the options can be specified.
public FontProp(FontProp sourceFontProp, FontPropOptions options)
Parameters
sourceFontProp
FontPropThe source font.
options
FontPropOptionsThe font options.
Exceptions
- ArgumentNullException
The source font is null.
FontProp(FontProp, double, Color?)
Initializes a new instance of the FontProp class based on the properties of the specified source font, where size and color can be specified.
public FontProp(FontProp sourceFontProp, double size, Color? color = null)
Parameters
sourceFontProp
FontPropThe source font.
size
doubleThe new font size in points.
color
Color?The new font color, if not specified, the color of the source font is used.
Exceptions
- ArgumentNullException
The source font is null.
- ArgumentOutOfRangeException
The size of the font must be greater than 0.
Properties
Ascender
Gets the ascender of the font in points.
public double Ascender { get; }
Property Value
- double
The ascender in points.
AscenderMM
Gets the ascender of the font in millimeters.
public double AscenderMM { get; }
Property Value
- double
The ascender in millimeters.
Background
Gets or sets the background color of the font.
public Color? Background { get; init; }
Property Value
- Color?
The background color of the font. The default value is null, which stands for no background color.
CapHeight
Gets the cap height of the font in points, i.e. the height of an uppercase letter like 'X'.
public double CapHeight { get; }
Property Value
- double
The cap height in points.
- See Also
CapHeightMM
Gets the cap height of the font in millimeters, i.e. the height of a lowercase letter like 'x'.
public double CapHeightMM { get; }
Property Value
- double
The cap height in millimeters.
- See Also
Color
Gets the color of the font.
public Color Color { get; }
Property Value
- Color
The color of the font.
Descender
Gets the descender of the font in points.
public double Descender { get; }
Property Value
- double
The descender in points.
DescenderMM
Gets the descender of the font in millimeters.
public double DescenderMM { get; }
Property Value
- double
The descender in millimeters.
FontDef
Gets the font definition of the font.
public FontDef FontDef { get; }
Property Value
IsStrikethrough
Gets a value indicating whether the text is struck through.
public bool IsStrikethrough { get; }
Property Value
IsSubscript
Gets a value indicating whether the text is subscript.
public bool IsSubscript { get; }
Property Value
IsSuperscript
Gets a value indicating whether the text is superscript.
public bool IsSuperscript { get; }
Property Value
IsUnderlined
Gets a value indicating whether the font is underlined.
public bool IsUnderlined { get; }
Property Value
LineFeed
Gets the standard line feed of the font in points.
public double LineFeed { get; }
Property Value
- double
The standard line feed in points.
- See Also
LineFeedMM
Gets the standard line feed of the font in millimeters.
public double LineFeedMM { get; }
Property Value
- double
The standard line feed in millimeters.
- See Also
Options
Gets the options of the font.
public FontPropOptions Options { get; }
Property Value
- FontPropOptions
The font options.
Size
Gets the size of the font in points.
public double Size { get; }
Property Value
- double
The size of the font in points.
SizeMM
Gets the size of the font in millimeters.
public double SizeMM { get; }
Property Value
- double
The size of the font in millimeters.
XHeight
Gets the x-height of the font in points, i.e. the height of a lowercase letter like 'x'.
public double XHeight { get; }
Property Value
- double
The x-height in points.
- See Also
XHeightMM
Gets the cap height of the font in millimeters, i.e. the height of a lowercase letter like 'x'.
public double XHeightMM { get; }
Property Value
- double
The x-height in millimeters.
- See Also
Methods
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Operators
operator ==(FontProp?, FontProp?)
Determines whether two fonts are equal.
public static bool operator ==(FontProp? left, FontProp? right)
Parameters
Returns
operator !=(FontProp?, FontProp?)
Determines whether two fonts are not equal.
public static bool operator !=(FontProp? left, FontProp? right)