[JW Lua] Opening a .suit font file on MacOS doesn't work, ttf and otf works - solved

Jan Angermüller jan at angermueller.com
Fri Jan 18 20:17:41 CET 2019


Found the solution. Although .suit doesn't look like a folder, it can be 
addressed like a folder.
I.e. to open the font in included in Maestro.suit, I must use:
local file=io.open("/Library/Fonts/Maestro.suit/..namedfork/rsrc")

(see 
https://apple.stackexchange.com/questions/8455/how-do-i-convert-a-suitcase-font 
)

Am 1/18/2019 um 5:56 PM schrieb Jan Angermüller:
> Jari et al,
>
> I am finally converting my Perfect Layout plug-in to MacOS
> (here a first preview: https://www.youtube.com/watch?v=vFUpFmfAGMk ).
>
> The plug-in includes a tool for reading fonts and their metrics.
> Unfortunately there seems to be a weird problem with .suit font files 
> on MacOS.
> They seem to be not readable through io.open.
> .ttf and .otf works fine, but opening .suit simply returns an empty 
> string.
>
> Any ideas on this? I don't have much MacOS insider experience, so any 
> help is appreciated.
> Does it have to do with how MacOS handles some resources that are 
> actually containers/wrappers for other files?
>
> Here is my test code:
> |localinput 
> =assert(io.open("/Library/Fonts/Tahoma.ttf","rb"))localdata=input:read("*all")print(string.byte(data,1))--prints 
> the correct value 0io.close(input)localinput 
> =assert(io.open("/Library/Fonts/Maestro.suit","rb"))localdata=input:read("*all")print(string.byte(data,1))--prints 
> nothing, but value 0 would have been expected io.close(input)|
>
> When I extract the Maestro.ttf font that is included in Maestro.suit 
> and run the code directly on Maestro.ttf, it also works fine.
>
> Jan
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20190118/0118dca4/attachment.htm>


More information about the JWLua mailing list