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

Support text-shaping #418

Open
InterGalacticCold opened this issue Mar 28, 2025 · 6 comments
Open

Support text-shaping #418

InterGalacticCold opened this issue Mar 28, 2025 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@InterGalacticCold
Copy link

InterGalacticCold commented Mar 28, 2025

I have some text written in Bengali in this upcoming.md file. In the screenshot that markdown file is opened with Ecode and Notepads. Both have utf-8 selected as their encoder, but Ecode fails to render the text. Please fix it and let me know if there's more information you need.
Thanks a lot for making such a great application.

Image

@SpartanJ SpartanJ self-assigned this Mar 28, 2025
@SpartanJ
Copy link
Owner

SpartanJ commented Mar 28, 2025

Hi!
I just realized there was an actual bug for setting fonts fallback.
Although, this is a font issue, basically in order to be able to render those characters (they are called glyphs) we need to have loaded a font that supports those glyphs. In your case you'll need to set a bengali fallback font, for example I just tried using as fallback font Noto Serif Bengali Regular and worked. But, first, I had to fix fallback fonts (it was not loading the user-set fallback font but the default one even if the user changed it). So in order to test this you'll need to download the latest nightly build.

Go to Settings -> Window -> Fallback Font... and select the downloaded font, then you'll need to restart ecode and that should be it, now you can open any file with bengali text.

Image

In the future I'll try to simplify the process to easily download / get the required fonts. But for now this is enough.

@SpartanJ SpartanJ added bug Something isn't working ready for release labels Mar 28, 2025
@InterGalacticCold
Copy link
Author

@SpartanJ it's somewhat rendering this time. The characters are rendering properly but their position and form is messed up.
I am writing below the first three lines of your screenshot. These is how they are supposed to look:

  1. Hello: হ্যালো / নমস্কার
  2. Good morning: সুপ্রভাত
  3. Good night: শুভ রাত্রি

I can't find an easy way to describe you the problem. One thing you need to know that in Bengali, we have symbols for vowels and characters sometimes change to a different shape/form depending on their position in a word. In this case the position of the symbols are not correct and the characters aren't changing their form/shape where they're supposed to.

I've also tried using two different fonts and all of them have the same issue.

@SpartanJ
Copy link
Owner

Oh, sorry, I did not realise that Bengali required text-shaping (mentioned here).
Some languages require text-shaping for the reasons you described. ecode still does not support text-shaping but there's a partial implementation that can be activated as an optional parameter before opening the editor, if you run: ecode --text-shaper (it's hidden because it's really not ready) it will start ecode with text-shaping capabilities. I think that for your particular case you could use it although I don't recommend it for every day use, since you'll most surely encounter problems (I did't finish for example cursor navigation, it will behave in a wonky manner). Right to left writting languages are still not working but I think Bengali seems to work somewhat OK, I really have difficulties recognising it

Image

So in short: it's not fully supported, it's a work in progress, and there's plenty of work to be done.

I'll use this issue to keep track of the progress (also will rename the issue to make it more general).

I'd really like to have this working properly but it's a lot of work and honestly not easy nor fun either. Text shaping is a very CPU heavy operation and using it with the current implementation reduces the general text-rendering performance beyond the 50%, to avoid that it's required to do some heavy caching that goes against the current architecture (which is very straightforward and very very fast).

@SpartanJ SpartanJ changed the title Some languages (Bengali in my case) don't render even though utf-8 is selected. Support text-shaping Mar 29, 2025
@SpartanJ SpartanJ added enhancement New feature or request and removed bug Something isn't working ready for release labels Mar 29, 2025
@InterGalacticCold
Copy link
Author

@SpartanJ in the screenshot of your last comment, it is working properly. So I think you're there, I don't know how far.

@SpartanJ
Copy link
Owner

SpartanJ commented Mar 29, 2025

Cool, I just enabled this --text-shaper option in the nightly builds just in case you want to try it. I'll continue working on this issue soon.

@InterGalacticCold
Copy link
Author

I've tried the nightly with text-shaper, it seems to work just fine. I am not noticing any problems. You also mentioned concern about CPU usage, which I found to be totally normal.

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

No branches or pull requests

2 participants