I want to enable a UITextView and NSTextView with rich-text editing options (bold, italics and underline for now) across my iOS and Mac apps. I managed to figure out how to set these attributes to an NSAttributedString, and the basics of saving and retrieving NSAttributedStrings from the views, and even make them sync across devices, but I can't figure out how to make this work across devices and platforms where there might be different fonts used to render the data.
For eg. on deviceA the user has set font size 14. He/she saves some text with part of it bold, and it gets saved to NSAttributedString, which saves the whole font size with it.
self.attributedLogNote = self.textView.attributedText;
This gets converted into NSData, and synced to another device, where the reverse happens:
self.textView.attributedText = self.attributedLogNote;
But on another device, the user might have a different setting for their font size, or might be using Dynamic Type on iOS. When I set the textView with the same attributedString, it will get rendered in the font from the original device, not the font being used on this second device.
How should this be handled ideally? Is there a way to remove the font style / size / family from the NSAttributedString, but still save where the bold, italics or other properties are placed? If so, is there a system-supported way to do this, or do I have to do this myself? Or is it better to convert this back-and-forth between HTML or some other cross-platform standard for rich-text editing?