summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-16 13:47:05 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-16 13:47:05 +0100
commit912fd3f0e15c3363809e0d69fb94207166aa4f37 (patch)
treeb41ce89066c4a1baff37877ac82599d7b8dbed65 /doc/classes
parent49a60b1d1c4d62fec1be89e4878433b6c3220ce0 (diff)
parent207e52c161a44869f1af022030c3129b8c38a5f7 (diff)
Merge pull request #64563 from timothyqiu/word-wrap
Fix `String::word_wrap()` for long words
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/TextServer.xml11
-rw-r--r--doc/classes/TextServerExtension.xml1
2 files changed, 10 insertions, 2 deletions
diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml
index a4bccfb545..637e502d49 100644
--- a/doc/classes/TextServer.xml
+++ b/doc/classes/TextServer.xml
@@ -1548,8 +1548,15 @@
<return type="PackedInt32Array" />
<param index="0" name="string" type="String" />
<param index="1" name="language" type="String" default="&quot;&quot;" />
- <description>
- Returns array of the word break character offsets.
+ <param index="2" name="chars_per_line" type="int" default="0" />
+ <description>
+ Returns an array of the word break boundaries. Elements in the returned array are the offsets of the start and end of words. Therefore the length of the array is always even.
+ When [param chars_per_line] is greater than zero, line break boundaries are returned instead.
+ [codeblock]
+ var ts = TextServerManager.get_primary_interface()
+ print(ts.string_get_word_breaks("Godot Engine")) # Prints [0, 5, 6, 12]
+ print(ts.string_get_word_breaks("Godot Engine", "en", 5)) # Prints [0, 5, 6, 11, 11, 12]
+ [/codeblock]
</description>
</method>
<method name="string_to_lower" qualifiers="const">
diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml
index 44e65efc8c..e144b09eb6 100644
--- a/doc/classes/TextServerExtension.xml
+++ b/doc/classes/TextServerExtension.xml
@@ -1346,6 +1346,7 @@
<return type="PackedInt32Array" />
<param index="0" name="string" type="String" />
<param index="1" name="language" type="String" />
+ <param index="2" name="chars_per_line" type="int" />
<description>
</description>
</method>