Skip to content

ASTextNode does not render Japanese font correctly. (It misuse serif fonts) #1655

Description

@muukii

On iOS13, ASTextNode does not render the Japanese font correctly,
Especially, We can see this problem with specified font and linebreak mode.

    let node = ASTextNode()
    
    let paragraph = NSMutableParagraphStyle()
    
    paragraph.lineBreakMode = .byCharWrapping
        
    node.attributedText = NSAttributedString(
      string: "こんにちは",
      attributes: [
        NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 18),
        NSAttributedString.Key.foregroundColor : UIColor.init(white: 0.8, alpha: 1),
        NSAttributedString.Key.paragraphStyle : paragraph,
      ]
    )

image

The rendered font is wrong.
Followings is correct.

image

I think to set lineBreakMode causes this problem.
If I drop setting for lineBreakMode, ASTextNode will render correct font.

Additionally, ASTextNode2 does not have this problem. It works fine.

What's the problem?
Should I use ASTextNode2?

I attach reproduce project file.
iOS13-Text.zip

Metadata

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