Skip to content

Wrong font when using NSParagraphStyle on ASTextNode in iOS 13 #1659

Closed
@sgrgrsn

Description

I have a problem with my ASTextNode when building with the latest beta of Xcode 11 (beta 6) on the latest beta of iOS 13.1 (beta 2), and the one bundled with the Xcode 11 simulator.

I set up my attributed string like this:

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .center

textNode.attributedText = NSAttributedString(
    string: "Hello world!\nHow are you doing?",
    attributes: [
        NSAttributedString.Key.font: UIFont.systemFont(ofSize: 32, weight: .bold),
        NSAttributedString.Key.paragraphStyle: paragraphStyle,
    ]
)

It shows up as a serif font, and not the San Francisco font. If I choose to remove the paragraphStyle attributes from the string it shows up correctly as the San Francisco font, but then I'm not able to set alignment, line heights etc.

With the paragraphStyle attributes:
Simulator 2019-09-06 at 14 26 21

Without the paragraphStyle attributes:
Simulator 2019-09-06 at 14 27 07

I've tried on both my device and on the simulator and it gives the same result. There's no problems when building to an iOS 12 device/simulator.

Hope you can help me out.

Thanks in advance.

Info

Texture version: 2.8.1 (installed with CocoaPods v1.7.3)
Xcode version: 11.0 beta 6
iOS version (simulator): 13.0 (bundled with Xcode 11 beta 6)
iOS version (device): 13.1 beta 2
Sample project:
FontXcode11-Sample.zip

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions