Skip to content

FEAT: Allow disabling of automatic font scaling#6727

Merged
JZDesign merged 10 commits into
mainfrom
jzdesign/disable-font-scaling
May 7, 2026
Merged

FEAT: Allow disabling of automatic font scaling#6727
JZDesign merged 10 commits into
mainfrom
jzdesign/disable-font-scaling

Conversation

@JZDesign

@JZDesign JZDesign commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Description


Note

Medium Risk
Changes paywall component decoding and font construction to optionally bypass Dynamic Type, which can affect text layout and accessibility behavior across templates.

Overview
Adds a new paywall-components flag, automatically_scale_font_size, that controls whether Paywalls V2 text respects Dynamic Type.

Threads this value from PaywallComponentsData into UIConfigProvider and down into text/font creation so custom and generic fonts use fixed sizing when scaling is disabled (including using Font.custom(..., fixedSize:)). Updates encoding/decoding and tests to default the behavior to enabled when the flag is absent.

Reviewed by Cursor Bugbot for commit 332f200. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 3 commits April 29, 2026 20:15
Introduce optional allowFontScaling on PaywallData (JSON allowFontScaling) for Paywalls V2.
Pass it into UIConfigProvider so resolveFont and text styling respect Dynamic Type when true
and use fixed sizes when false. Thread from Offering.paywall through PaywallsV2View and
WorkflowPaywallView. Update swiftinterface API snapshots and Swift API tester.

Co-authored-by: Jacob Rakidzich <Jacob@JacobZivanDesign.com>
Matches preferred naming; JSON key updated to automaticallyScaleFontSize.

Co-authored-by: Jacob Rakidzich <Jacob@JacobZivanDesign.com>
@JZDesign JZDesign requested review from a team as code owners April 30, 2026 20:39
Comment thread RevenueCatUI/Templates/V2/ViewModelHelpers/UIConfigProvider.swift Outdated
@JZDesign JZDesign changed the title Jzdesign/disable font scaling FEAT: Allow disabling of automatic font scaling May 5, 2026
Comment thread RevenueCatUI/Templates/V2/ViewModelHelpers/PaywallComponentTypeTransformers.swift Outdated
Comment on lines +26 to +27
/// Dashboard flag: Dynamic Type only when `automatically_scale_font_size` is true on paywall components.
private let automaticallyScaleFontSizeOverride: Bool

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think using override might be confusing, implying it comes in the overrides field for a specific component 🤔

What about. scaleFontSizeAutomatically?

Comment on lines +103 to +106
useDynamicType: Bool? = nil
) -> Font? {

let useDynamicType = useDynamicType ?? self.useDynamicType()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why having both the func parameter and the static function? Is it for testing purposes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope… Just forgot to change this line after updating things to be non-optional

@facumenzella facumenzella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a few nits. Haven't manually tested it but looks 👍

@JZDesign JZDesign enabled auto-merge (squash) May 7, 2026 12:28
familyName: familyName,
automaticallyScaleFontSize: automaticallyScaleFontSize
)
return Font(platformFont)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Modified function is never called anywhere in codebase

Low Severity

PaywallComponent.FontSize.makeFont(familyName:automaticallyScaleFontSize:) and its private helper makePlatformFont are never called anywhere in the codebase. The automaticallyScaleFontSize parameter was added to dead code, so the conditional dynamic-type logic on lines 76–79 is unreachable in production. The actual font scaling feature flows through TextComponentStyle.makeFontGenericFont.makeFont / UIConfigProvider.resolveFont, none of which call this function.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c04dc0d. Configure here.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 332f200. Configure here.

let textStyle = GenericFont.textStyle(for: fontSize)
return Font.custom(fontName, size: fontSize, relativeTo: textStyle)
} else {
return Font.custom(fontName, size: fontSize)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Default parameter on resolveFont ignores provider's stored setting

Low Severity

The resolveFont method on UIConfigProvider takes useDynamicType: Bool = true as a parameter, but the provider already stores the correct value in self.automaticallyScaleFontSize. The default of true means any caller that omits the parameter will get font scaling enabled regardless of the dashboard setting. The separate useDynamicType() function that just returns the stored property adds unnecessary indirection. The developer acknowledged in the PR discussion this was unintentional — "Just forgot to change this line after updating things to be non-optional." The method could simply read self.automaticallyScaleFontSize internally instead of requiring callers to pass it.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 332f200. Configure here.

@JZDesign JZDesign merged commit 75f2318 into main May 7, 2026
16 of 18 checks passed
@JZDesign JZDesign deleted the jzdesign/disable-font-scaling branch May 7, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants