fontdb icon indicating copy to clipboard operation
fontdb copied to clipboard

Support iOS

Open maun opened this issue 11 months ago • 4 comments

I would like to use a ui toolkit which uses this crate on iOS (floem, cosmic-text). Since the System directory with the fonts cannot be accessed on iOS i think CoreText must be used. The available fonts can be listed with this method.

Is this in scope for this library?

maun avatar Jan 05 '25 21:01 maun

I think this is out of scope. If the directory with fonts can't be accessed, there is no way for the TTF files to be loaded and therefore no way to query font info with fontdb's current architecture.

notgull avatar Jan 05 '25 21:01 notgull

fonts can be accessed on ios from the following paths: /System/Library/Fonts/ /System/Library/Fonts/Cache even in a sandboxed app

you can also read /System/Library/Fonts/CGFontCache.plist to get a list of fonts, but scanning the directory works also

Kees-van-Beilen avatar Jan 09 '25 13:01 Kees-van-Beilen

fonts can be accessed on ios from the following paths: /System/Library/Fonts/ /System/Library/Fonts/Cache even in a sandboxed app

you can also read /System/Library/Fonts/CGFontCache.plist to get a list of fonts, but scanning the directory works also

While it might be possible, afaik it is against the „rules“ and would prevent publishing in the app store SO question

Fontique, which also provides font enumeration and fallback, does use CoreText: implementation

maun avatar Jan 11 '25 07:01 maun

No it isn't against the rules and many apps use it:

2.5.2  Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the app completely viewable and editable by the user.

The application container provides a symlink to /System/Library/, thus it is allowed

Kees-van-Beilen avatar Jan 11 '25 11:01 Kees-van-Beilen