Method ToUserString
ToUserString(FontWeight)
Converts the specified FontWeight value to its corresponding user-friendly string representation.
public static string ToUserString(FontWeight weight)
Parameters
weightFontWeightThe FontWeight value to convert.
Returns
- string
A string representing the specified font weight. For example, "thin" for Thin or "bold" for Bold. Returns an empty string if the font weight is Normal.
Exceptions
- ArgumentException
Thrown if the
weightvalue is not a recognized FontWeight.
ToUserString(FontStyle, FontWeight)
Converts the specified font style and weight into a list of user-friendly string descriptions.
public static List<string> ToUserString(FontStyle style, FontWeight weight)
Parameters
styleFontStyleThe FontStyle value representing the font styles to convert. Multiple styles can be combined using bitwise operations.
weightFontWeightThe FontWeight value representing the font weight to include in the description if the Bold flag is set.
Returns
- List<string>
A list of strings describing the font styles and weight. The list may include "underlined", "strikethrough", "italic", and a description of the font weight if applicable.
Remarks
The method checks for specific flags in the style parameter and
adds corresponding descriptions to the result. If the Bold
flag is set, the weight parameter is used
to generate a description for the font weight.
ToUserString(GenericFontFamily)
Converts a GenericFontFamily value to its corresponding user-friendly string representation.
public static string ToUserString(GenericFontFamily family)
Parameters
familyGenericFontFamilyThe GenericFontFamily value to convert.
Returns
- string
A string representing the specified font family. Returns an empty string for None or Default. Returns "swiss" for SansSerif, "roman" for Serif, and "teletype" for Monospace.
Exceptions
- ArgumentException
Thrown if
familyis not a recognized GenericFontFamily value.
ToUserString(IFontHandler)
Converts the specified font information to a user-friendly string representation.
public static string ToUserString(IFontHandler font)
Parameters
fontIFontHandlerThe font to convert. Cannot be null.
Returns
- string
A string that represents the font in a user-friendly format.