Skip to content

fix(input): heading base-font bold + list-item spacing guard - #3

Closed
wildseansy wants to merge 1 commit into
wanderlog:feat/list-5-statefrom
wildseansy:sh/list-5-state-review-followup
Closed

fix(input): heading base-font bold + list-item spacing guard#3
wildseansy wants to merge 1 commit into
wanderlog:feat/list-5-statefrom
wildseansy:sh/list-5-state-review-followup

Conversation

@wildseansy

@wildseansy wildseansy commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Follow-up fixes to #2 (the first landed on the branch just after that merge).

Changes

  1. iOS headings derive bold from the base font — a heading with a bold fontWeight (the shared default from headingDefaults) built its font with UIFont systemFontOfSize:weight:, discarding the editor's base font family, so custom-font editors got system-font headings. Android already folds heading weight into the current typeface (InputHeadingSpan); iOS now derives the bold face from the base font via a font-descriptor trait, falling back to the system font only when the family has no bold face. Non-bold explicit weights keep the previous system-font behavior. (Also submitted upstream as fix(input): derive heading bold from the base font on iOS software-mansion/react-native-enriched-markdown#586.)
  2. Android list-item spacing guardStaticLayout treats a LineHeightSpan as paragraph-scoped: chooseHeight runs for every wrapped line of the item regardless of the span's character range, and the FontMetricsInt is reused across those calls, so the unguarded relative ascent adjustment compounded line after line — wrapped list items rendered with progressively growing gaps between visual lines. The adjustment is now guarded to the single line containing the span start, so only the item's first visual line is spaced, exactly once.

Testing

  • Both verified in the consuming app (Tonic mouni): headings render in the editor's custom font (SofiaPro) bold face on an iOS simulator; wrapped list items render with uniform line density on an Android emulator (previously growing gaps).
  • clang-format clean on touched iOS files.

🤖 Generated with Claude Code

A heading with a bold fontWeight (the shared default) built its font with
UIFont systemFontOfSize:weight:, discarding the editor's base font family —
custom-font editors got system-font headings. Android already folds heading
weight into the current typeface (InputHeadingSpan), so iOS now derives the
bold face from the base font via a font-descriptor trait, falling back to
the system font only when the family has no bold face. Non-bold explicit
weights keep the previous system-font behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wildseansy wildseansy closed this Jul 23, 2026
@wildseansy wildseansy changed the title fix(input): derive heading bold from the base font on iOS fix(input): heading base-font bold + list-item spacing guard Jul 23, 2026
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