我正在将Lua 5.2中的.ttf / .otf字体文件阅读器从Windows转换为MacOS,并且还想增加对包含ttf字体的.suit字体文件的支持。
普通的.ttf / .otf文件现在可以正常工作,但是已经无法读取.suit文件。
关于如何在MacOS上读取.suit字体字节的任何想法? 它与文件名别名有关吗?
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)
上部(Tahoma)打印正确的第一个字节值0,而下部则不打印任何内容,尽管我希望值为0。
当我使用string.len(data)时,它显示的是Tahoma的正确值,而Maestro的显示为0,尽管应该是46k。
答案 0 :(得分:0)
请参见https://apple.stackexchange.com/questions/8455。suit不是文件夹,但可以像文件夹一样寻址。要打开.suit文件中的字体部分,请使用:
local file = io.open(“ / Library / Fonts / Maestro.suit / .. namedfork / rsrc”,“ rb”)