Class Font
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
Inherited Members
Namespace: SixLabors.Fonts
Assembly: SixLabors.Fonts.dll
Syntax
public sealed class FontConstructors
| Improve this Doc View SourceFont(Font, FontStyle)
Initializes a new instance of the Font class.
Declaration
public Font(Font prototype, FontStyle style)Parameters
| Type | Name | Description | 
|---|---|---|
| Font | prototype | The prototype. | 
| FontStyle | style | The font style. | 
Font(Font, Single)
Initializes a new instance of the Font class.
Declaration
public Font(Font prototype, float size)Parameters
| Type | Name | Description | 
|---|---|---|
| Font | prototype | The prototype. | 
| Single | size | The size of the font in PT units. | 
Font(Font, Single, FontStyle)
Initializes a new instance of the Font class.
Declaration
public Font(Font prototype, float size, FontStyle style)Parameters
| Type | Name | Description | 
|---|---|---|
| Font | prototype | The prototype. | 
| Single | size | The size of the font in PT units. | 
| FontStyle | style | The font style. | 
Font(FontFamily, Single)
Initializes a new instance of the Font class.
Declaration
public Font(FontFamily family, float size)Parameters
| Type | Name | Description | 
|---|---|---|
| FontFamily | family | The font family. | 
| Single | size | The size of the font in PT units. | 
Font(FontFamily, Single, FontStyle)
Initializes a new instance of the Font class.
Declaration
public Font(FontFamily family, float size, FontStyle style)Parameters
| Type | Name | Description | 
|---|---|---|
| FontFamily | family | The font family. | 
| Single | size | The size of the font in PT units. | 
| FontStyle | style | The font style. | 
Properties
| Improve this Doc View SourceFamily
Gets the family.
Declaration
public FontFamily Family { get; }Property Value
| Type | Description | 
|---|---|
| FontFamily | 
FontMetrics
Gets the font metrics.
Declaration
public FontMetrics FontMetrics { get; }Property Value
| Type | Description | 
|---|---|
| FontMetrics | 
IsBold
Gets a value indicating whether this Font is bold.
Declaration
public bool IsBold { get; }Property Value
| Type | Description | 
|---|---|
| Boolean | 
IsItalic
Gets a value indicating whether this Font is italic.
Declaration
public bool IsItalic { get; }Property Value
| Type | Description | 
|---|---|
| Boolean | 
Name
Gets the name.
Declaration
public string Name { get; }Property Value
| Type | Description | 
|---|---|
| String | 
Size
Gets the size of the font in PT units.
Declaration
public float Size { get; }Property Value
| Type | Description | 
|---|---|
| Single | 
Methods
| Improve this Doc View SourceGetGlyphs(CodePoint, ColorFontSupport)
Gets the glyphs for the given codepoint.
Declaration
public IEnumerable<Glyph> GetGlyphs(CodePoint codePoint, ColorFontSupport support)Parameters
| Type | Name | Description | 
|---|---|---|
| CodePoint | codePoint | The code point of the character. | 
| ColorFontSupport | support | Options for enabling color font support during layout and rendering. | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<Glyph> | Returns the glyph | 
GetGlyphs(CodePoint, TextAttributes, ColorFontSupport)
Gets the glyphs for the given codepoint.
Declaration
public IEnumerable<Glyph> GetGlyphs(CodePoint codePoint, TextAttributes textAttributes, ColorFontSupport support)Parameters
| Type | Name | Description | 
|---|---|---|
| CodePoint | codePoint | The code point of the character. | 
| TextAttributes | textAttributes | The text attributes to apply to the glyphs. | 
| ColorFontSupport | support | Options for enabling color font support during layout and rendering. | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<Glyph> | Returns the glyph | 
TryGetPath(out String)
Gets the filesystem path to the font family source.
Declaration
public bool TryGetPath(out string path)Parameters
| Type | Name | Description | 
|---|---|---|
| String | path | When this method returns, contains the filesystem path to the font family source, if the path exists; otherwise, the default value for the type of the path parameter. This parameter is passed uninitialized. | 
Returns
| Type | Description | 
|---|---|
| Boolean | true if the Font was created via a filesystem path; otherwise, false. |