That happens on TextKit. But everything is all right when I use CoreText.
The rich text in the debug window of Xcode also has the same issue.
So, is it a bug of TextKit? Is there any solution in addition to replace TextKit by CoreText?
That happens on TextKit. But everything is all right when I use CoreText.
The rich text in the debug window of Xcode also has the same issue.
So, is it a bug of TextKit? Is there any solution in addition to replace TextKit by CoreText?
Copyright © 2021 Jogjafile Inc.
I tried it and the difference really exists between CoreText and TextKit. I guess it caused by the font fallback functions.
For example, we have a string "啦☜啦", and set a font. In case the given font don't have all characters, there usually a list of fallback fonts like:
There are two ways to find a fallback font.
So if TextKit use the second way, two '啦's may use different fonts because of the character '☜'.
To solve this, you can use attributed string and give '☜' a different font size to break the fallback loop, then the second '啦' use CJK font.