Skip to content

Update ResolvedStyledText API#945

Merged
Kyle-Ye merged 16 commits into
mainfrom
feature/text_drawing
Jul 21, 2026
Merged

Update ResolvedStyledText API#945
Kyle-Ye merged 16 commits into
mainfrom
feature/text_drawing

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Jul 21, 2026

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added area: text Text, labels, line style, and text rendering APIs. type: feature New API, behavior, platform support, or user-facing capability. labels Jul 21, 2026
@augmentcode

augmentcode Bot commented Jul 21, 2026

Copy link
Copy Markdown

PR Risk Analyzer Agent🛡️

👀 Human Input Needed
A pair-review briefing is ready for you.

→ Pair Review Briefing

@augmentcode

augmentcode Bot commented Jul 21, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR updates the text rendering/measuring surface area, primarily by implementing CoreText-backed font-metrics aggregation for attributed strings and refining ResolvedStyledText construction/behavior.

Changes:

  • Implemented `NSAttributedString.maxFontMetrics` (CoreText path) and added a focused test suite for it.
  • Added CoreText private API shims (language-aware outsets, clipping metrics, excessive-line-height character set) and utilities to compute oversized-character drawing margins.
  • Hooked `Text.Sizing.layoutMargins(...)` up to the new metrics/margin logic, including vertical writing-mode margin rotation and modifier adjustments.
  • Refactored `AttributeCountInfoKey` into its own file to keep test utilities separated.
  • Reworked parts of `ResolvedStyledText`: added caching for max font metrics, implemented `isEmpty`, dynamic resolution helpers, and introduced an explicit `styledText(...)` factory choosing between nested `StringDrawing` vs `TextLayoutManager` implementations.
  • Added a non-Darwin shim for `NSStringDrawingContext` and a non-Darwin workaround initializer for `NSAttributedString` (Swift issue 71874).
  • Made `NSAttributedString.updateSchedule` return a safe default when missing.
  • Introduced a new WIP `Text+Measure` scaffold (metrics types + cache placeholders) for future measurement work.

Technical Notes: Many code paths are gated behind canImport(CoreText) with explicit fallbacks on other platforms; several text rendering pieces remain marked WIP/FIXME (notably the measurement pipeline and ORB-backed rendering).

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread Sources/OpenSwiftUICore/View/Text/Text/Text+View.swift
Comment thread Sources/OpenSwiftUICore/View/Text/Text/Text+View.swift

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

Review completed with 1 suggestions.

Fix in Cosmos

Comment thread Sources/OpenSwiftUICore/View/Text/Text/Text+Measure.swift
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 276 lines in your changes missing coverage. Please review.
✅ Project coverage is 14.20%. Comparing base (5551939) to head (666b529).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ces/OpenSwiftUICore/View/Text/Text/Text+View.swift 0.00% 189 Missing ⚠️
...s/OpenSwiftUICore/View/Text/Text/Text+Sizing.swift 0.00% 28 Missing ⚠️
.../OpenSwiftUICore/View/Text/Text/Text+Measure.swift 0.00% 27 Missing ⚠️
...ext/AttributedString/Text+NSAttributedString.swift 0.00% 14 Missing ⚠️
...ICore/View/Text/Util/ReducedTimelineSchedule.swift 0.00% 9 Missing ⚠️
...rces/OpenSwiftUICore/Shim/TextNonDarwinShims.swift 0.00% 7 Missing ⚠️
...s/OpenSwiftUICore/Test/AttributeCountInfoKey.swift 0.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (5551939) and HEAD (666b529). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (5551939) HEAD (666b529)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #945       +/-   ##
===========================================
- Coverage   26.28%   14.20%   -12.08%     
===========================================
  Files         724      683       -41     
  Lines       51368    45197     -6171     
===========================================
- Hits        13500     6422     -7078     
- Misses      37868    38775      +907     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kyle-Ye
Kyle-Ye merged commit 3170101 into main Jul 21, 2026
5 of 9 checks passed
@Kyle-Ye
Kyle-Ye deleted the feature/text_drawing branch July 21, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: text Text, labels, line style, and text rendering APIs. type: feature New API, behavior, platform support, or user-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant