Files
egui/crates/epaint
rustbasicandEmil Ernerfeldt 3dc897b6f0 Fix: TextFormat::valign not applied correctly with custom line_height (#8030)
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>
2026-10-06 07:17:48 +00:00
..
2026-09-08 15:29:48 +00:00
2023-02-12 18:08:13 +01:00

epaint - egui paint library

Latest version Documentation unsafe forbidden MIT Apache

A bare-bones 2D graphics library for turning simple 2D shapes and text into textured triangles.

Made for egui.