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

[UI] Support for OpenType text layout. #684

Open
wutipong opened this issue Apr 30, 2020 · 1 comment
Open

[UI] Support for OpenType text layout. #684

wutipong opened this issue Apr 30, 2020 · 1 comment
Labels

Comments

@wutipong
Copy link

Is your feature request related to a problem? Please describe.
When using TextBlock to display text written in certain script (in my case, Thai), text is not displayed correctly due to lacking of OpenType layout capability.

For example, this is from Stride 4.0.0.1-beta2-0926
image

And this is from Notepad
image

Font in use is Sarabun.

notice that the tick (Mai-ek, for those who knows Thai) on the top of certain character is missing from a number of positions. This particular character is a mark which would attach to the character before itself. Without mark-to-mark or mark-to-base feature, it would be positioned statically and could be obstructed by surrounding character.

This character also have a smaller variant to be used in some case. This requires Glyph Substitution.

Describe the solution you'd like
To add support for OpenType text shaping. This could be done using either OS's text rendering service like DirectWrite or Core Text, or using opensource library like Harfbuzz.

Describe alternatives you've considered
There are fonts that designed specifically to avoid the limitation of TrueType-like text shaping. The output might not be perfect but at least it is readable.

Of course this would not work on Arabic or Persian scripts.

Additional context
From what I've researched, there are engines that support OpenType layout, and those not.

  • Unreal Engine uses Harfbuzz internally.
  • Godot Engine have a PR for including Harfbuzz. I don't know if this is already merged in or not.
  • Unity3D does not support OpenType shaping. A workaround (using offline Glyph Substitution) is currently in-use by most studio here. I think TextMate Pro also have some kind of workaround in-place (probably offline glyph substitution as well).
@wutipong
Copy link
Author

wutipong commented May 5, 2020

Personally I think ... implementing mark-to-mark and mark-to-base feature should suffice for most scripts (outside of those RTL of course). I will be looking more into the current spritefont implementation in Xenko and how could it be enhanced to support this. Please don't hold your breath though, I can't even got the source built at this point...

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

No branches or pull requests

2 participants