mirror of
https://github.com/storytold/egui.git
synced 2026-11-20 17:42:29 +01:00
Fix: TextFormat::valign not applied correctly with custom line_height This PR resolves an issue where `TextFormat::valign` (vertical alignment) was not correctly applied when `TextFormat::line_height` was explicitly set, especially when it matched the `max_row_height`. **Problem:** The vertical positioning logic in `galley_from_rows()` calculated `valign` based on the difference `(max_row_height - glyph.line_height)`. When `glyph.line_height` was explicitly set to a larger value (e.g., `row_height + 6.0`) and became the `max_row_height` for the row, this difference became zero. As a result, `valign` had no effect, and glyphs consistently appeared top-aligned within the allocated line space. **Solution:** The `valign` calculation is now updated to use `glyph.font_face_height` instead of `glyph.line_height`. This correctly applies vertical alignment to the glyph's actual visual content within the `max_row_height`, ensuring `Align::Center` and `Align::Max` (Bottom) settings function as intended for customized line heights. --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>