TextParagraph

Hereda: RefCounted < Object

Contiene un párrafo de texto.

Descripción

Abstracción sobre TextServer para manejar un único párrafo de texto.

Propiedades

HorizontalAlignment

alignment

0

BitField[LineBreakFlag]

break_flags

3

String

custom_punctuation

""

Direction

direction

0

String

ellipsis_char

"…"

BitField[JustificationFlag]

justification_flags

163

float

line_spacing

0.0

int

max_lines_visible

-1

Orientation

orientation

0

bool

preserve_control

false

bool

preserve_invalid

true

OverrunBehavior

text_overrun_behavior

0

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

clear_dropcap()

void

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

void

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

void

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

void

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

void

draw_line_outline(canvas: RID, pos: Vector2, line: int, outline_size: int = 1, 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), dc_color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const

int

get_dropcap_lines() const

RID

get_dropcap_rid() const

Vector2

get_dropcap_size() const

Direction

get_inferred_direction() const

float

get_line_ascent(line: int) const

int

get_line_count() const

float

get_line_descent(line: int) const

Rect2

get_line_object_rect(line: int, key: Variant) const

Array

get_line_objects(line: int) const

Vector2i

get_line_range(line: int) const

RID

get_line_rid(line: int) const

Vector2

get_line_size(line: int) const

float

get_line_underline_position(line: int) const

float

get_line_underline_thickness(line: int) const

float

get_line_width(line: int) const

Vector2

get_non_wrapped_size() const

Vector2i

get_range() const

RID

get_rid() const

Vector2

get_size() const

int

hit_test(coords: Vector2) const

bool

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

void

set_bidi_override(override: Array)

bool

set_dropcap(text: String, font: Font, font_size: int, dropcap_margins: Rect2 = Rect2(0, 0, 0, 0), language: String = "")

void

tab_align(tab_stops: PackedFloat32Array)


Descripciones de Propiedades

HorizontalAlignment alignment = 0 🔗

Alineación horizontal del párrafo.


BitField[LineBreakFlag] break_flags = 3 🔗

Reglas de salto de línea. Para más información, véase TextServer.


String custom_punctuation = "" 🔗

  • void set_custom_punctuation(value: String)

  • String get_custom_punctuation()

Lista de caracteres de puntuación personalizados, utilizada para la división de palabras. Si se establece en una string vacía, se utilizan los valores predeterminados del servidor.


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] justification_flags = 163 🔗

Reglas de alineación de relleno de línea.


float line_spacing = 0.0 🔗

  • void set_line_spacing(value: float)

  • float get_line_spacing()

Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.


int max_lines_visible = -1 🔗

  • void set_max_lines_visible(value: int)

  • int get_max_lines_visible()

Limita las líneas de texto mostradas.


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 = 0 🔗

El comportamiento de recorte cuando el texto excede el ancho establecido del párrafo.


float width = -1.0 🔗

Ancho de párrafo.


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 el párrafo de texto (elimina el texto y los objetos en línea).


void clear_dropcap() 🔗

Removes dropcap.


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

Draw all lines of the text and drop cap 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_dropcap(canvas: RID, pos: Vector2, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const 🔗

Draw drop cap 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_dropcap_outline(canvas: RID, pos: Vector2, outline_size: int = 1, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const 🔗

Draw drop cap outline 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_line(canvas: RID, pos: Vector2, line: int, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const 🔗

Draw single line of 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_line_outline(canvas: RID, pos: Vector2, line: int, outline_size: int = 1, color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const 🔗

Draw outline of the single line of 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), dc_color: Color = Color(1, 1, 1, 1), oversampling: float = 0.0) const 🔗

Dibuja los contornos de todas las líneas del texto y la letra capital en un elemento del canvas en una posición dada, con color. pos especifica la esquina superior izquierda del cuadro delimitador. Si oversampling es mayor que cero, se utiliza como factor de sobremuestreo de la fuente, de lo contrario, se utilizan los ajustes de sobremuestreo del viewport.


int get_dropcap_lines() const 🔗

Devuelve el número de líneas usadas por la letra capital.


RID get_dropcap_rid() const 🔗

Devuelve el RID del búfer de texto de la letra capital.


Vector2 get_dropcap_size() const 🔗

Devuelve el tamaño del cuadro delimitador de la letra capital.


Direction get_inferred_direction() const 🔗

Returns the text writing direction inferred by the BiDi algorithm.


float get_line_ascent(line: int) const 🔗

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


int get_line_count() const 🔗

Devuelve el número de líneas en el párrafo.


float get_line_descent(line: int) const 🔗

Devuelve el descenso de la línea de texto (número de píxeles por debajo de la línea base para el diseño horizontal o a la derecha de la línea base para el diseño vertical).


Rect2 get_line_object_rect(line: int, key: Variant) const 🔗

Returns bounding rectangle of the inline object.


Array get_line_objects(line: int) const 🔗

Devuelve un array de objetos en línea en la línea.


Vector2i get_line_range(line: int) const 🔗

Devuelve el rango de caracteres de la línea.


RID get_line_rid(line: int) const 🔗

Devuelve el RID del búfer de línea de TextServer.


Vector2 get_line_size(line: int) const 🔗

Devuelve el tamaño del cuadro delimitador de la línea de texto. El tamaño devuelto se redondea hacia arriba.


float get_line_underline_position(line: int) const 🔗

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


float get_line_underline_thickness(line: int) const 🔗

Returns thickness of the underline.


float get_line_width(line: int) const 🔗

Devuelve el ancho (para diseño horizontal) o la altura (para vertical) de la línea de texto.


Vector2 get_non_wrapped_size() const 🔗

Devuelve el tamaño del cuadro delimitador del párrafo, sin saltos de línea.


Vector2i get_range() const 🔗

Devuelve el rango de caracteres del párrafo.


RID get_rid() const 🔗

Devuelve el RID del búfer de string completo de TextServer.


Vector2 get_size() const 🔗

Devuelve el tamaño del cuadro delimitador del párrafo.


int hit_test(coords: Vector2) const 🔗

Devuelve el desplazamiento del cursor en las coordenadas especificadas. 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.


bool set_dropcap(text: String, font: Font, font_size: int, dropcap_margins: Rect2 = Rect2(0, 0, 0, 0), language: String = "") 🔗

Establece la letra capital, sobreescribiendo la letra capital establecida previamente. La letra capital (letra capital caída) es un elemento decorativo al principio de un párrafo que es más grande que el resto del texto.


void tab_align(tab_stops: PackedFloat32Array) 🔗

Alinea un párrafo a las tabulaciones dadas.