Table of Contents

Method ToUserString

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

ToUserString(FontWeight)

Converts the specified FontWeight value to its corresponding user-friendly string representation.

public static string ToUserString(FontWeight weight)

Parameters

weight FontWeight

The 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 weight value 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

style FontStyle

The FontStyle value representing the font styles to convert. Multiple styles can be combined using bitwise operations.

weight FontWeight

The 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

family GenericFontFamily

The 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 family is 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

font IFontHandler

The font to convert. Cannot be null.

Returns

string

A string that represents the font in a user-friendly format.