TextLine
Holds a line of text.
class TextLineAbstraction over TextServer for handling a single line of text.
Holds a line of text.
class TextLineAbstraction over TextServer for handling a single line of text.
import SwiftGodotFramework to write Godot Game Extensions using the Swift Programming Language.
class TextServerA server interface for font management and text rendering.
class RefCountedBase class for reference-counted objects.
protocol CustomStringConvertibleA type with a customized textual representation.
protocol EquatableA type that can be compared for value equality.
protocol Hashable : EquatableA type that can be hashed into a Hasher to produce an integer hash value.
protocol Identifiable<ID>A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable : VariantStorableTypes that conform to VariantRepresentable can be stored directly in Variant with no conversion. These include all of the Variant types from Godot (for example GString, Rect, Plane), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.
protocol VariantStorableTypes that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
override class var godotClassName: StringName { get }final var alignment: HorizontalAlignment { get set }Sets text alignment within the line as if the line was horizontal.
final var direction: TextServer.Direction { get set }Text writing direction.
final var ellipsisChar: String { get set }Ellipsis character used for text clipping.
final var flags: TextServer.JustificationFlag { get set }Line alignment rules. For more info see TextServer.
final var orientation: TextServer.Orientation { get set }Text orientation.
final var preserveControl: Bool { get set }If set to true text will display control characters.
final var preserveInvalid: Bool { get set }If set to true text will display invalid characters.
final var textOverrunBehavior: TextServer.OverrunBehavior { get set }Sets the clipping behavior when the text exceeds the text line’s set width. See TextServer.OverrunBehavior for a description of all modes.
final var width: Double { get set }Text line width.
final func addObject(key: Variant, size: Vector2, inlineAlign: InlineAlignment = .center, length: Int32 = 1, baseline: Double = 0.0) -> Bool Adds inline object to the text buffer, key must be unique. In the text, object is represented as length object replacement characters.
final func addString(text: String, font: Font?, fontSize: Int32, language: String = "", meta: Variant) -> Bool Adds text span and font to draw it.
final func clear() Clears text line (removes text and inline objects).
final func draw(canvas: RID, pos: Vector2, color: Color = Color (r: 1, g: 1, b: 1, a: 1)) Draw text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box.
final func drawOutline(canvas: RID, pos: Vector2, outlineSize: Int32 = 1, color: Color = Color (r: 1, g: 1, b: 1, a: 1)) Draw text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box.
final func getLineAscent() -> Double Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
final func getLineDescent() -> Double Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
final func getLineUnderlinePosition() -> Double Returns pixel offset of the underline below the baseline.
final func getLineUnderlineThickness() -> Double Returns thickness of the underline.
final func getLineWidth() -> Double Returns width (for horizontal layout) or height (for vertical) of the text.
final func getObjectRect(key: Variant) -> Rect2 Returns bounding rectangle of the inline object.
final func getObjects() -> GArray Returns array of inline objects.
final func getRid() -> RID Returns TextServer buffer RID.
final func getSize() -> Vector2 Returns size of the bounding box of the text.
final func hitTest(coords: Double) -> Int32 Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
final func resizeObject(key: Variant, size: Vector2, inlineAlign: InlineAlignment = .center, baseline: Double = 0.0) -> Bool Sets new size and alignment of embedded object.
final func setBidiOverride(_ override: GArray) Overrides BiDi for the structured text.
final func tabAlign(tabStops: PackedFloat32Array) Aligns text to the given tab-stops.