<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Jari et al,<br>
<br>
I am finally converting my Perfect Layout plug-in to MacOS<br>
(here a first preview: <a class="moz-txt-link-freetext" href="https://www.youtube.com/watch?v=vFUpFmfAGMk">https://www.youtube.com/watch?v=vFUpFmfAGMk</a>
).<br>
<br>
The plug-in includes a tool for reading fonts and their metrics.<br>
Unfortunately there seems to be a weird problem with .suit font
files on MacOS.<br>
They seem to be not readable through io.open.<br>
.ttf and .otf works fine, but opening .suit simply returns an empty
string.<br>
<br>
Any ideas on this? I don't have much MacOS insider experience, so
any help is appreciated.<br>
Does it have to do with how MacOS handles some resources that are
actually containers/wrappers for other files?<br>
<br>
Here is my test code:<br>
<pre class="lang-lua prettyprint prettyprinted" style=""><code><span class="kwd">local</span><span class="pln"> input </span><span class="pun">=</span><span class="pln"> assert</span><span class="pun">(</span><span class="pln">io</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"/Library/Fonts/Tahoma.ttf"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rb"</span><span class="pun">))</span><span class="pln">
</span><span class="kwd">local</span><span class="pln"> data</span><span class="pun">=</span><span class="pln">input</span><span class="pun">:</span><span class="pln">read</span><span class="pun">(</span><span class="str">"*all"</span><span class="pun">)</span><span class="pln">
print</span><span class="pun">(</span><span class="pln">string</span><span class="pun">.</span><span class="pln">byte</span><span class="pun">(</span><span class="pln">data</span><span class="pun">,</span><span class="lit">1</span><span class="pun">))</span><span class="pln"> </span><span class="com">--prints the correct value 0</span><span class="pln">
io</span><span class="pun">.</span><span class="pln">close</span><span class="pun">(</span><span class="pln">input</span><span class="pun">)</span><span class="pln">
</span><span class="kwd">local</span><span class="pln"> input </span><span class="pun">=</span><span class="pln"> assert</span><span class="pun">(</span><span class="pln">io</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"/Library/Fonts/Maestro.suit"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"rb"</span><span class="pun">))</span><span class="pln">
</span><span class="kwd">local</span><span class="pln"> data</span><span class="pun">=</span><span class="pln">input</span><span class="pun">:</span><span class="pln">read</span><span class="pun">(</span><span class="str">"*all"</span><span class="pun">)</span><span class="pln">
print</span><span class="pun">(</span><span class="pln">string</span><span class="pun">.</span><span class="pln">byte</span><span class="pun">(</span><span class="pln">data</span><span class="pun">,</span><span class="lit">1</span><span class="pun">))</span><span class="pln"> </span><span class="com">--prints nothing, but value 0 </span><span class="pln">would have been expected
io</span><span class="pun">.</span><span class="pln">close</span><span class="pun">(</span><span class="pln">input</span><span class="pun">)</span><span class="pln"> </span></code></pre>
<br>
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.<br>
<br>
Jan<br>
<br>
</body>
</html>