:github_url: hide .. _class_Font: Font ==== **Eredita:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` **Ereditato da:** :ref:`FontFile`, :ref:`FontVariation`, :ref:`SystemFont` Classe di base astratta per font e variazioni di font. .. rst-class:: classref-introduction-group Descrizione ---------------------- Classe di base astratta per diversi tipi di font. Ha metodi per disegnare testo e introspezione dei caratteri dei font. .. rst-class:: classref-reftable-group Proprietà ------------------ .. table:: :widths: auto +------------------------------------------------------+-------------------------------------------------+--------+ | :ref:`Array`\[:ref:`Font`\] | :ref:`fallbacks` | ``[]`` | +------------------------------------------------------+-------------------------------------------------+--------+ .. rst-class:: classref-reftable-group Metodi ------------ .. table:: :widths: auto +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`draw_char`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`draw_char_outline`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, size\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_multiline_string`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_multiline_string_outline`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_string`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`draw_string_outline`\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`find_variation`\ (\ variation_coordinates\: :ref:`Dictionary`, face_index\: :ref:`int` = 0, strength\: :ref:`float` = 0.0, transform\: :ref:`Transform2D` = Transform2D(1, 0, 0, 1, 0, 0), spacing_top\: :ref:`int` = 0, spacing_bottom\: :ref:`int` = 0, spacing_space\: :ref:`int` = 0, spacing_glyph\: :ref:`int` = 0, baseline_offset\: :ref:`float` = 0.0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_ascent`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_char_size`\ (\ char\: :ref:`int`, font_size\: :ref:`int`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_descent`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_face_count`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_font_name`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_font_stretch`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |bitfield|\[:ref:`FontStyle`\] | :ref:`get_font_style`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_font_style_name`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_font_weight`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_height`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_multiline_string_size`\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_opentype_features`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_ot_name_strings`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array`\[:ref:`RID`\] | :ref:`get_rids`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_spacing`\ (\ spacing\: :ref:`SpacingType`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_string_size`\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_supported_chars`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_supported_feature_list`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`get_supported_variation_list`\ (\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_underline_position`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_underline_thickness`\ (\ font_size\: :ref:`int` = 16\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_char`\ (\ char\: :ref:`int`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_language_supported`\ (\ language\: :ref:`String`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_script_supported`\ (\ script\: :ref:`String`\ ) |const| | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_cache_capacity`\ (\ single_line\: :ref:`int`, multi_line\: :ref:`int`\ ) | +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Descrizioni delle proprietà ------------------------------------------------------ .. _class_Font_property_fallbacks: .. rst-class:: classref-property :ref:`Array`\[:ref:`Font`\] **fallbacks** = ``[]`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_fallbacks**\ (\ value\: :ref:`Array`\[:ref:`Font`\]\ ) - :ref:`Array`\[:ref:`Font`\] **get_fallbacks**\ (\ ) Array di **Font** di riserva da usare come sostituti se un glifo non viene trovato in questo **Font** attuale. Se questo array è vuoto in un :ref:`FontVariation`, vengono invece usati i font di riserva del :ref:`FontVariation.base_font`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Descrizioni dei metodi -------------------------------------------- .. _class_Font_method_draw_char: .. rst-class:: classref-method :ref:`float` **draw_char**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Disegna un singolo carattere Unicode ``char`` in un elemento canvas usando il font, in una posizione specificata, con il colore ``modulate``. ``pos`` specifica la linea di base, non la parte superiore. Per disegnare dalla parte superiore, un'*ascesa* deve essere aggiunta all'asse Y. Se ``oversampling`` è maggiore di zero, è utilizzato come fattore di sovracampionamento del font, altrimenti sono utilizzate le impostazioni di sovracampionamento della viewport. \ **Nota:** Non usare questa funzione per disegnare stringhe carattere per carattere, usa invece :ref:`draw_string()` o :ref:`TextLine`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_char_outline: .. rst-class:: classref-method :ref:`float` **draw_char_outline**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, char\: :ref:`int`, font_size\: :ref:`int`, size\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Disegna un singolo contorno di carattere Unicode ``char`` in un elemento canvas usando il font, in una posizione specificata, con il colore ``modulate``. ``pos`` specifica la linea di base, non la parte superiore. Per disegnare dalla parte superiore, un'*ascesa* deve essere aggiunta all'asse Y. Se ``oversampling`` è maggiore di zero, è utilizzato come fattore di sovracampionamento del font, altrimenti sono utilizzate le impostazioni di sovracampionamento della viewport. \ **Nota:** Non usare questa funzione per disegnare stringhe carattere per carattere, usa invece :ref:`draw_string()` o :ref:`TextLine`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_multiline_string: .. rst-class:: classref-method |void| **draw_multiline_string**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Suddivide ``text`` in righe usando le regole specificate da ``brk_flags`` e lo disegna in un elemento canvas usando il font, in una posizione specificata, con il colore ``modulate``, ritagliando facoltativamente la larghezza e allineandolo orizzontalmente. ``pos`` specifica la linea di base, non la parte superiore. Per disegnare a partire da sopra, *ascent* deve essere aggiunto all'asse Y. Se ``oversampling`` è maggiore di zero, è utilizzato come fattore di sovracampionamento del font, altrimenti sono utilizzate le impostazioni di sovracampionamento della viewport. Vedi anche :ref:`CanvasItem.draw_multiline_string()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_multiline_string_outline: .. rst-class:: classref-method |void| **draw_multiline_string_outline**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Suddivide ``text`` in righe usando le regole specificate da ``brk_flags`` e lo disegna come contorno in un elemento canvas usando il font, in una posizione specificata, con il colore ``modulate``, ritagliando facoltativamente la larghezza e allineandolo orizzontalmente. ``pos`` specifica la linea di base, non la parte superiore. Per disegnare a partire da sopra, *ascent* deve essere aggiunto all'asse Y. Se ``oversampling`` è maggiore di zero, è utilizzato come fattore di sovracampionamento del font, altrimenti sono utilizzate le impostazioni di sovracampionamento della viewport. Vedi anche :ref:`CanvasItem.draw_multiline_string_outline()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_string: .. rst-class:: classref-method |void| **draw_string**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Disegna ``text`` in un elemento canvas usando il font, in una posizione specificata, con il colore ``modulate``, ritagliando facoltativamente la larghezza e allineandolo orizzontalmente. ``pos`` specifica la linea di base, non la parte superiore. Per disegnare a partire da sopra, *ascent* deve essere aggiunto all'asse Y. Se ``oversampling`` è maggiore di zero, è utilizzato come fattore di sovracampionamento del font, altrimenti sono utilizzate le impostazioni di sovracampionamento della viewport. Vedi anche :ref:`CanvasItem.draw_string()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_draw_string_outline: .. rst-class:: classref-method |void| **draw_string_outline**\ (\ canvas_item\: :ref:`RID`, pos\: :ref:`Vector2`, text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, size\: :ref:`int` = 1, modulate\: :ref:`Color` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0, oversampling\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Disegna il contorno di ``text`` in un elemento canvas usando il font, in una posizione specificata, con il colore ``modulate``, ritagliando facoltativamente la larghezza e allineandolo orizzontalmente. ``pos`` specifica la linea di base, non la parte superiore. Per disegnare a partire da sopra, *ascent* deve essere aggiunto all'asse Y. Se ``oversampling`` è maggiore di zero, è utilizzato come fattore di sovracampionamento del font, altrimenti sono utilizzate le impostazioni di sovracampionamento della viewport. Vedi anche :ref:`CanvasItem.draw_string_outline()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_find_variation: .. rst-class:: classref-method :ref:`RID` **find_variation**\ (\ variation_coordinates\: :ref:`Dictionary`, face_index\: :ref:`int` = 0, strength\: :ref:`float` = 0.0, transform\: :ref:`Transform2D` = Transform2D(1, 0, 0, 1, 0, 0), spacing_top\: :ref:`int` = 0, spacing_bottom\: :ref:`int` = 0, spacing_space\: :ref:`int` = 0, spacing_glyph\: :ref:`int` = 0, baseline_offset\: :ref:`float` = 0.0\ ) |const| :ref:`🔗` Restituisce il RID di :ref:`TextServer` della cache del font per una variazione specifica. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_ascent: .. rst-class:: classref-method :ref:`float` **get_ascent**\ (\ font_size\: :ref:`int` = 16\ ) |const| :ref:`🔗` Restituisce l'ascesa media del font (numero di pixel sopra la linea di base). \ **Nota:** L'ascesa reale della stringa dipende dal contesto e può essere significativamente diversa dal valore restituito da questa funzione. Utilizzala solo come stima approssimativa (ad esempio come ascesa di una riga vuota). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_char_size: .. rst-class:: classref-method :ref:`Vector2` **get_char_size**\ (\ char\: :ref:`int`, font_size\: :ref:`int`\ ) |const| :ref:`🔗` Restituisce le dimensioni di un carattere. Non tiene conto del kerning. \ **Nota:** Non usare questa funzione per calcolare la larghezza della stringa carattere per carattere, usa invece :ref:`get_string_size()` o :ref:`TextLine`. L'altezza restituita è l'altezza del font (vedi anche :ref:`get_height()`) e non ha alcuna relazione con l'altezza del glifo. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_descent: .. rst-class:: classref-method :ref:`float` **get_descent**\ (\ font_size\: :ref:`int` = 16\ ) |const| :ref:`🔗` Restituisce la discesa media del font (numero di pixel sotto la linea di base). \ **Nota:** La discesa reale della stringa dipende dal contesto e può essere significativamente diversa dal valore restituito da questa funzione. Utilizzala solo come stima approssimativa (ad esempio come discesa di una riga vuota). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_face_count: .. rst-class:: classref-method :ref:`int` **get_face_count**\ (\ ) |const| :ref:`🔗` Restituisce il numero di facce nella collezione TrueType / OpenType. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_name: .. rst-class:: classref-method :ref:`String` **get_font_name**\ (\ ) |const| :ref:`🔗` Restituisce il nome della famiglia del font. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_stretch: .. rst-class:: classref-method :ref:`int` **get_font_stretch**\ (\ ) |const| :ref:`🔗` Restituisce la quantità di allungamento del font, rispetto a una larghezza normale. Un valore percentuale compreso tra ``50%`` e ``200%``. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_style: .. rst-class:: classref-method |bitfield|\[:ref:`FontStyle`\] **get_font_style**\ (\ ) |const| :ref:`🔗` Restituisce i flag di stile del font. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_style_name: .. rst-class:: classref-method :ref:`String` **get_font_style_name**\ (\ ) |const| :ref:`🔗` Restituisce il nome dello stile del font. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_font_weight: .. rst-class:: classref-method :ref:`int` **get_font_weight**\ (\ ) |const| :ref:`🔗` Restituisce il peso (grassetto) del font. Un valore nell'intervallo ``100...999``, il peso normale di un font è ``400``, il peso di un font in grassetto è ``700``. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_height: .. rst-class:: classref-method :ref:`float` **get_height**\ (\ font_size\: :ref:`int` = 16\ ) |const| :ref:`🔗` Restituisce l'altezza media totale (ascesa più discesa) del font, in pixel. \ **Nota:** L'altezza reale della stringa dipende dal contesto e può essere significativamente diversa dal valore restituito da questa funzione. Utilizzarla solo come stima approssimativa (ad esempio come altezza di una riga vuota). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_multiline_string_size: .. rst-class:: classref-method :ref:`Vector2` **get_multiline_string_size**\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, max_lines\: :ref:`int` = -1, brk_flags\: |bitfield|\[:ref:`LineBreakFlag`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| :ref:`🔗` Restituisce le dimensioni di un riquadro di una stringa suddivisa in righe, tenendo conto della crenatura e dell'avanzamento. Vedi anche :ref:`draw_multiline_string()`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_opentype_features: .. rst-class:: classref-method :ref:`Dictionary` **get_opentype_features**\ (\ ) |const| :ref:`🔗` Restituisce un insieme di tag di funzionalità OpenType. Ulteriori informazioni: `tag di funzionalità OpenType `__. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_ot_name_strings: .. rst-class:: classref-method :ref:`Dictionary` **get_ot_name_strings**\ (\ ) |const| :ref:`🔗` Restituisce un :ref:`Dictionary` con le stringhe di nomi di font OpenType (nomi di font localizzati, versione, descrizione, informazioni sulla licenza, testo di esempio, ecc.). .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_rids: .. rst-class:: classref-method :ref:`Array`\[:ref:`RID`\] **get_rids**\ (\ ) |const| :ref:`🔗` Restituisce un :ref:`Array` di :ref:`RID` di **Font** validi, che possono essere passati ai metodi nel :ref:`TextServer`. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_spacing: .. rst-class:: classref-method :ref:`int` **get_spacing**\ (\ spacing\: :ref:`SpacingType`\ ) |const| :ref:`🔗` Restituisce la quantità di spaziatura per il tipo di spaziatura ``spacing``. .. rst-class:: classref-item-separator ---- .. _class_Font_method_get_string_size: .. rst-class:: classref-method :ref:`Vector2` **get_string_size**\ (\ text\: :ref:`String`, alignment\: :ref:`HorizontalAlignment` = 0, width\: :ref:`float` = -1, font_size\: :ref:`int` = 16, justification_flags\: |bitfield|\[:ref:`JustificationFlag`\] = 3, direction\: :ref:`Direction` = 0, orientation\: :ref:`Orientation` = 0\ ) |const| :ref:`🔗` Restituisce le dimensioni di un riquadro di una stringa a riga singola, tenendo conto di crenatura, avanzamento e posizionamento subpixel. Vedi anche :ref:`get_multiline_string_size()` e :ref:`draw_string()`. Ad esempio, per ottenere la dimensione della stringa visualizzata da un Label a riga singola, utilizzare: .. tabs:: .. code-tab:: gdscript var string_size = $Label.get_theme_font("font").get_string_size($Label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, $Label.get_theme_font_size("font_size")) .. code-tab:: csharp Label label = GetNode