SceneFontFace Class
A face of a font file (TrueType, OpenType, WOFF, WOFF2 or a collection), for the texts of a scene. Add it to a SceneFontCollection: the layout measures the texts with it and every renderer draws them with it.
public sealed class SceneFontFaceRemarks
A face keeps the bytes of its file, so that each renderer reads the same font: the image renderer loads it with its own font engine, and the SVG renderer can embed it (SvgRenderOptions.EmbedFonts). A face is immutable and can be used by several threads at the same time.
Properties
| Name | Description |
|---|---|
| Data | Gets the bytes of the font file the face was loaded from. |
| FamilyName | Gets the name of the family of the face, such as Liberation Sans; empty when the font has no name. |
| Index | Gets the index of the face in its file: 0, except for the faces of a font collection (.ttc, .otc). |
| IsItalic | Gets a value indicating whether the face is italic or oblique. |
| StrikeoutPosition | Gets the top of the strikethrough, in em, above the baseline. The value of the font, or 0.3 when it has none. |
| StrikeoutThickness | Gets the thickness of the strikethrough, in em. The value of the font, or 0.05 when it has none. |
| UnderlinePosition | Gets the top of the underline, in em, above the baseline: negative below it. The value of the font, or -0.075 when it has none. |
| UnderlineThickness | Gets the thickness of the underline, in em. The value of the font, or 0.05 when it has none. |
| Weight | Gets the weight of the face, from 1 to 1000: 400 is regular, 700 is bold. |
Data
SceneFontFace.csGets the bytes of the font file the face was loaded from.
public ReadOnlyMemory<byte> Data { get; }Property value
FamilyName
SceneFontFace.csIndex
SceneFontFace.csIsItalic
SceneFontFace.csStrikeoutPosition
SceneFontFace.csStrikeoutThickness
SceneFontFace.csUnderlinePosition
SceneFontFace.csUnderlineThickness
SceneFontFace.csWeight
SceneFontFace.csMethods
| Name | Description |
|---|---|
| Load(Stream) | Loads every face of a font file from a stream, read from its current position to its end. |
| Load(ReadOnlySpan<byte>) | Loads every face of a font file. |
| Load(string) | Loads every face of a font file. |
| ToString() | Returns a string that represents the current object. |
Load overloads
Load(Stream)
SceneFontFace.csLoads every face of a font file from a stream, read from its current position to its end.
public static IReadOnlyList<SceneFontFace> Load(Stream stream)Parameters
streamStream- The stream. It is left open.
Returns
IReadOnlyList<SceneFontFace> The faces of the file: one for a font, one per font of a collection.
Exceptions
FontException- The data is not a font, or the font is malformed, uses a feature that is not supported, or exceeds a limit.
IOException- An I/O error occurred.
Load(ReadOnlySpan<byte>)
SceneFontFace.csLoads every face of a font file.
public static IReadOnlyList<SceneFontFace> Load(ReadOnlySpan<byte> data)Parameters
dataReadOnlySpan<byte>- The bytes of the file. They are copied.
Returns
IReadOnlyList<SceneFontFace> The faces of the file: one for a font, one per font of a collection.
Exceptions
FontException- The data is not a font, or the font is malformed, uses a feature that is not supported, or exceeds a limit.
Load(string)
SceneFontFace.csLoads every face of a font file.
public static IReadOnlyList<SceneFontFace> Load(string path)Parameters
pathstring- The path of the file.
Returns
IReadOnlyList<SceneFontFace> The faces of the file: one for a font, one per font of a collection.
Exceptions
FontException- The file is not a font, or the font is malformed, uses a feature that is not supported, or exceeds a limit.
IOException- An I/O error occurred.