Skip to content

RunGeometry bounds fix#24247

Merged
mockersf merged 2 commits into
bevyengine:mainfrom
ickshonpe:inline-min-coord-fix
May 12, 2026
Merged

RunGeometry bounds fix#24247
mockersf merged 2 commits into
bevyengine:mainfrom
ickshonpe:inline-min-coord-fix

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented May 11, 2026

Objective

We sum GlyphRun::offset and LineMetrics::inline_min_coord when calculating the run geometry bounding boxes during text layout. But this is incorrect because GlyphRun::offset is set equal to offset + self.line.data.metrics.inline_min_coord + self.line.data.metrics.offset, so inline_min_coord is added twice.

We don't see any errors in layout because BreakerState::set_line_x isn't used anywhere atm, so the value of inline_min_coord is always zero, but it's still wrong.

Solution

Don't add inline_min_coord to the run bounds.

@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels May 11, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI May 11, 2026
@ickshonpe ickshonpe added C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 11, 2026
@ickshonpe ickshonpe added this to the 0.19 milestone May 11, 2026
@urben1680
Copy link
Copy Markdown
Contributor

We don't see any errors in layout because

... we lack tests? 😄 Can you add one for this?

@ickshonpe
Copy link
Copy Markdown
Contributor Author

ickshonpe commented May 12, 2026

We don't see any errors in layout because

... we lack tests? 😄 Can you add one for this?

Not sure that it's possible to create a meaningful test for this (without larger changes to the text systems), update_text_layout_info calls break_all_lines which erases any offsets set with set_line_x. So even though the calculations are wrong, the output values are always correct.

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 12, 2026
@mockersf mockersf added this pull request to the merge queue May 12, 2026
Merged via the queue into bevyengine:main with commit 3f83fbc May 12, 2026
40 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in UI May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Text Rendering and layout for characters A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants