Table of Contents

Class Font

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

Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.

public class Font : DisposableObject, IBaseObject, IDisposableObject, IDisposable, IEquatable<Font>
Inheritance
Font
Implements

Constructors

Font(Font, FontStyle)

Initializes a new Font that uses the specified existing Font and FontStyle enumeration.

Font(Font, double)

Initializes a new Font that uses the specified existing Font and newSize parameter.

Font(FontFamily, double)

Initializes a new Font using a specified size.

Font(FontFamily, double, FontStyle)

Initializes a new Font using a specified font family, size in points and style.

Font(FontFamily, double, FontStyle, GraphicsUnit)

Initializes a new Font using a specified size, style, and unit.

Font(FontFamily, double, FontStyle, GraphicsUnit, byte)

Initializes a new Font using a specified size, style, unit, and character set.

Font(FontFamily, double, FontStyle, GraphicsUnit, byte, bool)

Initializes a new Font using a specified size, style, unit, and character set.

Font(FontFamily, float, GraphicsUnit)

Initializes a new Font using a specified size and unit. Sets the style to Regular.

Font(FontInfo)

Initializes a new Font using a FontInfo.

Font(IFontHandler)

Initializes a new Font using a specified font handler.

Font(string, double)

Initializes a new Font using a specified size.

Font(string, double, FontStyle)

Initializes a new Font using a specified font familty name, size in points and style.

Font(string, double, FontStyle, GraphicsUnit)

Initializes a new Font using a specified size, style, and unit.

Font(string, double, FontStyle, GraphicsUnit, byte)

Initializes a new Font using a specified size, style, unit, and character set.

Font(string, double, FontStyle, GraphicsUnit, byte, bool)

Initializes a new Font using the specified size, style, unit, and character set.

Font(string, double, GraphicsUnit)

Initializes a new Font using a specified size and unit. The style is set to Regular.

Properties

AsBold

Returns bold version of the font.

AsFillPaint

Gets SKPaint for this font with Fill style.

AsStrokeAndFillPaint

Gets SKPaint for this font with StrokeAndFill style.

AsStrokePaint

Gets SKPaint for this font with Stroke style.

AsUnderlined

Returns underlined version of the font.

Base

Gets this font with Regular style.

Default

Gets the default font used in the application.

DefaultMono

Gets the default fixed width font used in the application.

FontFamily

Gets the FontFamily associated with this Font.

GdiCharSet

Gets a byte value that specifies the character set that this Font uses.

GdiVerticalFont

Gets a bool value that indicates whether this Font is derived from a vertical font.

Handler

Gets native font.

IsBold

Gets a value that indicates whether this Font is bold.

IsFixedWidth

Gets whether this font is a fixed width (or monospaced) font.

IsItalic

Gets a value that indicates whether this Font is italic.

IsStrikeout

Same as IsStrikethrough.

IsStrikethrough

Gets a value that indicates whether this Font specifies a horizontal line through the font.

IsUnderlined

Gets a value that indicates whether this Font is underlined.

IsUsingSizeInPixels

Gets whether font size is in pixels.

Name

Gets the font family name of this Font.

NumericWeight

Gets the font weight as an integer value.

OriginalFontName

Gets the name of the font originally specified.

Size

Gets the em-size of this Font measured in the units specified by the Unit property.

SizeInDips

Gets the size in dips.

SizeInPixels

Gets the pixel size.

SizeInPoints

Gets the em-size, in points, of this Font.

SkiaFont

Gets or sets SKFont for this font.

SkiaMetrics

Gets SKFontMetrics for this font.

Style

Gets style information for this Font.

Unit

Gets the unit of measure for this Font.

Weight

Gets the font weight.

Methods

ChangeFontStyle(FontStyle, FontStyle, bool)

Turns on or off FontStyle element(s).

CheckSize(double)

If font size is correct, returns it; otherwise returns default font size.

Clone()

Creates an exact copy of this Font.

CoerceFontParams(FontParams)
DisposeManaged()

Override to dispose managed resources. Here we dispose all used object references.

Equals(Font?)

Indicates whether the current object is equal to another object of the same type.

Equals(object?)

Determines whether the specified object is equal to the current object.

Equals(string, double, FontStyle)

Indicates whether the current objects properties are equal to the specified properties.

FromInternal(IFontHandler?)

Creates Font from native font.

Get(string, double, FontStyle)
GetDefaultOrNew(string, double, FontStyle, Font?)

Creates new font or gets defaultFont if its properties are equal to the specified.

GetFontStyleArraySize()

Gets size of the array with FontStyle as index.

GetHashCode()

Serves as the default hash function.

GetIsBold(FontWeight)
GetNumericWeightOf(FontWeight)

Helper function for converting FontWeight enum value to the numeric weight.

GetSkiaWidthClosestToNumericValue(int)

Helper function for converting arbitrary numeric width to the closest value of SKFontStyleWidth enum.

GetStyle(IFontHandler)
GetWeightClosestToNumericValue(int)

Helper function for converting arbitrary numeric weight to the closest value of FontWeight enum.

GetWithStyle(FontStyle)
IsVerticalName(string?)

Gets whether font name is from vertical font (starts with @ char).

Larger()

Returns a larger version of this font.

Scaled(double)

Returns a scaled version of this font.

Smaller()

Returns a smaller version of this font.

ToInfoString()

Returns a human-readable string representation of this Font.

ToString()

Returns a string that represents the current object.

ToUserAsList(IFontHandler)
ToUserString(FontStyle, FontWeight)
ToUserString(FontWeight)
ToUserString(GenericFontFamily)
ToUserString(IFontHandler)
WithName(string)

Returns font with same parameters, but with different name.

WithStyle(FontStyle)

Returns font with same name and size, but with different FontStyle.

Operators

operator ==(Font?, Font?)

Returns a value that indicates whether the two objects are equal.

implicit operator FontNameAndSize(Font)

Converts the specified Font to a FontNameAndSize.

implicit operator SKFont(Font)

Converts the specified Font to a SKFont.

implicit operator Font(FontNameAndSize)

Converts the specified FontNameAndSize to a Font.

operator !=(Font?, Font?)

Returns a value that indicates whether the two objects are not equal.