Skip to content

fix(text): preserve macOS font smoothing in keyed text masks - #1141

Merged
Kyle-Ye merged 1 commit into
mainfrom
fix/macos-keyed-text-mask
Oct 12, 2026
Merged

Kyle-Ye merged 1 commit into
mainfrom
fix/macos-keyed-text-mask

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Oct 12, 2026

Copy link
Copy Markdown
Member

Fixes #1140.

Summary

macOS button labels differ from SwiftUI at the glyph edges because
renderKeyedText draws the alpha-only mask with white. macOS font smoothing uses
the fill color when it computes glyph coverage, including in an alpha-only
context.

  • Use the resolved linear RGB with alpha 1 for solid fills in macOS text masks.
  • Use black in light mode or white in dark mode for other fills on macOS.
  • Keep white masks on other platforms and apply the style opacity in the
    existing rendering layer.

Validation

Both Button interaction cases passed on macOS 15.7.3 with the OpenSwiftUI
renderer and IAG. All six snapshots matched the unchanged SwiftUI references;
the action-count and disabled-action assertions also passed. This validation
was completed before the rebase onto the current main and has not been
repeated after it.

A standalone text probe confirmed color-dependent alpha coverage on macOS
15.7.3 with font smoothing enabled. The equivalent iOS 18.5 probe was
color-independent.

@github-actions github-actions Bot added area: rendering DisplayList, render backends, renderer hosts, drawing, and effects. area: text Text, labels, line style, and text rendering APIs. impact: visual-diff Visual mismatch, screenshot diff, or rendering fidelity issue. platform: macOS macOS-specific behavior or support. type: bug Something is not working correctly. labels Oct 12, 2026
@tuist

tuist Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🛠️ Tuist Run Report 🛠️

Tests 🧪

Scheme Status Ran test modules Commit
Unknown ⏳ 7 22b10be26
OpenSwiftUI ✅ 7 22b10be26

Builds 🔨

Scheme Status Duration Commit
OpenSwiftUI ✅ 54.2s 22b10be26

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.00%. Comparing base (419664e) to head (13b2806).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...tUICore/Shape/ShapeStyle/ShapeStyleRendering.swift 0.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1141      +/-   ##
==========================================
- Coverage   30.01%   30.00%   -0.01%     
==========================================
  Files         921      921              
  Lines       73240    73254      +14     
==========================================
+ Hits        21982    21983       +1     
- Misses      51258    51271      +13     

☔ 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 commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

/interactiontest macos openswiftui-renderer-iag

@Kyle-Ye
Kyle-Ye force-pushed the fix/macos-keyed-text-mask branch from 6347bb5 to 13b2806 Compare October 12, 2026 15:32
@Kyle-Ye
Kyle-Ye merged commit 09854e1 into main Oct 12, 2026
5 checks passed
@Kyle-Ye
Kyle-Ye deleted the fix/macos-keyed-text-mask branch October 12, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: rendering DisplayList, render backends, renderer hosts, drawing, and effects. area: text Text, labels, line style, and text rendering APIs. impact: visual-diff Visual mismatch, screenshot diff, or rendering fidelity issue. platform: macOS macOS-specific behavior or support. type: bug Something is not working correctly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS button text differs from SwiftUI in interaction snapshots

1 participant