emilk / emilk/egui

Cosmic Text for font rendering

Open
#3,378 30 comments 7 reactions 0 assignees View on GitHub
epaint help wanted text
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

As discussed in #1016 , I have done some testing on [cosmic-text](https://github.com/pop-os/cosmic-text).

First of all, they have some [docs](https://pop-os.github.io/cosmic-text/cosmic_text/) that I've been exploring. And I was testing their [example](https://github.com/pop-os/cosmic-text/tree/main/examples/editor-orbclient). They do have `no_std` and `wasm` support too according to the `Cargo.toml` they have.

I've noticed that the way it renders, is by drawing rectangles. Which is something I've seen for the first time to be honest. You can check it [here](https://github.com/pop-os/cosmic-text/blob/e2adc1e8da1fd8196224254e02f28f815e47d4e5/examples/editor-orbclient/src/main.rs#L99-L107). It gives a x,y,width,height, and color which is usually just color predefined and alpha channel being different for aliasing and stuff.

There is also another method if rectangles aren't possible: [Swash Image](https://pop-os.github.io/cosmic-text/cosmic_text/struct.SwashCache.html#method.get_image) which basically returns an image bytes to be rendered instead of individually creating rectangles. It requires some things I couldn't implement myself to be honest.

I was able to sort of hack the rectangle method in my engine
![image](https://github.com/emilk/egui/assets/35463470/e03ad5b8-9eda-44a9-be32-0ff52f07e589)

It had... not good results to be honest
![image](https://github.com/emilk/egui/assets/35463470/d9b8a7ef-5d91-4ffd-a345-5e900583d980)

Although maybe that's on me for having some issues with the engine as their examples do work and work very well. But yeah, that's my findings so far on cosmic text.

Contributor guide

Open the contributing guide

Research direction

Review #1016 and the linked cosmic-text documentation and editor-orbclient example, including the rectangle and SwashCache approaches. The issue does not define a specific egui file, test, acceptance criteria, or what “done” means, so the implementation target must be clarified before work can start.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.