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

Pure Rust font stack for wr_glyph_rasterizer #498

Closed
Tracked by #347
declantsien opened this issue Mar 1, 2023 · 12 comments · Fixed by #564
Closed
Tracked by #347

Pure Rust font stack for wr_glyph_rasterizer #498

declantsien opened this issue Mar 1, 2023 · 12 comments · Fixed by #564

Comments

@declantsien
Copy link
Contributor

declantsien commented Mar 1, 2023

#498 (comment)

@2e0byo
Copy link
Contributor

2e0byo commented Mar 1, 2023

Isn't this down to automatic composition not being implemented ?

@declantsien
Copy link
Contributor Author

declantsien commented Mar 2, 2023 via email

@declantsien
Copy link
Contributor Author

Hit this WR bug. WebRender currently does not work with Noto Color Emoji.

2023-03-15T02:04:03.872358Z ERROR wr_glyph_rasterizer::platform::unix::font: Unable to set glyph size and transform: 23
2023-03-15T02:04:03.872373Z DEBUG wr_glyph_rasterizer::platform::unix::font:    [662] for size 16.0 and scale (1.0, 1.0) from font FontKey(IdNamespace(1), 5)
2023-03-15T02:04:03.872393Z ERROR wr_glyph_rasterizer::platform::unix::font: Unable to set glyph size and transform: 23
2023-03-15T02:04:03.872404Z DEBUG wr_glyph_rasterizer::platform::unix::font:    [260158] for size 16.0 and scale (1.0, 1.0) from font FontKey(IdNamespace(1), 5)```

@declantsien
Copy link
Contributor Author

Code path for color font is not limited to glyph automatic composite.
It used for glyph_type::CHAR_GLYPH too.

Better if WebRender GlyphInstance adds supports for this, otherwise we have to manually draw font png/svg images.

While waiting for WebRender adding support for Color Font. I am happy with just disable Noto Color Emoji for now.

@declantsien
Copy link
Contributor Author

declantsien commented Mar 30, 2023

I recently realized that WebRender has a hard C dependencies (freetype2/harfbuzz), while we'd prefer font stack using Rust(fontdb/ttf_parser/rustybuzz/fontdue/swash etc).

I've experimenting with replacing WebRender wr_glyph_rasterizer with fontdue. It turns out doable. My WebRender branch using fontdue is here and ng branch here.

Tasks:

There are some font concepts I am not sure whether there are involved here.

@declantsien declantsien changed the title WR renderer currently is not rendering Color Emoji Pure Rust font stack for wr_glyph_rasterizer Mar 30, 2023
@declantsien
Copy link
Contributor Author

png/svg fonts is working using patched wr_glyph_rasterizer.
swappy-20230402_212837
swappy-20230402_212305

@rice7th
Copy link

rice7th commented Jun 16, 2023

perhaps Cosmic text?

@declantsien
Copy link
Contributor Author

perhaps Cosmic text?

Cosmic text doesn't really fit into Emacs IMO. Emacs layout text itself.
However the glyph rendering library swash they use is what we need which also support complex text shaping.
I manage to make the emoji and shaping working here #564.

Choosing swash over fontdue which I mentioned in other comments, is that fontdue doesn't support emoji rendering, also we have to find another rust shaping library.

Interestingly, we have this elisp OTF/TTF font loader and renderer which is inspired by fontdue.

@declantsien
Copy link
Contributor Author

swappy-20240305_104850

@rice7th
Copy link

rice7th commented Mar 5, 2024

Allsortrs by yeslogic seems to be a powerful shaping library

@declantsien
Copy link
Contributor Author

Allsortrs by yeslogic seems to be a powerful shaping library

I think we wouldn't mind having a new Emacs font driver implemented in Allsort!
If someone is willing to write the code for it 🙂

@rice7th
Copy link

rice7th commented Mar 6, 2024

Oh well I don't have that much experience with font shaping libraries 😅 but if I find enough time maybe this summer I can give it a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

3 participants