From 4724d6d7375eec156dcd73cd605d8dba41bd33bf Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 25 Oct 2023 07:13:37 +0200 Subject: [PATCH] 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. --- tutorials/ui/bbcode_in_richtextlabel.rst | 68 ++++++++++-------- .../bbcode_in_richtextlabel_effect_pulse.webp | Bin 0 -> 680 bytes 2 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 tutorials/ui/img/bbcode_in_richtextlabel_effect_pulse.webp diff --git a/tutorials/ui/bbcode_in_richtextlabel.rst b/tutorials/ui/bbcode_in_richtextlabel.rst index ce2cc7c8885..b0b468db37a 100644 --- a/tutorials/ui/bbcode_in_richtextlabel.rst +++ b/tutorials/ui/bbcode_in_richtextlabel.rst @@ -289,6 +289,7 @@ Reference * - | **indent** | Indents ``{text}`` once. + The indentation width is the same as with ``[ul]`` or ``[ol]``, but without a bullet point. - ``[indent]{text}[/indent]`` @@ -352,6 +353,15 @@ Reference | ``{text}`` | ``[/opentype_features]`` + * - | **lang** + | Overrides the language for ``{text}`` that is set by the **BiDi > Language** property + in :ref:`class_RichTextLabel`. ``{code}`` must be an ISO :ref:`language code `. + This can be used to enforce the use of a specific script for a language without + starting a new paragraph. Some font files may contain script-specific substitutes, + in which case they will be used. + + - ``[lang={code}]{text}[/color]`` + * - | **color** | Changes the color of ``{text}``. Color must be provided by a common name (see :ref:`doc_bbcode_in_richtextlabel_named_colors`) or using the HEX format (e.g. @@ -492,8 +502,21 @@ Paragraph options | `Default` | Inherit | +-----------+--------------------------------------------+ - Locale override. + Locale override. Some font files may contain script-specific substitutes, in which case they will be used. + +- **tab_stops** + + +-----------+----------------------------------------------------+ + | `Values` | List of floating-point numbers, e.g. ``10.0,30.0`` | + +-----------+----------------------------------------------------+ + | `Default` | Width of the space character in the font | + +-----------+----------------------------------------------------+ + Overrides the horizontal offsets for each tab character. When the end of the + list is reached, the tab stops will loop over. For example, if you set + ``tab_stops`` to ``10.0,30.0``, the first tab will be at ``10`` pixels, the + second tab will be at ``10 + 30 = 40`` pixels, and the third tab will be at + ``10 + 30 + 10 = 50`` pixels from the origin of the RichTextLabel. .. _doc_bbcode_in_richtextlabel_handling_url_tag_clicks: @@ -733,6 +756,21 @@ All examples below mention the default values for options in the listed tag form enough margin added around the text by using line breaks above and below the line using the effect. +Pulse +~~~~~ + +.. image:: img/bbcode_in_richtextlabel_effect_pulse.webp + +Pulse creates an animated pulsing effect that multiplies each character's +opacity and color. It can be used to bring attention to specific text. Its tag +format is ``[pulse freq=1.0 color=#ffffff40 ease=-2.0]{text}[/pulse]``. + +``freq`` controls the frequency of the half-pulsing cycle (higher is faster). A +full pulsing cycle takes ``2 * (1.0 / freq)`` seconds. ``color`` is the target +color multiplier for blinking. The default mostly fades out text, but not +entirely. ``ease`` is the easing function exponent to use. Negative values +provide in-out easing, which is why the default is ``-2.0``. + Wave ~~~~ @@ -893,34 +931,6 @@ Ghost char_fx.color.a = alpha return true -Pulse -~~~~~ - -:: - - @tool - extends RichTextEffect - class_name RichTextPulse - - # Syntax: [pulse color=#ffffff33 freq=1.0 ease=-2.0 height=0][/pulse] - - # Define the tag name. - var bbcode = "pulse" - - func _process_custom_fx(char_fx): - # Get parameters, or use the provided default value if missing. - var color = Color(char_fx.env.get("color", Color(1, 1, 1, 0.2))) - var freq = char_fx.env.get("freq", 1.0) - var param_ease = char_fx.env.get("ease", -2.0) - var height = char_fx.env.get("height", 0) - - var sined_time = (ease(pingpong(char_fx.elapsed_time, 1.0 / freq) * freq, param_ease)) - var y_off = sined_time * height - char_fx.color = char_fx.color.lerp(char_fx.color * color, sined_time) - char_fx.offset = Vector2(0, -1) * y_off - return true - - Matrix ~~~~~~ diff --git a/tutorials/ui/img/bbcode_in_richtextlabel_effect_pulse.webp b/tutorials/ui/img/bbcode_in_richtextlabel_effect_pulse.webp new file mode 100644 index 0000000000000000000000000000000000000000..5308c6ed30171029464dbf19f0c2762b5e9b105a GIT binary patch literal 680 zcmV;Z0$2S~Nk&GX0ssJ4MM6+kP&iDJ0ssIn;=mCAg+$x7)u#HwofHUFw1T_4wZ*0G z7VZAdlAFs*cy1B>XXHkb6O%L4ktg7LIQ(DPF-fbsDe=t2hZV@7{+g691|OCrX}3;8 z-uAiUcYsf#n0;}0;Gg?^na-SVTG>aPFH&C|;B(ppk{tLa3LNplH@Cnc{+D;63;FO2S zLk?7_eeMAOHkb#d_~3VdV31@pBDY2TBs|h#Ow*Fgd0a;FQIS$Rd|Moeu%T(%A=f=F zBaJkqrW_|Xxr-GQf|LkrEjrhLLD%piddQw80l|s5d-B#{YZfzf z4+nyF?s|IyqN2Eawm=pp@J!cW`W+y+Q}C`mvgQF;Y;zl(;X-CKOndHzOKv190w%A9 z{r6eseTaDMb`PgqA8Cnz={MdZ&x6cpNckNgP|)ph;8CQy`duT(RRDn06stg}Cr|*O z%yG0W_j^h0@&cHqKn0)<>saSaAOV7P$Hrw*7rnfm9o4vusP5dK-c-|4N|&$KEnP6z zy*a#g>cH|)zd6l!6sg3}$!85+a9F)OeBw2f3JYhKZ^wQI2$ps~uwLVaV7F#QA+zA;J^Pr OH~%30x%uCJQUCxQiBP%# literal 0 HcmV?d00001