XYZ
XYZ

Reputation: 27417

How to make italic rounded style system text in SwiftUI?

It seems SwiftUI font italic modifier does not have an effect on text with the system font style.

Having a .font(.system()) makes .italic() not changing the font style any more. is there a workaround for this behavior?

.rounded design should still be there after applying an italic modifier.

        Text(sampleSentence)
            .italic() // <--- Does not work
            .font(.system(size: 20, weight: .regular, design: .rounded))

Upvotes: 3

Views: 859

Answers (1)

aheze
aheze

Reputation: 30436

SF Pro Rounded, the font that gets used when you specify .rounded, doesn't support italics. From the documentation:

SF Pro Rounded and SF Compact Rounded support:

  • Uprights in nine weights — from Ultralight to Black

It doesn't say italics. Meanwhile, for SF Pro:

SF Pro and SF Compact support:

  • Nine weights — from Ultralight to Black — in both uprights and italics

Upvotes: 7

Related Questions