Repository navigation
TextLine
Home | API by Category | Complete API Index | API Status
| Field | Value |
|---|---|
| Full name | Electron2D.TextLine |
| Namespace | Electron2D |
| Kind | class |
| Category | API Rendering |
Authors, shapes, measures and draws a retained single line with borrowed fonts and inline objects.
public sealed class Electron2D.TextLineThe creating thread owns access. Typed span metadata, object keys and font resources remain borrowed; duplicates copy authored state and own separate buffers. Prepared queries and drawing reuse layout storage. Size/width describe the trimmed display; carets and inline geometry retain the complete shaped buffer. Authoring is bounded to 1,048,576 Unicode scalars and 64 MiB UTF-16 text. This transient object is not serialized.
Inherits: ElectronObject
| Member | Kind | Summary |
|---|---|---|
public TextLine() |
constructor | Creates an empty thread-owned shaped-text buffer with the default line policies. |
public System.Boolean AddObject(Electron2D.TextObjectKey key, Electron2D.Vector2 size, Electron2D.InlineAlignment inlineAlign = Center, System.Int32 length = 1, System.Single baseline = 0f) |
method | Appends one inline object represented by the requested number of replacement scalars. |
public System.Boolean AddString(System.String text, Electron2D.Font font, System.Int32 fontSize, System.String language = "") |
method | Appends one copied text segment with its borrowed font and language. |
public System.Boolean AddString<T>(System.String text, Electron2D.Font font, System.Int32 fontSize, System.String language, T metadata) |
method | Appends a segment retaining metadata under its exact original type. |
public System.Void Clear() |
method | Removes content, objects and BIDI contexts while preserving RID, tabs and line policies. |
protected override System.Void Dispose(System.Boolean disposing) |
method | |
public System.Void Draw(Electron2D.CanvasItem canvas, Electron2D.Vector2 position, System.Nullable<Electron2D.Color> color = null, System.Single oversampling = 0f) |
method | Draws the trimmed line from its top-left origin into a recording canvas. |
public System.Void DrawOutline(Electron2D.CanvasItem canvas, Electron2D.Vector2 position, System.Int32 outlineSize = 1, System.Nullable<Electron2D.Color> color = null, System.Single oversampling = 0f) |
method | Draws the trimmed glyph outline from its top-left origin. |
public Electron2D.TextLine Duplicate() |
method | Copies authored state and every line policy into an independent thread-owned buffer. |
public Electron2D.TextDirection GetInferredDirection() |
method | Returns the inferred first-paragraph writing direction. |
public System.Single GetLineAscent() |
method | Returns the complete shaped line ascent. |
public System.Single GetLineDescent() |
method | Returns the complete shaped line descent. |
public System.Single GetLineUnderlinePosition() |
method | Returns maximum authored-font underline offset below the baseline. |
public System.Single GetLineUnderlineThickness() |
method | Returns maximum authored-font underline thickness. |
public System.Single GetLineWidth() |
method | Returns the ceiled advance-axis width of the trimmed display. |
public Electron2D.Rect2 GetObjectRect(Electron2D.TextObjectKey key) |
method | Returns an inline rectangle in line-top-left coordinates, including display alignment. |
public Electron2D.TextObjectKey[] GetObjects() |
method | Returns inline tokens in authored order as a caller-owned snapshot. |
protected override System.Collections.Generic.IEnumerable<Electron2D.PropertyDescriptor> GetPropertyDescriptors() |
method | |
public Electron2D.RID GetRID() |
method | Returns the stable borrowed identity of this line's live shaped buffer. |
public Electron2D.Vector2 GetSize() |
method | Returns the ceiled trimmed bounding size. |
public System.Boolean HasObject(Electron2D.TextObjectKey key) |
method | Reports whether the exact inline token is authored in this line. |
public System.Int32 HitTest(System.Single coords) |
method | Returns a valid complete-buffer scalar caret position near the baseline offset. |
public System.Boolean ResizeObject(Electron2D.TextObjectKey key, Electron2D.Vector2 size, Electron2D.InlineAlignment inlineAlign = Center, System.Single baseline = 0f) |
method | Changes an existing inline object's size/alignment/baseline without changing its source range. |
public System.Void SetBIDIOverride(System.ReadOnlySpan<Electron2D.TextBIDIRange> ranges) |
method | Replaces BIDI contexts with copied contiguous ranges covering the current scalar buffer. |
public System.Void TabAlign(System.ReadOnlySpan<System.Single> tabStops) |
method | Replaces repeating tab interval lengths. |
public System.Boolean TryGetSpanMetadata<T>(System.Int32 spanIndex, out T metadata) |
method | Reads a segment's exact typed metadata without conversion. |
protected override System.Void ValidateDisposal() |
method | |
protected override System.Void ValidateMutation() |
method | |
public Electron2D.HorizontalAlignment Alignment { get; set; } |
property | Gets or sets advance-axis alignment; initially Left. |
public Electron2D.TextDirection Direction { get; set; } |
property | Gets or sets writing direction; initially Auto. |
public System.String EllipsisChar { get; set; } |
property | Gets or sets the custom ellipsis text; its first Unicode scalar is used, or the default ellipsis for empty text. |
public Electron2D.TextJustificationFlags Flags { get; set; } |
property | Gets or sets Fill justification flags; initially Kashida and WordBound. |
public Electron2D.TextOrientation Orientation { get; set; } |
property | Gets or sets the drawing advance axis; initially Horizontal. |
public System.Boolean PreserveControl { get; set; } |
property | Gets or sets whether otherwise nonprinting controls are displayed; initially false. |
public System.Boolean PreserveInvalid { get; set; } |
property | Gets or sets whether missing characters display hexadecimal glyph boxes; initially true. |
public System.Int32 SpanCount { get; } |
property | Gets the number of authored text segments, excluding inline objects and empty additions. |
public Electron2D.TextOverrunBehavior TextOverrunBehavior { get; set; } |
property | Gets or sets the display trimming policy; initially TrimEllipsis. |
public System.Single Width { get; set; } |
property | Gets or sets available advance-axis width; initially minus one. |
Kind: constructor
public TextLine()Creates an empty thread-owned shaped-text buffer with the default line policies.
AddObject(Electron2D.TextObjectKey, Electron2D.Vector2, Electron2D.InlineAlignment, System.Int32, System.Single)
Kind: method
public System.Boolean AddObject(Electron2D.TextObjectKey key, Electron2D.Vector2 size, Electron2D.InlineAlignment inlineAlign = Center, System.Int32 length = 1, System.Single baseline = 0f)Appends one inline object represented by the requested number of replacement scalars.
False for an already present token, otherwise true.
-
key: Unique borrowed reference token. -
size: Finite nonnegative dimensions. -
inlineAlign: Two-axis alignment mask. -
length: Positive scalar length; one initially. -
baseline: Finite explicit baseline offset, including negative offsets.
Kind: method
public System.Boolean AddString(System.String text, Electron2D.Font font, System.Int32 fontSize, System.String language = "")Appends one copied text segment with its borrowed font and language.
True after successful authoring.
-
text: Text; empty is a successful no-op. Unpaired UTF-16 units become replacement scalars. -
font: Live borrowed font. -
fontSize: Positive supported logical size. -
language: Language tag, or empty for automatic script inference.
-
T:System.ArgumentNullException: Text, font or language is null. -
T:System.ArgumentException: Text exceeds the preparation limits. -
T:System.InvalidOperationException: Explicit BIDI contexts are active, access is off-owner or native work is active.
Kind: method
public System.Boolean AddString<T>(System.String text, Electron2D.Font font, System.Int32 fontSize, System.String language, T metadata)Appends a segment retaining metadata under its exact original type.
True after successful authoring.
-
text: Copied source text. -
font: Live borrowed font. -
fontSize: Logical font size. -
language: Language tag. -
metadata: Value retained by ordinary C# assignment.
Kind: method
public System.Void Clear()Removes content, objects and BIDI contexts while preserving RID, tabs and line policies.
Kind: method
protected override System.Void Dispose(System.Boolean disposing)Kind: method
public System.Void Draw(Electron2D.CanvasItem canvas, Electron2D.Vector2 position, System.Nullable<Electron2D.Color> color = null, System.Single oversampling = 0f)Draws the trimmed line from its top-left origin into a recording canvas.
-
canvas: Live recording canvas item. -
position: Finite top-left position. -
color: Finite modulation, or white. -
oversampling: Finite positive raster scale, or nonpositive for automatic scale.
DrawOutline(Electron2D.CanvasItem, Electron2D.Vector2, System.Int32, System.Nullable<Electron2D.Color>, System.Single)
Kind: method
public System.Void DrawOutline(Electron2D.CanvasItem canvas, Electron2D.Vector2 position, System.Int32 outlineSize = 1, System.Nullable<Electron2D.Color> color = null, System.Single oversampling = 0f)Draws the trimmed glyph outline from its top-left origin.
-
canvas: Live recording canvas. -
position: Finite top-left. -
outlineSize: Nonpositive draws the unexpanded glyph. -
color: Finite modulation, or white. -
oversampling: Raster scale, or nonpositive automatic scale.
Kind: method
public Electron2D.TextLine Duplicate()Copies authored state and every line policy into an independent thread-owned buffer.
A caller-owned duplicate sharing borrowed fonts/keys/payload values.
Kind: method
public Electron2D.TextDirection GetInferredDirection()Returns the inferred first-paragraph writing direction.
LTR for an empty automatic buffer.
Kind: method
public System.Single GetLineAscent()Returns the complete shaped line ascent.
Fractional pixels, or zero for empty text.
Kind: method
public System.Single GetLineDescent()Returns the complete shaped line descent.
Fractional pixels, or zero for empty text.
Kind: method
public System.Single GetLineUnderlinePosition()Returns maximum authored-font underline offset below the baseline.
Zero for no font spans.
Kind: method
public System.Single GetLineUnderlineThickness()Returns maximum authored-font underline thickness.
Zero for no font spans.
Kind: method
public System.Single GetLineWidth()Returns the ceiled advance-axis width of the trimmed display.
Zero for empty text.
Kind: method
public Electron2D.Rect2 GetObjectRect(Electron2D.TextObjectKey key)Returns an inline rectangle in line-top-left coordinates, including display alignment.
Zero for an absent token; full geometry for a trimmed object.
-
key: Borrowed token.
Kind: method
public Electron2D.TextObjectKey[] GetObjects()Returns inline tokens in authored order as a caller-owned snapshot.
Borrowed tokens, including trimmed objects.
Kind: method
protected override System.Collections.Generic.IEnumerable<Electron2D.PropertyDescriptor> GetPropertyDescriptors()Kind: method
public Electron2D.RID GetRID()Returns the stable borrowed identity of this line's live shaped buffer.
A distinct nonempty identity; Clear preserves it and duplicates have their own identity.
Kind: method
public Electron2D.Vector2 GetSize()Returns the ceiled trimmed bounding size.
Width/height follow Orientation.
Kind: method
public System.Boolean HasObject(Electron2D.TextObjectKey key)Reports whether the exact inline token is authored in this line.
Presence in the complete buffer.
-
key: Borrowed token.
Kind: method
public System.Int32 HitTest(System.Single coords)Returns a valid complete-buffer scalar caret position near the baseline offset.
Unicode scalar index with grapheme-boundary preference.
-
coords: Finite advance-axis pixels, including positions outside the line.
ResizeObject(Electron2D.TextObjectKey, Electron2D.Vector2, Electron2D.InlineAlignment, System.Single)
Kind: method
public System.Boolean ResizeObject(Electron2D.TextObjectKey key, Electron2D.Vector2 size, Electron2D.InlineAlignment inlineAlign = Center, System.Single baseline = 0f)Changes an existing inline object's size/alignment/baseline without changing its source range.
False for an absent token.
-
key: Existing borrowed token. -
size: Finite nonnegative dimensions. -
inlineAlign: Two-axis mask. -
baseline: Finite explicit offset.
Kind: method
public System.Void SetBIDIOverride(System.ReadOnlySpan<Electron2D.TextBIDIRange> ranges)Replaces BIDI contexts with copied contiguous ranges covering the current scalar buffer.
-
ranges: Defined directions and full nonoverlapping scalar ranges; empty clears overrides.
-
T:System.ArgumentException: Ranges do not cover the buffer contiguously.
Kind: method
public System.Void TabAlign(System.ReadOnlySpan<System.Single> tabStops)Replaces repeating tab interval lengths.
-
tabStops: Copied finite positive intervals; empty restores the backend default.
Kind: method
public System.Boolean TryGetSpanMetadata<T>(System.Int32 spanIndex, out T metadata)Reads a segment's exact typed metadata without conversion.
Whether the exact type matches.
-
spanIndex: Zero-based successful nonempty AddString index. -
metadata: Borrowed value, or default.
-
T:System.ArgumentOutOfRangeException: The text span does not exist.
Kind: method
protected override System.Void ValidateDisposal()Kind: method
protected override System.Void ValidateMutation()Kind: property
public Electron2D.HorizontalAlignment Alignment { get; set; }Gets or sets advance-axis alignment; initially Left.
Left, Center, Right or Fill.
Kind: property
public Electron2D.TextDirection Direction { get; set; }Gets or sets writing direction; initially Auto.
A defined text direction.
Kind: property
public System.String EllipsisChar { get; set; }Gets or sets the custom ellipsis text; its first Unicode scalar is used, or the default ellipsis for empty text.
The ellipsis character initially.
Kind: property
public Electron2D.TextJustificationFlags Flags { get; set; }Gets or sets Fill justification flags; initially Kashida and WordBound.
Defined flag bits.
Kind: property
public Electron2D.TextOrientation Orientation { get; set; }Gets or sets the drawing advance axis; initially Horizontal.
A defined text orientation.
Kind: property
public System.Boolean PreserveControl { get; set; }Gets or sets whether otherwise nonprinting controls are displayed; initially false.
The real control-glyph policy.
Kind: property
public System.Boolean PreserveInvalid { get; set; }Gets or sets whether missing characters display hexadecimal glyph boxes; initially true.
The real missing-glyph policy.
Kind: property
public System.Int32 SpanCount { get; }Gets the number of authored text segments, excluding inline objects and empty additions.
Zero initially.
Kind: property
public Electron2D.TextOverrunBehavior TextOverrunBehavior { get; set; }Gets or sets the display trimming policy; initially TrimEllipsis.
A defined overrun policy.
Kind: property
public System.Single Width { get; set; }Gets or sets available advance-axis width; initially minus one.
A finite value; nonpositive values do not trim or align.