TextLine

Hereda: RefCounted < Object

Contiene una línea de texto.

Descripción

Abstracción sobre TextServer para manejar una sola línea de texto.

Propiedades

HorizontalAlignment

alignment

0

Direction

direction

0

String

ellipsis_char

"…"

BitField[JustificationFlag]

flags

3

Orientation

orientation

0

bool

preserve_control

false

bool

preserve_invalid

true

OverrunBehavior

text_overrun_behavior

3

float

width

-1.0

Métodos

bool

add_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, length: int = 1, baseline: float = 0.0)

bool

add_string(text: String, font: Font, font_size: int, language: String = "", meta: Variant = null)

void

clear()

void

draw(canvas: RID, pos: Vector2, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const

void

draw_outline(canvas: RID, pos: Vector2, outline_size: int = 1, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const

TextLine

duplicate() const

Direction

get_inferred_direction() const

float

get_line_ascent() const

float

get_line_descent() const

float

get_line_underline_position() const

float

get_line_underline_thickness() const

float

get_line_width() const

Rect2

get_object_rect(key: Variant) const

Array

get_objects() const

RID

get_rid() const

Vector2

get_size() const

bool

has_object(key: Variant) const

int

hit_test(coords: float) const

bool

resize_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, baseline: float = 0.0)

void

set_bidi_override(override: Array)

void

tab_align(tab_stops: PackedFloat32Array)


Descripciones de Propiedades

HorizontalAlignment alignment = 0 🔗

Sets text alignment within the line as if the line was horizontal.


Direction direction = 0 🔗

Dirección de escritura del texto.


String ellipsis_char = "…" 🔗

  • void set_ellipsis_char(value: String)

  • String get_ellipsis_char()

Carácter de elipsis utilizado para el recorte de texto.


BitField[JustificationFlag] flags = 3 🔗

Reglas de alineación de línea. Para más información, consulta TextServer.


Orientation orientation = 0 🔗

Orientación del texto.


bool preserve_control = false 🔗

  • void set_preserve_control(value: bool)

  • bool get_preserve_control()

Si se establece a true, el texto mostrará caracteres de control.


bool preserve_invalid = true 🔗

  • void set_preserve_invalid(value: bool)

  • bool get_preserve_invalid()

Si se establece a true, el texto mostrará caracteres inválidos.


OverrunBehavior text_overrun_behavior = 3 🔗

El comportamiento de recorte cuando el texto excede el ancho establecido de la línea de texto.


float width = -1.0 🔗

El ancho de la línea de texto.


Descripciones de Métodos

bool add_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, length: int = 1, baseline: float = 0.0) 🔗

Añade un objeto en línea al buffer de texto, key debe ser único. En el texto, el objeto se representa como length caracteres de reemplazo de objeto.


bool add_string(text: String, font: Font, font_size: int, language: String = "", meta: Variant = null) 🔗

Agrega espacio de texto y fuente para dibujarlo.


void clear() 🔗

Limpia la línea de texto (elimina el texto y los objetos en línea).


void draw(canvas: RID, pos: Vector2, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const 🔗

Draw text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.


void draw_outline(canvas: RID, pos: Vector2, outline_size: int = 1, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const 🔗

Draw text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.


TextLine duplicate() const 🔗

Duplicates this TextLine.


Direction get_inferred_direction() const 🔗

Returns the text writing direction inferred by the BiDi algorithm.


float get_line_ascent() const 🔗

Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).


float get_line_descent() const 🔗

Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).


float get_line_underline_position() const 🔗

Devuelve el desplazamiento de píxeles del subrayado debajo de la línea base.


float get_line_underline_thickness() const 🔗

Returns thickness of the underline.


float get_line_width() const 🔗

Returns width (for horizontal layout) or height (for vertical) of the text.


Rect2 get_object_rect(key: Variant) const 🔗

Returns bounding rectangle of the inline object.


Array get_objects() const 🔗

Devuelve un array de objetos en la línea.


RID get_rid() const 🔗

Devuelve el RID del búfer de TextServer.


Vector2 get_size() const 🔗

Returns size of the bounding box of the text.


bool has_object(key: Variant) const 🔗

Returns true if an object with key is embedded in this line.


int hit_test(coords: float) const 🔗

Devuelve el desplazamiento del cursor en el píxel especificado en la línea base. Esta función siempre devuelve una posición válida.


bool resize_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, baseline: float = 0.0) 🔗

Sets new size and alignment of embedded object.


void set_bidi_override(override: Array) 🔗

Overrides BiDi for the structured text.

Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.


void tab_align(tab_stops: PackedFloat32Array) 🔗

Alinea el texto con las tabulaciones indicadas.