Skip to content

Preserve (don't clamp) negative half-leading - #743

Open
nicoburns wants to merge 1 commit into
linebender:mainfrom
DioxusLabs:devin/1786407463-negative-half-leading
Open

Preserve (don't clamp) negative half-leading#743
nicoburns wants to merge 1 commit into
linebender:mainfrom
DioxusLabs:devin/1786407463-negative-half-leading

Conversation

@nicoburns

Copy link
Copy Markdown
Collaborator

Summary

When line-height < ascent + descent, half-leading is legitimately negative:

  • Extents now default to f32::NEG_INFINITY so legitimately negative extents are preserved.
  • Lines with no extent contributions are resolved to zero in finish_line.
  • Out-of-flow inline boxes no longer contribute extents.

LLM Contributions

Code generated with Devin Ultra.

Changelog Entry

Fixed

  • Line boxes with negative half-leading (line-height smaller than ascent + descent) are no longer floored at the content height; out-of-flow inline boxes no longer floor a line's extents at zero.

Line box extents now default to f32::NEG_INFINITY instead of 0 so that
content whose over/under extents are legitimately negative (e.g. text
with line-height smaller than ascent + descent) is not floored at zero.
The sentinel is resolved to zero when a line has no contributing
content, so it never escapes into public metrics. Out-of-flow inline
boxes now contribute negative-infinity extents (a no-op under max)
rather than zero, so they no longer floor the line's extents either.
@nicoburns nicoburns changed the title Don't clamp negative line box extents from negative half-leading Preserve (don't clamp) negative half-leading Aug 12, 2026

@DJMcNab DJMcNab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this justifies a new test. Otherwise, this looks good to me.

If I didn't know that this code (and therefore its comments) will be changing again for proper strut support, I'd be more critical of the new comments - I'm not a huge fan of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants