Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextServer] Add extra fallback step, to lookup for individual characters. #88091

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Feb 8, 2024

@bruvzg bruvzg added this to the 4.x milestone Feb 8, 2024
@bruvzg bruvzg marked this pull request as ready for review February 9, 2024 18:04
@bruvzg bruvzg requested a review from a team as a code owner February 9, 2024 18:04
@dhoverml
Copy link

dhoverml commented Feb 9, 2024

I cherry-picked this to master (4e990cd) and I no longer see tofu glyphs when I apply accents to non-Arabic characters.

However, this may be a separate bug, but I see that the cursor switches to the other side of the character when I'm typing the accents, but it fixes itself once I start typing Arabic characters again.

I typed ض (q on my keyboard), #, then added an accent (Q on my keyboard) into a LineEdit node. The cursor remains on the left side until I type the accent mark (with Q), where it then teleports to the right side of the #
cursor_godot

The cursor remains on the left side when I repeat the same steps in my browser's URL bar (I added a few extra accents so you can see them)
cursor_browser

Also, in Godot, the non-Arabic glyph that I'm applying an accent to moves to the far right side of the current list of non-Arabic glyphs.
Alternate between typing #, @, $, and an accent.

Ok: symbol_move_0
Ok: symbol_move_1
Bad: symbol_move_2
Ok: symbol_move_3
Bad: symbol_move_4

Same sequence in a browser produces different results:
browser_symbols

@bruvzg
Copy link
Member Author

bruvzg commented Feb 9, 2024

However, this may be a separate bug, but I see that the cursor switches to the other side of the character when I'm typing the accents, but it fixes itself once I start typing Arabic characters again.

Pushed update to fix the direction, it should work correctly now.

@dhoverml
Copy link

dhoverml commented Feb 9, 2024

Wow that was fast!
I tested the latest patch, and it looks great!

The only problem I see is that it's switching the original glyph's font when it applies the accent:

This 3 is AlbertSans-Regular.ttf
three_albertsansregular

When I apply an accent, the 3 is reshaped with NotoSansArabic-Regular.ttf
three_notosansarabicregular

The workaround is to put the Arabic font first in the list of fallbacks.
Also, I'm not too worried about this since I see some applications (like Github's text-input field) do the same. Though some applications don't (like the Browser URL bar).

Anyway, this is great, thanks!

@akien-mga akien-mga modified the milestones: 4.x, 4.3 Feb 15, 2024
@akien-mga akien-mga merged commit 4bb3af6 into godotengine:master Feb 15, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multiple fonts to render one "glyph unit", like a glyph + diacritics/accents
3 participants