Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
TextParagraph
Hérite de : RefCounted < Object
Contient un paragraphe de texte.
Description
Abstraction over TextServer for handling a single paragraph of text.
Propriétés
|
||
BitField[LineBreakFlag] |
|
|
|
||
|
||
|
||
BitField[JustificationFlag] |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
Méthodes
add_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, length: int = 1, baseline: float = 0.0) |
|
add_string(text: String, font: Font, font_size: int, language: String = "", meta: Variant = null) |
|
void |
clear() |
void |
|
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 |
duplicate() const |
|
get_dropcap_lines() const |
|
get_dropcap_rid() const |
|
get_dropcap_size() const |
|
get_inferred_direction() const |
|
get_line_ascent(line: int) const |
|
get_line_count() const |
|
get_line_descent(line: int) const |
|
get_line_object_rect(line: int, key: Variant) const |
|
get_line_objects(line: int) const |
|
get_line_range(line: int) const |
|
get_line_rid(line: int) const |
|
get_line_size(line: int) const |
|
get_line_underline_position(line: int) const |
|
get_line_underline_thickness(line: int) const |
|
get_line_width(line: int) const |
|
get_non_wrapped_size() const |
|
get_range() const |
|
get_rid() const |
|
get_size() const |
|
has_object(key: Variant) const |
|
resize_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, baseline: float = 0.0) |
|
void |
set_bidi_override(override: Array) |
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) |
Descriptions des propriétés
HorizontalAlignment alignment = 0 🔗
void set_alignment(value: HorizontalAlignment)
HorizontalAlignment get_alignment()
Alignement horizontal de paragraphe.
BitField[LineBreakFlag] break_flags = 3 🔗
void set_break_flags(value: BitField[LineBreakFlag])
BitField[LineBreakFlag] get_break_flags()
Line breaking rules. For more info see TextServer.
String custom_punctuation = "" 🔗
Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
Direction d'écriture du texte.
Caractère d’ellipse utilisé pour tronquer du texte.
BitField[JustificationFlag] justification_flags = 163 🔗
void set_justification_flags(value: BitField[JustificationFlag])
BitField[JustificationFlag] get_justification_flags()
Règles d'alignement du remplissage des lignes.
Espacement vertical supplémentaire entre les lignes (en pixels), l'espacement est ajouté à la descente de la ligne. Cette valeur peut être négative.
Limits the lines of text shown.
Orientation orientation = 0 🔗
void set_orientation(value: Orientation)
Orientation get_orientation()
Orientation du texte.
bool preserve_control = false 🔗
Si défini à true, le texte affichera les caractères de contrôle.
bool preserve_invalid = true 🔗
Si défini à true, le texte affichera les caractères invalides.
OverrunBehavior text_overrun_behavior = 0 🔗
void set_text_overrun_behavior(value: OverrunBehavior)
OverrunBehavior get_text_overrun_behavior()
The clipping behavior when the text exceeds the paragraph's set width.
Largeur du paragraphe.
Descriptions des méthodes
bool add_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, length: int = 1, baseline: float = 0.0) 🔗
Adds inline object to the text buffer, key must be unique. In the text, object is represented as length object replacement characters.
bool add_string(text: String, font: Font, font_size: int, language: String = "", meta: Variant = null) 🔗
Adds text span and font to draw it.
void clear() 🔗
Clears text paragraph (removes text and inline objects).
void clear_dropcap() 🔗
Enlève la lettrine.
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 🔗
Draw outlines of 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.
TextParagraph duplicate() const 🔗
Duplicates this TextParagraph.
int get_dropcap_lines() const 🔗
Returns number of lines used by dropcap.
Returns drop cap text buffer RID.
Vector2 get_dropcap_size() const 🔗
Returns drop cap bounding box size.
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).
Renvoie le nombre de lignes dans le paragraphe.
float get_line_descent(line: int) const 🔗
Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for 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 🔗
Returns array of inline objects in the line.
Vector2i get_line_range(line: int) const 🔗
Returns character range of the line.
RID get_line_rid(line: int) const 🔗
Returns TextServer line buffer RID.
Vector2 get_line_size(line: int) const 🔗
Returns size of the bounding box of the line of text. Returned size is rounded up.
float get_line_underline_position(line: int) const 🔗
Returns pixel offset of the underline below the baseline.
float get_line_underline_thickness(line: int) const 🔗
Returns thickness of the underline.
float get_line_width(line: int) const 🔗
Returns width (for horizontal layout) or height (for vertical) of the line of text.
Vector2 get_non_wrapped_size() const 🔗
Returns the size of the bounding box of the paragraph, without line breaks.
Returns the character range of the paragraph.
Returns TextServer full string buffer RID.
Returns the size of the bounding box of the paragraph.
bool has_object(key: Variant) const 🔗
Returns true if an object with key is embedded in this shaped text buffer.
int hit_test(coords: Vector2) const 🔗
Returns caret character offset at the specified coordinates. This function always returns a valid position.
bool resize_object(key: Variant, size: Vector2, inline_align: InlineAlignment = 5, baseline: float = 0.0) 🔗
Définit la nouvelle taille et alignement de l'objet intégré.
void set_bidi_override(override: Array) 🔗
Redéfinit la BiDi pour le texte structuré.
Les plages de redéfinition devraient couvrir le texte source complet sans chevauchements. L'algorithme BiDi sera utilisé sur chaque plage séparément.
bool set_dropcap(text: String, font: Font, font_size: int, dropcap_margins: Rect2 = Rect2(0, 0, 0, 0), language: String = "") 🔗
Sets drop cap, overrides previously set drop cap. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.
void tab_align(tab_stops: PackedFloat32Array) 🔗
Aligns paragraph to the given tab-stops.