mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Previously, when loading a variable font (e.g. via `egui::FontData::from_static`), the font was rendered using the default (often the lightest) weight, ignoring any preferred weight configuration. This change applies the specified weight to skrifa's `Location` for the `wght` axis, ensuring that variable fonts are rendered with the intended font weight. ## Summary Fixes variable font weight not being applied during rendering. The `FontData::weight()` method now properly configures the font variation axis. ## Changes - Add `location: Location` field to `FontFace` to store variation coordinates - Pass `location` parameter through to glyph rendering functions - Apply weight to skrifa's `LocationRef` in `DrawSettings` and `HintingInstance` ## Weight Priority 1. `preferred_weight` from `FontData::weight()` 2. OS/2 table's `us_weight_class` 3. Variable font's fvar default value 4. `Location::default()` ## Related Issue - #3218 : Not follow font id, but goal would be same ## Todo * [x] Apply preferred font weight when loading variable fonts * [ ] Add small size variable fonts for docs and egui (need discussion)