Skip to content

Keep a hero headline word from standing alone on a line - #4

Merged
RyanEwen merged 1 commit into
mainfrom
hero-wrap-no-lone-word
Nov 25, 2026
Merged

RyanEwen merged 1 commit into
mainfrom
hero-wrap-no-lone-word

Conversation

@RyanEwen

@RyanEwen RyanEwen commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What

fitText picks the largest font size at which hero text fits. When that size leaves a word alone on a line, it now tries the sizes up to 10 percent smaller and takes the largest that leaves fewer lone words; if none does, the largest fitting size stands. A one-word paragraph forced by a \n does not count.

Example: PrintStream's "Every printer, every project, on every device." drew as "Every printer, / every / project, on / every device." and now draws as "Every printer, / every project, / on every device."

Scope notes:

  • The rule is in fitText, so sublines get it too. No current subline changes.
  • Japanese and Chinese count a lone segmenter word the same way. The one CJK hero that changes (ImmichDrive ja-JP) moves "Immich" off its own line.
  • Line balancing, the top-two-thirds limit, the size floors, and locale fonts are unchanged.

Consumer impact

On the next pin bump, devkit-store-hero --check fails in these apps until their heroes are re-rendered (each reads better after):

App Locale Before After
PrintStream (uncommitted hero) en-US Every printer, / every / project, on / every device. Every printer, / every project, / on every device.
ChatMixr pt-BR Equilibre o som / do jogo e do chat / em qualquer / headset. Equilibre o som do / jogo e do chat em / qualquer headset.
Tray Control for WSL de-DE ... / starten und / beenden. ... / starten und beenden.
Repilot pt-BR Faça a tecla / Copilot / fazer o que / você quiser. Faça a tecla / Copilot fazer o / que você quiser.
ImmichDrive fr-FR Vos photos / Immich, / ... Vos photos Immich, / ...
ImmichDrive ja-JP Immich / の写真を、 / ... Immich の写真を、 / ...
Persistent de-DE ... / direkt im / Windows- / Infobereich. ... / direkt im Windows- / Infobereich.

DisplaySwitchr and Little Launcher do not change. Persistent de-DE and ImmichDrive ja-JP still have one-word lines that no size in range removes (such as "Deine" and "で。"), but fewer than before. The committed examples in docs/examples/store-hero/ do not change. The next release notes should name these re-renders.

Tests

Two fitText unit tests: the PrintStream sentence steps down to a three-line break, the step stops at 10 percent, and text with no lone word (or a forced one-word line) keeps the largest size. npm run validate passes locally.

AI disclosure: this comment and the related code were written with the assistance of AI.

When the largest size that fits leaves one word alone on a line, fitText now tries the sizes up
to 10 percent smaller and takes the largest that leaves fewer lone words. If none does, the
largest fitting size stands. A one-word paragraph (forced by a line break) does not count.

PrintStream's "Every printer, every project, on every device." drew as "Every printer, / every /
project, on / every device." and now draws as "Every printer, / every project, / on every
device." The rule lives in fitText, so it applies to sublines too, and to Japanese and Chinese,
where a lone segmenter word counts the same way. The committed examples do not change.
@RyanEwen
RyanEwen merged commit b628dde into main Nov 25, 2026
1 check passed
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.

1 participant