godotengine / godotengine/godot

Empty custom RichTextEffect is misplacing some ligature glyphs

Open
#97,126 0 comments 0 reactions 0 assignees View on GitHub
bug topic:gui
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in v4.3.stable.mono.official [77dcf97d8]

### System information

Godot v4.3.stable.mono - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1070 (NVIDIA; 31.0.15.3713) - AMD Ryzen 7 1700 Eight-Core Processor (16 Threads)

### Issue description

When applying custom RichTextEffect with empty_ProcessCustomFX method the rendered text should be exactly the same as the text that isn't wrapped in any bbcode block. Instead even with empty effects some ligature glyphs are misplaced, making the resultuing text look very bad - [effectone] (c#), [effectthree] (gd)

![obraz](https://github.com/user-attachments/assets/ba69daed-6b34-4d18-961d-76217c2062d8)

I looked at the source code of rich_text_label.cpp and this is the line that's messing up the some of the glyph positions.

![obraz](https://github.com/user-attachments/assets/8ce3a7f7-2765-40ee-bf59-8db38804cd9a)

I'm not really sure how it should work but noticed that the vector is not added for some built-in effects, like rainbow (which correctly displays the text).

My workaround is to just set the offset to empty vector in the process function, which seems to fix the issue - [effecttwo] (c#), [effectfour] (gd)

### Steps to reproduce

1. Create scene with RichTextLabel
2. Use a font with ligatures
3. Create custom RichTextEffect without any logic, just returning true from the process function
4. Attach custom RichTextEffect to RichTextLabel and wrap the text in custom bb code
5. Some of the ligature glyphs will be displaced

### Minimal reproduction project (MRP)

[richtexteffect.zip](https://github.com/user-attachments/files/17034291/richtexteffect.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the minimal reproduction project and reproduce the ligature displacement using RichTextLabel, a ligature-enabled font, and an empty custom RichTextEffect. Read the relevant glyph-positioning code in rich_text_label.cpp and compare custom effects with the built-in rainbow effect; done means wrapped text renders with the same ligature positions as unwrapped text.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.