[UI] Support for OpenType text layout.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
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

And this is from Notepad

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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TextBlock text-rendering path and investigate how glyph positioning and substitution currently work. Compare the Thai Sarabun example with the requested OpenType shaping options: DirectWrite, Core Text, or HarfBuzz. Done means marks such as Mai-ek render correctly, including mark-to-base or mark-to-mark positioning and the required glyph variants.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev, internationalization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100