text position: use size instead of bounds (#13858)

# Objective

- #13846 introduced a bug where text not bound was not displayed

## Solution

- bounds are infinite
- use computed size instead, that already should be using the available
bounds
This commit is contained in:
François Mockers 2024-06-16 17:07:31 +02:00 committed by GitHub
parent aaccbe88aa
commit d8f42608f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -87,10 +87,16 @@ impl TextPipeline {
let size = compute_text_bounds(&section_glyphs, |index| scaled_fonts[index]).size();
let h_limit = if bounds.x.is_finite() {
bounds.x
} else {
size.x
};
let h_anchor = match text_alignment {
JustifyText::Left => 0.0,
JustifyText::Center => bounds.x * 0.5,
JustifyText::Right => bounds.x * 1.0,
JustifyText::Center => h_limit * 0.5,
JustifyText::Right => h_limit * 1.0,
}
.floor();