Table of Contents

Class Font

Namespace
nanoFramework.UI
Assembly
nanoFramework.Graphics.dll

Represents a font that can be used to render text on a display.

public sealed class Font : MarshalByRefObject
Inheritance
Font
Inherited Members
Extension Methods

Fields

DefaultKerning

Contains the default kerning for a particular font. The kerning controls the amount of space between consecutive characters in a particular font.

public const int DefaultKerning = 1024

Field Value

int

Properties

Ascent

Gets the ascent measurement for the current font, in pixels. A font's ascent is the vertical distance between the font baseline and the top of the font area.

public int Ascent { get; }

Property Value

int

The ascent measurement for the current font, in pixels.

AverageWidth

Gets the average width of the characters in the current font, in pixels.

public int AverageWidth { get; }

Property Value

int

Descent

Gets the descent measurement for the current font, in pixels. A font's descent is the vertical distance between the font baseline and the bottom of the font area. The descent measurement for the current font, in pixels.

public int Descent { get; }

Property Value

int

ExternalLeading

Gets the external leading measurement for the current font, in pixels.

public int ExternalLeading { get; }

Property Value

int

The external leading measurement for the current font, in pixels.

Height

Gets the height of the current font, in pixels.

public int Height { get; }

Property Value

int

InternalLeading

Gets the internal leading measurement for the current font, in pixels. The internal leading measurement for the current font, in pixels.

public int InternalLeading { get; }

Property Value

int

MaxWidth

Gets the width of the widest character in the current font, in pixels.

public int MaxWidth { get; }

Property Value

int

Methods

CharWidth(char)

Gets the width of the specified character, in pixels.

public int CharWidth(char c)

Parameters

c char

The character to get the width of.

Returns

int

The width of the character in pixels.

ComputeExtent(string, out int, out int)

Computes the width, height, and kerning of a specified line of text.

public void ComputeExtent(string text, out int width, out int height)

Parameters

text string

The text you want to measure.

width int

The width of the specified text.

height int

The height of the specified text.

ComputeExtent(string, out int, out int, int)

Computes the width, height, and kerning of a specified line of text.

public void ComputeExtent(string text, out int width, out int height, int kerning)

Parameters

text string

The text you want to measure.

width int

The width of the specified text.

height int

The height of the specified text.

kerning int

The spacing between consecutive characters.

ComputeTextInRect(string, out int, out int)

Computes the size of the rectangular area on the display device needed to render the specified text string.

public void ComputeTextInRect(string text, out int renderWidth, out int renderHeight)

Parameters

text string

The text you want to render on the display device.

renderWidth int

The width, in pixels, of the rectangular area needed to render the text.

renderHeight int

The height, in pixels, of the rectangular area needed to render the text.

ComputeTextInRect(string, out int, out int, int)

Computes the size of the rectangular area needed to render the specified text string on the display device, given the maximum width available for the text.

public void ComputeTextInRect(string text, out int renderWidth, out int renderHeight, int availableWidth)

Parameters

text string

The text to render on the display device.

renderWidth int

The width, in pixels, of the rectangular area needed to render the text.

renderHeight int

The height, in pixels, of the rectangular area needed to render the text.

availableWidth int

The maximum width of text that will fit in the defined rectangular area.

ComputeTextInRect(string, out int, out int, int, int, int, int, uint)

Computes the size of the rectangular area needed to render the specified text string on the display device, given the starting point and maximum size available for the text.

public void ComputeTextInRect(string text, out int renderWidth, out int renderHeight, int xRelStart, int yRelStart, int availableWidth, int availableHeight, uint dtFlags)

Parameters

text string

The text to render on the display device.

renderWidth int

The width, in pixels, of the rectangular area needed to render the text.

renderHeight int

The height, in pixels, of the rectangular area needed to render the text.

xRelStart int

The x-coordinate of the relative starting point for the text.

yRelStart int

The y-coordinate of the relative starting point for the text.

availableWidth int

The maximum width of text that will fit in the defined rectangular area.

availableHeight int

The maximum height of text that will fit in the defined rectangular area.

dtFlags uint

Flags that specify various text characteristics, such as alignment.