Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] iOS 18 Chinese rendering bug #3029

Open
1 task done
cho-trackman opened this issue Oct 4, 2024 · 9 comments
Open
1 task done

[BUG] iOS 18 Chinese rendering bug #3029

cho-trackman opened this issue Oct 4, 2024 · 9 comments

Comments

@cho-trackman
Copy link

cho-trackman commented Oct 4, 2024

Description

I've experiencing this regression on iOS 18 when drawing the degree symbol °.

iOS 17.5

iOS 17

iOS 18.0

iOS 18

Code

Simple project to reproduce: https://github.com/cho-trackman/SkiaIos18Bug

Expected Behavior

A normal looking degree symbol (°). It works on all iOS versions prior to 18. It also works in Japanese and Korean on iOS 18.

Actual Behavior

You'll see different character than a degree symbol.

Version of SkiaSharp

2.88.8 (Current)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Other (Please indicate in the description)

Platform / Operating System

iOS

Platform / Operating System Version

iOS/iPadOS 18.0

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@cho-trackman
Copy link
Author

I've just added a CoreGraphics part to test repo (https://github.com/cho-trackman/SkiaIos18Bug), but also realized that maybe it should have been done in CoreText to reflect how Skia is drawing (I don't know).

@cho-trackman
Copy link
Author

Sample project updated with CoreText as well.

iOS 17.5

Simulator Screenshot - iPad Pro 11-inch (M4) - 2024-10-07 at 11 09 04

iOS 18.0.1

IMG_72A203CE458B-1

@mattleibow
Copy link
Contributor

mattleibow commented Nov 11, 2024

Can you try the latest preview 3.118? I wonder if there has been an update in the engine.

Are you able to also try Mac Catalyst and see if this is an iOS vs Apple issue. Also, was this a device or a simulator?

Can you try using SkiaSharp.HarfBuzz and see if shaping makes a difference? Maybe even have a look at RichTextKit. I know this is not ideal, but it will help narrow down where the issue is coming from. Maybe it is the fact that iOS 18 does not like something, or maybe there is some other issue that the other 2 libraries work around because they do more advanced text processing (more similar to the UILabel and CoreGraphics)

Also, what happens if you remove the Chinese character? The character might be causing an issue somehow.

@taublast
Copy link
Contributor

If you ask me, what is to investigate here is how the PingFang SC font changed, the one shipped with iOS 18.
The fact that UILabel/Core-libs-whatever render that symbol means absolutely nothing in that regard, personally I would expect them to find the appropriate font for every glyph inside the text to render. While in the repro we look for appropriate font for the symbol only.

An example of this is when you pass an emojy to a system label and specify a font where it doesn't exist. A normal behavior for such control would be to find an installed font where this glyph is present and render it. If you do same with skia low-level DrawText you won't get it rendered correctly if it's missing. It's by design, it's okay, low-level renderers dont have to provide hi-level logic for you.

So one probability is if that glyph is missing from PingFang SC shipped with iOS 18 this issue is to be closed.

To be able to render complex text with emojies and such glyphs without worrying about what font to use when glyph is missing some would use RichTextKit, some would use DrawnUI SkiaMarkdownLabel see example.

@cho-trackman
Copy link
Author

Just tested on 3.118.0-preview.1.2 and the issue is still there. I will look into your other suggestions and come back with more info.

@cho-trackman
Copy link
Author

Also, what happens if you remove the Chinese character? The character might be causing an issue somehow.

The degree char gets drawn as below, removing it removes the rectangle with the circle inside.
image

@cho-trackman
Copy link
Author

So one probability is if that glyph is missing from PingFang SC shipped with iOS 18 this issue is to be closed.

Don't mix up Unicode and ASCII.

@cho-trackman
Copy link
Author

cho-trackman commented Nov 12, 2024

I just stumbled upon this thread https://forums.developer.apple.com/forums/thread/758189.
An Apple dev claims:

PingFang.ttc is no longer in /System/Library/Fonts/Core. iOS 18 has a new Chinese UI font.

That is crazy news to me :O
Update: The font is there, but has been moved and changed to a new undocumented format (see below post).

@cho-trackman
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants