简体   繁体   English

将 NSFont 存储到文档中

[英]Storing NSFont to document

Our picture editing cocoa application allows the user to add a string to a photo.我们的图片编辑 cocoa 应用程序允许用户向照片添加字符串。 This string has an associated NSFont object.此字符串具有关联的 NSFont object。 We want to store this NSFont object in the saved document.我们希望将这个 NSFont object 存储在保存的文档中。 Is using archiving NSFont using NSCoding the best way around?使用 NSCoding 归档 NSFont 是最好的方法吗?

I would have thought you would be better off storing an NSFontDescriptor , since that way you have more control over exactly which font you use when your editing app finds itself opening a file on a machine that doesn't have the font that was used when the file was saved.我本以为您最好存储NSFontDescriptor ,因为这样您可以更好地控制当您的编辑应用程序发现自己在没有使用时使用的字体的机器上打开文件时使用的字体文件已保存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM