emilk / emilk/egui

Provide a way to reduce memory usage by fonts

Open
#7,325 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Is your feature request related to a problem? Please describe.**

Our application ([Ruffle](https://github.com/ruffle-rs/ruffle)) has to support multiple languages in GUI at the same time (so we want to display latin, arabic, hebrew, CJK, etc. text). In order to do that we're loading fonts, like Noto Sans CJK KR, Noto Sans CJK JP, Noto Sans CJK SC, Noto Sans CJK TC, Noto Sans Hebrew, Noto Sans Arabic. Unfortunately they end up taking a lot of memory, because they all have to be provided as `Vec`.

We're planning to use fontconfig to provide that list of fonts, which can actually make it even worse.

**Describe the solution you'd like**

We'd like egui to support fonts without loading them into memory in their entirety. An example solution would be to accept `File` objects that represent those fonts, and lazily load glyphs from the files when needed, without keeping their contents in memory.

**Describe alternatives you've considered**

We were thinking about mmapping font files into memory, but it's inherently unsafe in Rust.

**Additional context**

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by tracing egui’s current font-loading path and its native versus WebAssembly constraints, then assess lazy glyph loading from file-backed fonts. Done means multilingual font support no longer requires retaining each font’s full contents as a Vec.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.