godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Flip mirrored GUI icons when drawing them in RTL mode instead of providing separate mirorred image versions #2813

Open Calinou opened 3 years ago

Calinou commented 3 years ago

Describe the project you are working on

The Godot editor :slightly_smiling_face:

Describe the problem or limitation you are having in your project

Right now, we have mirrored icon designs in editor/icons/ and scene/resources/default_theme/ for the purpose of RTL (right-to-left) typesetting support.

This means we have to duplicate the work when modifying those designs. This is also an issue for people who will design custom themes for Godot 4.0 onwards.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Remove the mirorred icon designs and instruct Godot's GUI code to draw the icons horizontally flipped instead.

This requires the default project theme to not include any text on its icons (namely for CheckButton), but I'm working on a PR to revamp the default project theme already. This change will have to wait until that PR is merged.

The benefit is that we will need fewer icons internally, and custom theme designers will have fewer icons to design.

The downside is that it'll no longer be possible for these icons to feature text without having it flipped, but having text in GUI icons is generally considered to be an antipattern since it can't be translated easily.

This change was approved by @bruvzg on Rocket.Chat, but I'm posting this here as a proposal for future refrence.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This can be handled in the respective nodes that draw mirrored icons (CheckBox, CheckButton, …).

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, as there is no way to instruct Godot's GUI code to draw icons mirrored instead of requiring a mirorred design.

Is there a reason why this should be core and not an add-on in the asset library?

See above.

bruvzg commented 3 years ago

The downside is that it'll no longer be possible for these icons to feature text without having it flipped

If we still want a text on some of the theme icons, it's probably better to draw it as the text on top of the icon, instead of hardcoded part of the icon. 4.0 default font is resizable, and this allow translating it to the current locale.

timothyqiu commented 4 months ago

The downside is that it'll no longer be possible for these icons to feature text without having it flipped, but having text in GUI icons is generally considered to be an antipattern since it can't be translated easily.

It's not uncommon to have text in the icon for translation:

image

There're also cases like "Rotate Clock-wise". It'll be counter clock-wise after flipping.

bruvzg commented 4 months ago

The common practice seem to be mirroring only some specific types of icons (it's only necessary to do it if icon have clear direction or back/forward indication) - see https://m2.material.io/design/usability/bidirectionality.html#mirroring-elements for example.