-
-
Notifications
You must be signed in to change notification settings - Fork 153
Description
How do you get the text in a RichTextEditor look approximately the same size as text with the same content on macOS?
I've been looking into the UITextView's usesStandardTextScaling
property to try and figure this out. Apple states:
When the value of this property is true, UIKit automatically adjusts the rendering of the text in the text view to match the standard text scaling.
When using the standard text scaling, font sizes in the text view appear visually similar to how they would render in macOS and non-Apple platforms, and copying the contents of the text view to the pasteboard preserves the original font point sizes. This effectively changes the display size of the text without changing the actual font point size. For example, text using a 13-point font in iOS looks like text using a 13-point font in macOS.
If your app is built with Mac Catalyst, or if your text view’s contents save to a document that a user can view in macOS or other platforms, set this property to true.
The default value of this property is false.
but when I enable that on the RichTextView, it messes up the insertion pointer and doesn't display the text across the entire width of the UITextView like it should. Plus worse of all, the insertion pointer and selection blocks go all wonky.
I don't have a Mac Catalyst app. It's AppKit. I also have an iOS version. They display the same NSAttributedString data, but on iOS, the text renders too small. But if you change the text size on iOS to be more readable, then on macOS it's too large.
Basically how do you use RichTextKit to display the same size text on both macOS and iOS?
Here's two screenshots. Both showing the same paragraph selected.
The first one where the selection looks proper and matches the text is with usesStandardTextScaling = false
. But the text is small and should render larger (without changing the point size of the text) so it visually matches what's seen on the Mac.
The second one is with usesStandardTextScaling = true
and you can see the text isn't rendering larger as it should AND the selection area is offset from the content. It seems like the text needs to be shifted to the right and zoomed in a bit to make it fit the blue selection area.
How do other people handle text size issues between macOS and iOS apps?