Skip to content

check: safe-area judges a centred line by its glyphs, not its full-width box - #100

Closed
SirSicard wants to merge 1 commit into
shinyobjectz:mainfrom
SirSicard:check-safe-area
Closed

SirSicard wants to merge 1 commit into
shinyobjectz:mainfrom
SirSicard:check-safe-area

Conversation

@SirSicard

Copy link
Copy Markdown
Contributor

Requested by Mattias

Part of #89 (item 1).

The safe-area rule tested the text's block container. A centred title in a left: 0; right: 0 div therefore touched both edges, and got an error on the commonest centred layout.

What changes (apps/check/src/text.rs)

  • text_runs narrows the box to the line's bounded width before the rules see it. The width is 0.62 em per character, wider than most faces set, so a real overrun is never hidden. The box is placed by the manifest's align.
  • A box no wider than that bound is kept as it is.
  • The safe-area message now says which edge, and prints the box.
  • New test a_centred_line_in_a_full_width_box_is_judged_by_its_glyphs.

Tested on main 5b2c773

A 96 px centred title in a full-width box at top 480, run through raea check --quick:

  • main: error safe-area ... sits in the app's UI zone.
  • This branch: ok safe areas: no text in the UI zones.

cargo test -p raea-app-check passes.

Also merged onto main 0ea4eab together with the other open PRs from this review: their crates' tests pass (118, 0 failed).

This and the check-cues PR each add a test at the end of apps/check/src/tests.rs, so whichever merges second has a one-hunk conflict there (keep both tests).


🤖 Generated with Claude Code

Safe-area tested the text's block container, so a centred title in a
left:0/right:0 div touched both edges (an error on the commonest centred
layout). text_runs now narrows the box to the line's bounded width (0.62 em a
character, wider than most faces set, so a real overrun is never hidden),
placed by the manifest's align, and the safe-area message says which edge and
prints the box. Test beside the other text rules.

Part of shinyobjectz#89

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SirSicard

Copy link
Copy Markdown
Contributor Author

The size gate fails here: this PR takes raea-app-check to 2,040 lines, and #102 to 2,026; with both merged it would be about 2,068 (main is at 1,998). Both add tests to apps/check/src/tests.rs, and the crate was already close to the cap.

How would you like it split? One option is moving the text rules (text.rs with their tests) into a crate of their own. I'm happy to send that as a separate PR first and rebase #100 and #102 onto it, or to tighten these two instead if you'd rather keep one crate.


Generated by Claude Code

@shinyobjectz

Copy link
Copy Markdown
Owner

Thanks. The safe-area fix landed in 6f88437: the manifest records each text's ink (its letters' extent by alignment), and the clipped, safe-area and face rules measure that. Older manifests fall back to the box. Credited to your report in the commit; closing as covered.

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