Skip to content

Commit 4724d6d

Browse files
committed
Update BBCode in RichTextLabel documentation for Godot 4.2
- Add `lang` tag. - Add `tab_stops` parameter to `p`. - Add `pulse` built-in effect and remove custom pulse effect as it's superseded.
1 parent c1d8358 commit 4724d6d

File tree

2 files changed

+39
-29
lines changed

2 files changed

+39
-29
lines changed

tutorials/ui/bbcode_in_richtextlabel.rst

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ Reference
289289

290290
* - | **indent**
291291
| Indents ``{text}`` once.
292+
The indentation width is the same as with ``[ul]`` or ``[ol]``, but without a bullet point.
292293
293294
- ``[indent]{text}[/indent]``
294295

@@ -352,6 +353,15 @@ Reference
352353
| ``{text}``
353354
| ``[/opentype_features]``
354355
356+
* - | **lang**
357+
| Overrides the language for ``{text}`` that is set by the **BiDi > Language** property
358+
in :ref:`class_RichTextLabel`. ``{code}`` must be an ISO :ref:`language code <doc_locales>`.
359+
This can be used to enforce the use of a specific script for a language without
360+
starting a new paragraph. Some font files may contain script-specific substitutes,
361+
in which case they will be used.
362+
363+
- ``[lang={code}]{text}[/color]``
364+
355365
* - | **color**
356366
| Changes the color of ``{text}``. Color must be provided by a common name (see
357367
:ref:`doc_bbcode_in_richtextlabel_named_colors`) or using the HEX format (e.g.
@@ -492,8 +502,21 @@ Paragraph options
492502
| `Default` | Inherit |
493503
+-----------+--------------------------------------------+
494504

495-
Locale override.
505+
Locale override. Some font files may contain script-specific substitutes, in which case they will be used.
506+
507+
- **tab_stops**
508+
509+
+-----------+----------------------------------------------------+
510+
| `Values` | List of floating-point numbers, e.g. ``10.0,30.0`` |
511+
+-----------+----------------------------------------------------+
512+
| `Default` | Width of the space character in the font |
513+
+-----------+----------------------------------------------------+
496514

515+
Overrides the horizontal offsets for each tab character. When the end of the
516+
list is reached, the tab stops will loop over. For example, if you set
517+
``tab_stops`` to ``10.0,30.0``, the first tab will be at ``10`` pixels, the
518+
second tab will be at ``10 + 30 = 40`` pixels, and the third tab will be at
519+
``10 + 30 + 10 = 50`` pixels from the origin of the RichTextLabel.
497520

498521
.. _doc_bbcode_in_richtextlabel_handling_url_tag_clicks:
499522

@@ -733,6 +756,21 @@ All examples below mention the default values for options in the listed tag form
733756
enough margin added around the text by using line breaks above and below the
734757
line using the effect.
735758

759+
Pulse
760+
~~~~~
761+
762+
.. image:: img/bbcode_in_richtextlabel_effect_pulse.webp
763+
764+
Pulse creates an animated pulsing effect that multiplies each character's
765+
opacity and color. It can be used to bring attention to specific text. Its tag
766+
format is ``[pulse freq=1.0 color=#ffffff40 ease=-2.0]{text}[/pulse]``.
767+
768+
``freq`` controls the frequency of the half-pulsing cycle (higher is faster). A
769+
full pulsing cycle takes ``2 * (1.0 / freq)`` seconds. ``color`` is the target
770+
color multiplier for blinking. The default mostly fades out text, but not
771+
entirely. ``ease`` is the easing function exponent to use. Negative values
772+
provide in-out easing, which is why the default is ``-2.0``.
773+
736774
Wave
737775
~~~~
738776

@@ -893,34 +931,6 @@ Ghost
893931
char_fx.color.a = alpha
894932
return true
895933

896-
Pulse
897-
~~~~~
898-
899-
::
900-
901-
@tool
902-
extends RichTextEffect
903-
class_name RichTextPulse
904-
905-
# Syntax: [pulse color=#ffffff33 freq=1.0 ease=-2.0 height=0][/pulse]
906-
907-
# Define the tag name.
908-
var bbcode = "pulse"
909-
910-
func _process_custom_fx(char_fx):
911-
# Get parameters, or use the provided default value if missing.
912-
var color = Color(char_fx.env.get("color", Color(1, 1, 1, 0.2)))
913-
var freq = char_fx.env.get("freq", 1.0)
914-
var param_ease = char_fx.env.get("ease", -2.0)
915-
var height = char_fx.env.get("height", 0)
916-
917-
var sined_time = (ease(pingpong(char_fx.elapsed_time, 1.0 / freq) * freq, param_ease))
918-
var y_off = sined_time * height
919-
char_fx.color = char_fx.color.lerp(char_fx.color * color, sined_time)
920-
char_fx.offset = Vector2(0, -1) * y_off
921-
return true
922-
923-
924934
Matrix
925935
~~~~~~
926936

680 Bytes
Loading

0 commit comments

Comments
 (0)