문제

I can't figure out how to include a font in my Mac screensaver. I did this following tutorial, Embed font in a mac bundle, but my [NSFont fontWithName:size:] still returns null. I don't really know where to start. Any thoughts, solutions? Thank you

도움이 되었습니까?

해결책

The example you're following works for an application. The problem is that you're building a screensaver bundle. Those are not applications unto themselves, they are loaded by separate application. Apparently, the ATSApplicationFontsPath key, as its name implies, is only used when loading an application.

You will have to write code to enumerate the font file URLs in your bundle and register them. You can use -[NSBundle URLsForResourcesWithExtension:subdirectory:] and CTFontManagerRegisterFontsForURLs() for that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top