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
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
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.
public int Descent { get; }
Property Value
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
InternalLeading
Gets the internal leading measurement for the current font, in pixels.
public int InternalLeading { get; }
Property Value
MaxWidth
Gets the width of the widest character in the current font, in pixels.
public int MaxWidth { get; }
Property Value
Methods
CharWidth(char)
Gets the width of the specified character, in pixels.
public int CharWidth(char c)
Parameters
c
charThe 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
stringThe text you want to measure.
width
intThe width of the specified text.
height
intThe 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
stringThe text you want to measure.
width
intThe width of the specified text.
height
intThe height of the specified text.
kerning
intThe 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
stringThe text you want to render on the display device.
renderWidth
intThe width, in pixels, of the rectangular area needed to render the text.
renderHeight
intThe 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
stringThe text to render on the display device.
renderWidth
intThe width, in pixels, of the rectangular area needed to render the text.
renderHeight
intThe height, in pixels, of the rectangular area needed to render the text.
availableWidth
intThe 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
stringThe text to render on the display device.
renderWidth
intThe width, in pixels, of the rectangular area needed to render the text.
renderHeight
intThe height, in pixels, of the rectangular area needed to render the text.
xRelStart
intThe x-coordinate of the relative starting point for the text.
yRelStart
intThe y-coordinate of the relative starting point for the text.
availableWidth
intThe maximum width of text that will fit in the defined rectangular area.
availableHeight
intThe maximum height of text that will fit in the defined rectangular area.
dtFlags
uintFlags that specify various text characteristics, such as alignment.