godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.65k stars 20.1k forks source link

RichTextLabel BBCode [/indent] does nothing #71180

Open golddotasksquestions opened 1 year ago

golddotasksquestions commented 1 year ago

Godot version

3.5.1 stable, 4.0 Beta 10

System information

Win 10, Nvidea 765M

Issue description

In both Godot 3.1.5 as well as Godot 4.0 Beta 10 the closing [/indent] tag seems broken, does nothing. The opening tag [indent] will create an indent, but there seems no way to stop it for the rest of the text.

Steps to reproduce

Add a RichTextLabel node, paste this text into the Inspector BBCode textfield and enable BBCode property:

Led ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et [indent]quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, [/indent]qui ratione voluptatem sequi nesciunt, neque porro quisquam est.

Seems to be a different issue than this: https://github.com/godotengine/godot/issues/67026

Minimal reproduction project

N/A

bruvzg commented 1 year ago

Indent change is applied to new paragraph, opening [indent] tag starts a new paragraph, but closing do not.

So:

text1 [indent] text2 [/indent] text3
text4

Turns into:

text1
     text2 text3
text4

Not sure if it should be considered a bug, indent in the middle of the text doesn't make any sense.

golddotasksquestions commented 1 year ago

@bruvzg

Thanks for looking into this issue and commenting! If this is intentional, let me tell you this current implementation is at least as confusing as a bug.

The current implementation of [indent] also does not produce a paragraph as it is considered a paragraph in typography or modern word processing.

Such a paragraph would be enclosed by a paragraph break, which is a newline at the beginning and end plus adjustable indent of (usually) the first line of the paragraph, or a newline plus a paragraph line gap (adjustable, often than the than an additional line height) at the beginning and end of the paragraph, or all three: newline plus indent plus gap.

Some examples: image

So far I have assumed [p][/p] was supposed to be the tag for paragraph break. However after testing it now, it also turns out not to produce a paragraph either. It just seems to produce a newline at the beginning and end of the paragraph.

My expected behavior of the [indent] tag, would be what it the name suggest: indent anything in between the tags. (I wish I could control how strong of an indentation this is).

Whether or not the indentation should also enforce a linebreak as well (start exactly where the [indent] tag is set), or start indentation at the beginning of the line where the [indent] tag is set, could be up for debate, but personally I would prefer the latter ... since we already have a tag for paragraphs which is [p].

However what the [/indent] definitely should do is to end the indentation. Again, personally I think it should not add a linebreak as well since this is what the paragraph is for [p][/p]. Instead I would expect it to end the indentation with the wrapped next line. Done.

image

bruvzg commented 1 year ago

The current implementation of [indent] also does not produce a paragraph as it is considered a paragraph in typography or modern word processing.

It does, RTL use any line break as a paragraph separator, and some tags (p, left, right, center, fill, indent, ul and ol) are adding line break when opened. In this case, paragraph is a "minimal part of text, which can be processed completely independently of the rest of text", it does not imply any style or formatting only a logical division of a text.

So far I have assumed [p][/p] was supposed to be the tag for paragraph break.

p is there to allow setting some of the extra paragraph properties (BiDi base direction and overrides, language code for OpenType features and alignment), it's not intended to be used without options (as [p][/p]).

However what the [/indent] definitely should do is to end the indentation.

I guess it would make sense to apply indent to the lines after line breaking, but what should happen if tags are not on the line boundaries? I'm not sure if I see any consistent way to apply it:

For example (assuming single paragraph, with automatic line break caused by control width):

Magnis dis parturient montes, nascetur ridiculus mus.
Lorem ipsum dolor sit amet. [indent]Aenean commodo ligula eget
dolor.[/indent] Aenean massa. Cum sociis natoque mus.

Should look like this:

Magnis dis parturient montes, nascetur ridiculus mus.
    Lorem ipsum dolor sit amet. Aenean commodo ligula eget
    dolor. Aenean massa. Cum sociis natoque mus.

Or this:

Magnis dis parturient montes, nascetur ridiculus mus.
Lorem ipsum dolor sit amet.
    Aenean commodo ligula eget dolor.
Aenean massa. Cum sociis natoque mus.

Or this?

Magnis dis parturient montes, nascetur ridiculus mus.
Lorem ipsum dolor sit amet. Aenean commodo ligula eget
dolor. Aenean massa. Cum sociis natoque mus.
golddotasksquestions commented 1 year ago
The current implementation of [indent] also does not produce a paragraph as it is considered a paragraph in typography or modern word processing.

It does,

I meant this from the perspective of a graphic designer and was speaking about the typographic result.

In this case, paragraph is a "minimal part of text, which can be processed completely independently of the rest of text", it does not imply any style or formatting only a logical division of a text.

Paragraphs are suppose to have a different formatting. That's their whole purpose. They are suppose to visually indicate the beginning of a new idea or thought or subject. To communicate this beginning of something new, designers need to use a visual indicator.

As I have tried to show in my above example of the few most common paragraph styles, these indicators are typically: (first line) indent, gap, and of course the newline at beginning and end of the paragraph.

This issue here is about the [/indent] tag, so I did not want to go too much into the [p][/p] tags, but in their current implementation, from a visual design, graphic design and typography point of view, I don't think the [p][/p] tags are doing their job very well, since they are missing the parameters (indent, gap. newline works) to adjust what actually makes a paragraph relevant and useful for a designer.

The [indent][/indent] tag, would fulfill a different purpose, I thought. Not related to paragraphs at all, but rather as separate design tool to push lines where necessary.

Currently I'm once again trying find a way to substitute the functionality of the fantastic [dropcap][/dropcap] tag you added to the RTL in Godot 4.0 in 3.5.1. One idea I had was to try to use [indent][/indent] to push (or rather indent) the first few lines of a RTL. Testing this revealed how I was not able to stop the indent and more once I opened it with the starting tag.

image Yes! Without a doubt (in my opinion).

If the user whats to indent a single line, they can do it like this:

Magnis dis parturient montes, nascetur ridiculus mus.
Lorem ipsum dolor sit amet. [indent]Aenean[/indent] commodo ligula eget
dolor. Aenean massa. Cum sociis natoque mus.

Should look like this:

Magnis dis parturient montes, nascetur ridiculus mus.
    Lorem ipsum dolor sit amet. Aenean commodo ligula eget
dolor. Aenean massa. Cum sociis natoque mus.
dalexeev commented 7 months ago