Class Font
Inherited Members
Namespace: nanoFramework.UI
Assembly: nanoFramework.Graphics.dll
Syntax
public sealed class Font : MarshalByRefObject
Fields
DefaultKerning
Contains the default kerning for a particular font. The kerning controls the amount of space between consecutive characters in a particular font.
Declaration
public const int DefaultKerning = 1024
Field Value
Type | Description |
---|---|
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.
Declaration
public int Ascent { get; }
Property Value
Type | Description |
---|---|
int |
AverageWidth
Gets the average width of the characters in the current font, in pixels.
Declaration
public int AverageWidth { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
public int Descent { get; }
Property Value
Type | Description |
---|---|
int |
ExternalLeading
Gets the external leading measurement for the current font, in pixels.
Declaration
public int ExternalLeading { get; }
Property Value
Type | Description |
---|---|
int |
Height
Gets the height of the current font, in pixels.
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
int |
InternalLeading
Gets the internal leading measurement for the current font, in pixels.
Declaration
public int InternalLeading { get; }
Property Value
Type | Description |
---|---|
int |
MaxWidth
Gets the width of the widest character in the current font, in pixels.
Declaration
public int MaxWidth { get; }
Property Value
Type | Description |
---|---|
int |
Methods
CharWidth(char)
Gets the width of the specified character, in pixels.
Declaration
public int CharWidth(char c)
Parameters
Type | Name | Description |
---|---|---|
char | c |
Returns
Type | Description |
---|---|
int |
ComputeExtent(string, out int, out int, int)
Declaration
public void ComputeExtent(string text, out int width, out int height, int kerning)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text you want to measure. |
int | width | The width of the specified text. |
int | height | The height of the specified text. |
int | kerning | The spacing between consecutive characters. |
ComputeExtent(string, out int, out int)
Computes the width, height, and kerning of a specified line of text.
Declaration
public void ComputeExtent(string text, out int width, out int height)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text you want to measure. |
int | width | The width of the specified text. |
int | height | The height of the specified text. |
ComputeTextInRect(string, out int, out int, int, int, int, int, uint)
Computes the size of the rectangular area on the display device needed to render the specified text string.
Declaration
public void ComputeTextInRect(string text, out int renderWidth, out int renderHeight, int xRelStart, int yRelStart, int availableWidth, int availableHeight, uint dtFlags)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text you want to render on the display device. |
int | renderWidth | The width, in pixels, of the rectangular area needed to render the text. |
int | renderHeight | The height, in pixels, of the rectangular area needed to render the text. |
int | xRelStart | The x-coordinate of the relative starting point for the text. |
int | yRelStart | The y-coordinate of the relative starting point for the text. |
int | availableWidth | The maximum width of text that will fit in the defined rectangular area. |
int | availableHeight | The maximum height of text that will fit in the defined rectangular area. |
uint | dtFlags | Flags that specify various text characteristics, such as alignment. |
ComputeTextInRect(string, out int, out int, int)
Computes the size of the rectangular area on the display device needed to render the specified text string.
Declaration
public void ComputeTextInRect(string text, out int renderWidth, out int renderHeight, int availableWidth)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text you want to render on the display device. |
int | renderWidth | The width, in pixels, of the rectangular area needed to render the text. |
int | renderHeight | The height, in pixels, of the rectangular area needed to render the text. |
int | availableWidth | The maximum width of text that will fit in the defined rectangular area. |
ComputeTextInRect(string, out int, out int)
Computes the size of the rectangular area on the display device needed to render the specified text string.
Declaration
public void ComputeTextInRect(string text, out int renderWidth, out int renderHeight)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text you want to render on the display device. |
int | renderWidth | The width, in pixels, of the rectangular area needed to render the text. |
int | renderHeight | The height, in pixels, of the rectangular area needed to render the text. |