Skip to content

Context::add_fonts #4184

Open
Open
@smessmer

Description

@smessmer

Is your feature request related to a problem? Please describe.
I want to add fonts to the egui context from multiple places that aren't aware of each other, i.e. they need a way to add fonts without deleting each others fonts. This is happening before the first frame. This was possible in egui 0.24 but isn't anymore in 0.26.

Describe the solution you'd like
The best way would be to offer a Context::add_fonts function on top of the existing Context::set_fonts function.

Describe alternatives you've considered
The way I did this in egui 0.24 is to call Context::fonts_mut, then check whether the returned fonts are None or Some, and correspondingly either add my fonts to the list or create a new list of fonts. However, the Context::fonts_mut function is gone in egui 0.26, and only a Context::set_fonts remains. That function, however, always overwrites existing fonts. I also looked at Context::fonts, but that one panics in case there are no fonts instead of returning None, so it doesn't work for me either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    eguitextProblems related to text

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions