-
Notifications
You must be signed in to change notification settings - Fork 0
Font
Namespace: Electron2D
Provides the Electron2D base resource for text layout and drawing.
public abstract class Electron2D.Font : Electron2D.ResourceFont supplies the text metrics used by Electron2D.CanvasItem.DrawString(Electron2D.Font,Electron2D.Vector2,System.String,Electron2D.HorizontalAlignment,System.Single,System.Int32,System.Nullable{Electron2D.Color})
and Electron2D.Label. Electron2D 0.1.0 Preview implements a minimal
layout cache, Unicode scalar enumeration through System.Text.Rune and
fallback font resolution. Concrete font loading remains a later resource
import task.
The public surface follows Electron2D's text resource contract. Native text objects stay internal to the renderer backend.
This type is not synchronized. Create, mutate and query font resources on the main thread that owns the scene tree.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.DrawString(Electron2D.Font,Electron2D.Vector2,System.String,Electron2D.HorizontalAlignment,System.Single,System.Int32,System.Nullable{Electron2D.Color})
| Member | Kind | Summary |
|---|---|---|
Electron2D.Font() |
Constructor | Initializes a new instance of the Font type. |
GetAscent(System.Int32) |
Method | Returns the ascent above the text baseline for a font size. |
GetDescent(System.Int32) |
Method | Returns the descent below the text baseline for a font size. |
GetHeight(System.Int32) |
Method | Returns the line height for a font size. |
GetStringSize(System.String, Electron2D.HorizontalAlignment, System.Single, System.Int32) |
Method | Returns the size required to draw a single-line string. |
HasChar(System.Int32) |
Method | Checks whether this font contains a glyph for a Unicode codepoint. |
Kind: Constructor
public Electron2D.Font()Initializes a new instance of the Font type.
The new instance follows the lifetime and validation rules of its declaring type.
This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.
This API is available since Electron2D 0.1.0 Preview.
Electron2D.Font
Kind: Method
public System.Single GetAscent(System.Int32)(System.Int32 fontSize)Returns the ascent above the text baseline for a font size.
This method follows the validation and lifetime rules of its declaring type.
-
fontSize: The requested font size in pixels.
The ascent in pixels.
-
System.ArgumentOutOfRangeException: Thrown whenfontSizeis less than or equal to zero.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Font
Kind: Method
public System.Single GetDescent(System.Int32)(System.Int32 fontSize)Returns the descent below the text baseline for a font size.
This method follows the validation and lifetime rules of its declaring type.
-
fontSize: The requested font size in pixels.
The descent in pixels.
-
System.ArgumentOutOfRangeException: Thrown whenfontSizeis less than or equal to zero.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Font
Kind: Method
public System.Single GetHeight(System.Int32)(System.Int32 fontSize)Returns the line height for a font size.
This method follows the validation and lifetime rules of its declaring type.
-
fontSize: The requested font size in pixels.
The line height in pixels.
-
System.ArgumentOutOfRangeException: Thrown whenfontSizeis less than or equal to zero.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Font
Kind: Method
public Electron2D.Vector2 GetStringSize(System.String, Electron2D.HorizontalAlignment, System.Single, System.Int32)(System.String text, Electron2D.HorizontalAlignment alignment, System.Single width, System.Int32 fontSize)Returns the size required to draw a single-line string.
This method follows the validation and lifetime rules of its declaring type.
-
text: The Unicode text to measure. -
alignment: The horizontal alignment used whenwidthis non-negative. -
width: The optional alignment width. Negative values measure without a width constraint. -
fontSize: The requested font size in pixels.
The measured string size in pixels.
-
System.ArgumentNullException: Thrown whentextisnull. -
System.ArgumentOutOfRangeException: Thrown whenfontSizeis less than or equal to zero.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Font
Kind: Method
public System.Boolean HasChar(System.Int32)(System.Int32 charCode)Checks whether this font contains a glyph for a Unicode codepoint.
This method follows the validation and lifetime rules of its declaring type.
-
charCode: The Unicode scalar value to query.
true when the font contains the glyph; otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Font
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.