How can I access a .suit font file in Lua/MacOS with io.open? .ttf/.otf works fine, suit doesn't












0















I am converting a .ttf/.otf font file reader in Lua 5.2 from Windows to MacOS and also want to add support for .suit font files which include ttf fonts.



Plain .ttf/.otf files now work fine, but already the reading of a .suit file doesn't work.



Any ideas on how to read the bytes of the .suit font on MacOS?
Does it have to do with a file name alias?



local input = assert(io.open("/Library/Fonts/Tahoma.ttf", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints the correct value 0
io.close(input)

local input = assert(io.open("/Library/Fonts/Maestro.suit", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints nothing
io.close(input)


The upper part (Tahoma) prints the correct first byte value 0, while the bottom part prints nothing, although I would have expected the value 0.



When I use string.len(data), it shows the correct value for Tahoma, but 0 for Maestro, although it should be something like 46k.



(EDIT:) SOLVED



See https://apple.stackexchange.com/questions/8455
.suit is not a folder, but it can be addressed like a folder. To open the font part in the .suit file use:



local file=io.open("/Library/Fonts/Maestro.suit/..namedfork/rsrc","rb") 









share|improve this question









New contributor




JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Is .suit file actually a folder, not a regular file?

    – Egor Skriptunoff
    2 days ago











  • It's not a folder though it can bundle several font files. I have only found this information: MacOS stores fonts in "resources" ( fontforge.github.io/macformats.html ), but this doesn't explain why I can open a .ttf, but not a .suit file. I have also found this tool ( stackoverflow.com/questions/7412462/… ) that can extract a .ttf from a .suit, but I am looking for a more direct solution to load the bytes of the .suit file.

    – JAng
    2 days ago













  • Probably, "resource fork" is something similar to an additional file stream on Windows. io.open reads only "main" fork/stream. For example, the "resource fork" would be lost if file is copied from Mac-compatible partition to ext4.

    – Egor Skriptunoff
    2 days ago













  • Yes, maybe. But I can't believe that is not possible to load the file in Lua. The .suit file can be copied and sent per mail, just like any other normal file. Then why should it not be possible to load it byte by byte. I have also tried renaming it (changed suit to ttf), same result.

    – JAng
    2 days ago











  • The .suit file can be copied and sent per mail, just like any other normal file. Try to copy it on USB disk formatted as FAT32, and then check if "resource fork" remained of vanished.

    – Egor Skriptunoff
    2 days ago
















0















I am converting a .ttf/.otf font file reader in Lua 5.2 from Windows to MacOS and also want to add support for .suit font files which include ttf fonts.



Plain .ttf/.otf files now work fine, but already the reading of a .suit file doesn't work.



Any ideas on how to read the bytes of the .suit font on MacOS?
Does it have to do with a file name alias?



local input = assert(io.open("/Library/Fonts/Tahoma.ttf", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints the correct value 0
io.close(input)

local input = assert(io.open("/Library/Fonts/Maestro.suit", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints nothing
io.close(input)


The upper part (Tahoma) prints the correct first byte value 0, while the bottom part prints nothing, although I would have expected the value 0.



When I use string.len(data), it shows the correct value for Tahoma, but 0 for Maestro, although it should be something like 46k.



(EDIT:) SOLVED



See https://apple.stackexchange.com/questions/8455
.suit is not a folder, but it can be addressed like a folder. To open the font part in the .suit file use:



local file=io.open("/Library/Fonts/Maestro.suit/..namedfork/rsrc","rb") 









share|improve this question









New contributor




JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Is .suit file actually a folder, not a regular file?

    – Egor Skriptunoff
    2 days ago











  • It's not a folder though it can bundle several font files. I have only found this information: MacOS stores fonts in "resources" ( fontforge.github.io/macformats.html ), but this doesn't explain why I can open a .ttf, but not a .suit file. I have also found this tool ( stackoverflow.com/questions/7412462/… ) that can extract a .ttf from a .suit, but I am looking for a more direct solution to load the bytes of the .suit file.

    – JAng
    2 days ago













  • Probably, "resource fork" is something similar to an additional file stream on Windows. io.open reads only "main" fork/stream. For example, the "resource fork" would be lost if file is copied from Mac-compatible partition to ext4.

    – Egor Skriptunoff
    2 days ago













  • Yes, maybe. But I can't believe that is not possible to load the file in Lua. The .suit file can be copied and sent per mail, just like any other normal file. Then why should it not be possible to load it byte by byte. I have also tried renaming it (changed suit to ttf), same result.

    – JAng
    2 days ago











  • The .suit file can be copied and sent per mail, just like any other normal file. Try to copy it on USB disk formatted as FAT32, and then check if "resource fork" remained of vanished.

    – Egor Skriptunoff
    2 days ago














0












0








0








I am converting a .ttf/.otf font file reader in Lua 5.2 from Windows to MacOS and also want to add support for .suit font files which include ttf fonts.



Plain .ttf/.otf files now work fine, but already the reading of a .suit file doesn't work.



Any ideas on how to read the bytes of the .suit font on MacOS?
Does it have to do with a file name alias?



local input = assert(io.open("/Library/Fonts/Tahoma.ttf", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints the correct value 0
io.close(input)

local input = assert(io.open("/Library/Fonts/Maestro.suit", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints nothing
io.close(input)


The upper part (Tahoma) prints the correct first byte value 0, while the bottom part prints nothing, although I would have expected the value 0.



When I use string.len(data), it shows the correct value for Tahoma, but 0 for Maestro, although it should be something like 46k.



(EDIT:) SOLVED



See https://apple.stackexchange.com/questions/8455
.suit is not a folder, but it can be addressed like a folder. To open the font part in the .suit file use:



local file=io.open("/Library/Fonts/Maestro.suit/..namedfork/rsrc","rb") 









share|improve this question









New contributor




JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I am converting a .ttf/.otf font file reader in Lua 5.2 from Windows to MacOS and also want to add support for .suit font files which include ttf fonts.



Plain .ttf/.otf files now work fine, but already the reading of a .suit file doesn't work.



Any ideas on how to read the bytes of the .suit font on MacOS?
Does it have to do with a file name alias?



local input = assert(io.open("/Library/Fonts/Tahoma.ttf", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints the correct value 0
io.close(input)

local input = assert(io.open("/Library/Fonts/Maestro.suit", "rb"))
local data=input:read("*all")
print(string.byte(data,1)) --prints nothing
io.close(input)


The upper part (Tahoma) prints the correct first byte value 0, while the bottom part prints nothing, although I would have expected the value 0.



When I use string.len(data), it shows the correct value for Tahoma, but 0 for Maestro, although it should be something like 46k.



(EDIT:) SOLVED



See https://apple.stackexchange.com/questions/8455
.suit is not a folder, but it can be addressed like a folder. To open the font part in the .suit file use:



local file=io.open("/Library/Fonts/Maestro.suit/..namedfork/rsrc","rb") 






macos file lua macos-high-sierra






share|improve this question









New contributor




JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago







JAng













New contributor




JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









JAngJAng

11




11




New contributor




JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






JAng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Is .suit file actually a folder, not a regular file?

    – Egor Skriptunoff
    2 days ago











  • It's not a folder though it can bundle several font files. I have only found this information: MacOS stores fonts in "resources" ( fontforge.github.io/macformats.html ), but this doesn't explain why I can open a .ttf, but not a .suit file. I have also found this tool ( stackoverflow.com/questions/7412462/… ) that can extract a .ttf from a .suit, but I am looking for a more direct solution to load the bytes of the .suit file.

    – JAng
    2 days ago













  • Probably, "resource fork" is something similar to an additional file stream on Windows. io.open reads only "main" fork/stream. For example, the "resource fork" would be lost if file is copied from Mac-compatible partition to ext4.

    – Egor Skriptunoff
    2 days ago













  • Yes, maybe. But I can't believe that is not possible to load the file in Lua. The .suit file can be copied and sent per mail, just like any other normal file. Then why should it not be possible to load it byte by byte. I have also tried renaming it (changed suit to ttf), same result.

    – JAng
    2 days ago











  • The .suit file can be copied and sent per mail, just like any other normal file. Try to copy it on USB disk formatted as FAT32, and then check if "resource fork" remained of vanished.

    – Egor Skriptunoff
    2 days ago



















  • Is .suit file actually a folder, not a regular file?

    – Egor Skriptunoff
    2 days ago











  • It's not a folder though it can bundle several font files. I have only found this information: MacOS stores fonts in "resources" ( fontforge.github.io/macformats.html ), but this doesn't explain why I can open a .ttf, but not a .suit file. I have also found this tool ( stackoverflow.com/questions/7412462/… ) that can extract a .ttf from a .suit, but I am looking for a more direct solution to load the bytes of the .suit file.

    – JAng
    2 days ago













  • Probably, "resource fork" is something similar to an additional file stream on Windows. io.open reads only "main" fork/stream. For example, the "resource fork" would be lost if file is copied from Mac-compatible partition to ext4.

    – Egor Skriptunoff
    2 days ago













  • Yes, maybe. But I can't believe that is not possible to load the file in Lua. The .suit file can be copied and sent per mail, just like any other normal file. Then why should it not be possible to load it byte by byte. I have also tried renaming it (changed suit to ttf), same result.

    – JAng
    2 days ago











  • The .suit file can be copied and sent per mail, just like any other normal file. Try to copy it on USB disk formatted as FAT32, and then check if "resource fork" remained of vanished.

    – Egor Skriptunoff
    2 days ago

















Is .suit file actually a folder, not a regular file?

– Egor Skriptunoff
2 days ago





Is .suit file actually a folder, not a regular file?

– Egor Skriptunoff
2 days ago













It's not a folder though it can bundle several font files. I have only found this information: MacOS stores fonts in "resources" ( fontforge.github.io/macformats.html ), but this doesn't explain why I can open a .ttf, but not a .suit file. I have also found this tool ( stackoverflow.com/questions/7412462/… ) that can extract a .ttf from a .suit, but I am looking for a more direct solution to load the bytes of the .suit file.

– JAng
2 days ago







It's not a folder though it can bundle several font files. I have only found this information: MacOS stores fonts in "resources" ( fontforge.github.io/macformats.html ), but this doesn't explain why I can open a .ttf, but not a .suit file. I have also found this tool ( stackoverflow.com/questions/7412462/… ) that can extract a .ttf from a .suit, but I am looking for a more direct solution to load the bytes of the .suit file.

– JAng
2 days ago















Probably, "resource fork" is something similar to an additional file stream on Windows. io.open reads only "main" fork/stream. For example, the "resource fork" would be lost if file is copied from Mac-compatible partition to ext4.

– Egor Skriptunoff
2 days ago







Probably, "resource fork" is something similar to an additional file stream on Windows. io.open reads only "main" fork/stream. For example, the "resource fork" would be lost if file is copied from Mac-compatible partition to ext4.

– Egor Skriptunoff
2 days ago















Yes, maybe. But I can't believe that is not possible to load the file in Lua. The .suit file can be copied and sent per mail, just like any other normal file. Then why should it not be possible to load it byte by byte. I have also tried renaming it (changed suit to ttf), same result.

– JAng
2 days ago





Yes, maybe. But I can't believe that is not possible to load the file in Lua. The .suit file can be copied and sent per mail, just like any other normal file. Then why should it not be possible to load it byte by byte. I have also tried renaming it (changed suit to ttf), same result.

– JAng
2 days ago













The .suit file can be copied and sent per mail, just like any other normal file. Try to copy it on USB disk formatted as FAT32, and then check if "resource fork" remained of vanished.

– Egor Skriptunoff
2 days ago





The .suit file can be copied and sent per mail, just like any other normal file. Try to copy it on USB disk formatted as FAT32, and then check if "resource fork" remained of vanished.

– Egor Skriptunoff
2 days ago












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






JAng is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54252795%2fhow-can-i-access-a-suit-font-file-in-lua-macos-with-io-open-ttf-otf-works-fi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








JAng is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















JAng is a new contributor. Be nice, and check out our Code of Conduct.













JAng is a new contributor. Be nice, and check out our Code of Conduct.












JAng is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54252795%2fhow-can-i-access-a-suit-font-file-in-lua-macos-with-io-open-ttf-otf-works-fi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage