mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
321 lines
14 KiB
ReStructuredText
321 lines
14 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_FontVariation:
|
|
|
|
FontVariation
|
|
=============
|
|
|
|
**Eredita:** :ref:`Font<class_Font>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Una variazione di un font con impostazioni aggiuntive.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Descrizione
|
|
----------------------
|
|
|
|
Fornisce variazioni OpenType, grassetto/inclinazione simulati e impostazioni aggiuntive per i font come funzionalità OpenType e spaziatura aggiuntiva.
|
|
|
|
Per utilizzare la variazione di font in grassetto simulato:
|
|
|
|
|
|
.. tabs::
|
|
|
|
.. code-tab:: gdscript
|
|
|
|
var fv = FontVariation.new()
|
|
fv.base_font = load("res://BarlowCondensed-Regular.ttf")
|
|
fv.variation_embolden = 1.2
|
|
$Label.add_theme_font_override("font", fv)
|
|
$Label.add_theme_font_size_override("font_size", 64)
|
|
|
|
.. code-tab:: csharp
|
|
|
|
var fv = new FontVariation();
|
|
fv.SetBaseFont(ResourceLoader.Load<FontFile>("res://BarlowCondensed-Regular.ttf"));
|
|
fv.SetVariationEmbolden(1.2);
|
|
GetNode("Label").AddThemeFontOverride("font", fv);
|
|
GetNode("Label").AddThemeFontSizeOverride("font_size", 64);
|
|
|
|
|
|
|
|
To set the coordinate of multiple variation axes:
|
|
|
|
::
|
|
|
|
var fv = FontVariation.new();
|
|
var ts = TextServerManager.get_primary_interface()
|
|
fv.base_font = load("res://BarlowCondensed-Regular.ttf")
|
|
fv.variation_opentype = { ts.name_to_tag("wght"): 900, ts.name_to_tag("custom_hght"): 900 }
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Proprietà
|
|
------------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`Font<class_Font>` | :ref:`base_font<class_FontVariation_property_base_font>` | |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`baseline_offset<class_FontVariation_property_baseline_offset>` | ``0.0`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`Dictionary<class_Dictionary>` | :ref:`opentype_features<class_FontVariation_property_opentype_features>` | ``{}`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`spacing_bottom<class_FontVariation_property_spacing_bottom>` | ``0`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`spacing_glyph<class_FontVariation_property_spacing_glyph>` | ``0`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`spacing_space<class_FontVariation_property_spacing_space>` | ``0`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`spacing_top<class_FontVariation_property_spacing_top>` | ``0`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`variation_embolden<class_FontVariation_property_variation_embolden>` | ``0.0`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`variation_face_index<class_FontVariation_property_variation_face_index>` | ``0`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`Dictionary<class_Dictionary>` | :ref:`variation_opentype<class_FontVariation_property_variation_opentype>` | ``{}`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
| :ref:`Transform2D<class_Transform2D>` | :ref:`variation_transform<class_FontVariation_property_variation_transform>` | ``Transform2D(1, 0, 0, 1, 0, 0)`` |
|
|
+---------------------------------------+--------------------------------------------------------------------------------+-----------------------------------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Metodi
|
|
------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_spacing<class_FontVariation_method_set_spacing>`\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ ) |
|
|
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni delle proprietà
|
|
------------------------------------------------------
|
|
|
|
.. _class_FontVariation_property_base_font:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Font<class_Font>` **base_font** :ref:`🔗<class_FontVariation_property_base_font>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_base_font**\ (\ value\: :ref:`Font<class_Font>`\ )
|
|
- :ref:`Font<class_Font>` **get_base_font**\ (\ )
|
|
|
|
Font di base utilizzato per creare una variazione. Se non impostato, viene utilizzato il font predefinito del :ref:`Theme<class_Theme>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_baseline_offset:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **baseline_offset** = ``0.0`` :ref:`🔗<class_FontVariation_property_baseline_offset>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_baseline_offset**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_baseline_offset**\ (\ )
|
|
|
|
Lo scostamento aggiuntivo dalla linea di base (come frazione dell'altezza del font).
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_opentype_features:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Dictionary<class_Dictionary>` **opentype_features** = ``{}`` :ref:`🔗<class_FontVariation_property_opentype_features>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_opentype_features**\ (\ value\: :ref:`Dictionary<class_Dictionary>`\ )
|
|
- :ref:`Dictionary<class_Dictionary>` **get_opentype_features**\ (\ )
|
|
|
|
Un insieme di tag di funzionalità OpenType. Ulteriori informazioni: `Tag di funzionalità OpenType <https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags>`__.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_spacing_bottom:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **spacing_bottom** = ``0`` :ref:`🔗<class_FontVariation_property_spacing_bottom>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_spacing**\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_spacing**\ (\ )
|
|
|
|
Spaziatura addizionale in fondo alla riga in pixel.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_spacing_glyph:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **spacing_glyph** = ``0`` :ref:`🔗<class_FontVariation_property_spacing_glyph>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_spacing**\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_spacing**\ (\ )
|
|
|
|
Spaziatura addizionale tra i glifi grafici.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_spacing_space:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **spacing_space** = ``0`` :ref:`🔗<class_FontVariation_property_spacing_space>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_spacing**\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_spacing**\ (\ )
|
|
|
|
Larghezza addizionale dei glifi di spazi.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_spacing_top:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **spacing_top** = ``0`` :ref:`🔗<class_FontVariation_property_spacing_top>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_spacing**\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_spacing**\ (\ )
|
|
|
|
Spaziatura addizionale in cima alla riga in pixel.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_variation_embolden:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **variation_embolden** = ``0.0`` :ref:`🔗<class_FontVariation_property_variation_embolden>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_variation_embolden**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_variation_embolden**\ (\ )
|
|
|
|
Se non è uguale a zero, applica grassetto ai contorni del font. I valori negativi riducono lo spessore del contorno.
|
|
|
|
\ **Nota:** I font in grassetto potrebbero avere contorni che si intersecano tra loro, il che impedirà ai font MSDF e :ref:`TextMesh<class_TextMesh>` di funzionare correttamente.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_variation_face_index:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **variation_face_index** = ``0`` :ref:`🔗<class_FontVariation_property_variation_face_index>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_variation_face_index**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_variation_face_index**\ (\ )
|
|
|
|
Indice della faccia attiva nel file di collezione TrueType/OpenType.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_variation_opentype:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Dictionary<class_Dictionary>` **variation_opentype** = ``{}`` :ref:`🔗<class_FontVariation_property_variation_opentype>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_variation_opentype**\ (\ value\: :ref:`Dictionary<class_Dictionary>`\ )
|
|
- :ref:`Dictionary<class_Dictionary>` **get_variation_opentype**\ (\ )
|
|
|
|
Coordinate di variazione OpenType del font. Ulteriori informazioni: `Tag di variazione OpenType <https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg>`__.
|
|
|
|
\ **Nota:** Questo :ref:`Dictionary<class_Dictionary>` utilizza i tag OpenType come chiavi. Gli assi di variazione possono essere identificati sia dai tag (:ref:`int<class_int>`, ad esempio ``0x77678674``) sia dai nomi (:ref:`String<class_String>`, ad esempio ``wght``). Alcuni assi potrebbero essere accessibili tramite molteplici nomi. Ad esempio, ``wght`` si riferisce allo stesso asse di ``weight``. I tag, d'altre parte, sono univoci. Per convertire tra nomi e tag, usa :ref:`TextServer.name_to_tag()<class_TextServer_method_name_to_tag>` e :ref:`TextServer.tag_to_name()<class_TextServer_method_tag_to_name>`.
|
|
|
|
\ **Nota:** Per ottenere gli assi di variazione disponibili in un font, usa :ref:`Font.get_supported_variation_list()<class_Font_method_get_supported_variation_list>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_FontVariation_property_variation_transform:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Transform2D<class_Transform2D>` **variation_transform** = ``Transform2D(1, 0, 0, 1, 0, 0)`` :ref:`🔗<class_FontVariation_property_variation_transform>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_variation_transform**\ (\ value\: :ref:`Transform2D<class_Transform2D>`\ )
|
|
- :ref:`Transform2D<class_Transform2D>` **get_variation_transform**\ (\ )
|
|
|
|
La trasformazione 2D, applicata ai contorni del font, che può essere utilizzata per inclinare, capovolgere e ruotare i glifi.
|
|
|
|
Ad esempio, per simulare un font in corsivo inclinandolo, applica la seguente trasformazione ``Transform2D(1.0, inclinazione, 0.0, 1.0, 0.0, 0.0)``.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni dei metodi
|
|
--------------------------------------------
|
|
|
|
.. _class_FontVariation_method_set_spacing:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_spacing**\ (\ spacing\: :ref:`SpacingType<enum_TextServer_SpacingType>`, value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_FontVariation_method_set_spacing>`
|
|
|
|
Imposta la spaziatura per ``spacing`` su ``value`` in pixel (non relativa alla dimensione del font).
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)`
|
|
.. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)`
|
|
.. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)`
|
|
.. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)`
|
|
.. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)`
|
|
.. |void| replace:: :abbr:`void (Nessun valore restituito.)`
|