summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-22 23:06:25 +0200
committerGitHub <noreply@github.com>2022-07-22 23:06:25 +0200
commit4926d67261edf7bc423a8968a03cefc06f842e19 (patch)
tree497ef9c16f6959f9a7581852a36e535b19877595
parente2e8a83ddb63e751f662f8137ebb47f7a6f912dc (diff)
parentf0b896e9a3f8e39b23c1fdad80344d2466e7c1f6 (diff)
Merge pull request #63331 from Calinou/doc-font-get-string-size-example
-rw-r--r--doc/classes/Font.xml7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml
index e95f444d55..6377c829e1 100644
--- a/doc/classes/Font.xml
+++ b/doc/classes/Font.xml
@@ -226,9 +226,12 @@
<argument index="5" name="direction" type="int" enum="TextServer.Direction" default="0" />
<argument index="6" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<description>
- Returns the size of a bounding box of a string, taking kerning and advance into account.
+ Returns the size of a bounding box of a single-line string, taking kerning and advance into account. See also [method get_multiline_string_size] and [method draw_string].
+ For example, to get the string size as displayed by a single-line Label, use:
+ [codeblock]
+ var string_size = $Label.get_theme_font("font").get_string_size($Label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, $Label.get_theme_font_size("font_size"))
+ [/codeblock]
[b]Note:[/b] Real height of the string is context-dependent and can be significantly different from the value returned by [method get_height].
- See also [method draw_string].
</description>
</method>
<method name="get_supported_chars" qualifiers="const">