egui/examples/custom_font
StarStarJ 3f5cd74de7
Put font data into Arc to reduce memory consumption (#5276)
egui never accesses the `FontDefinitions`' member fields mutably, except
in `fonts_tweak_ui` where it cloned the `FontDefinitions` object anyway.

This patch reduces system memory consumption for shared font
definitions.
And also removes some overhead from copying (e.g. for the per
`pixel_per_points` font atlas)

Also it allows to keep a copy of the font definitions outside of egui.

In my App that uses international fonts:
Before:

![image](https://github.com/user-attachments/assets/f8dfb4f4-a21c-447c-8cf9-83025ad6e960)

New:

![image](https://github.com/user-attachments/assets/9f297fbd-e620-4b7e-a32a-65073ee805ed)


Note: If `Arc` is not wanted, then it could ofc be abstracted away.

I know this is quite a breaking change API wise, but would like to hear
your opinion.
2024-11-01 13:30:02 +01:00
..
src Put font data into Arc to reduce memory consumption (#5276) 2024-11-01 13:30:02 +01:00
Cargo.toml Update MSRV from 1.76 to 1.77 (#5322) 2024-10-30 09:06:34 +01:00
README.md Automatically generate screenshots for all examples (#2379) 2022-12-04 17:27:40 +01:00
screenshot.png Move all existing .png images to git LGS (#5320) 2024-10-29 10:04:07 +01:00

README.md

Example of how to use custom fonts.

cargo run -p custom_font