main.lua:
Code: Select all
local mainFont = love.graphics.newFont("Helvetica.ttc", 10)
local mainFontHasGlyphs = mainFont:hasGlyphs("👋")
print("Helvetica has waving hand sign: ", mainFontHasGlyphs) -- prints "false", which is expected
local emojiFont = love.graphics.newFont("Apple Color Emoji.ttc", 10)
local emojiFontHasGlyphs = emojiFont:hasGlyphs("👋")
print("Apple Color Emoji has waving hand sign: ", emojiFontHasGlyphs) -- prints "true", which is expected
function love.draw()
love.graphics.setFont(mainFont)
love.graphics.print("Hello world!", 100, 200)
love.graphics.setFont(emojiFont)
love.graphics.print("👋", 100, 300) -- this causes the error shown below.
end
The files "Helvetica.ttc" and "Apple Color Emoji.ttc" are copied from "/System/Library/Fonts/" (macOS) into the same folder as main.lua (source: https://apple.stackexchange.com/a/214659).
The main.lua file is saved with the encoding UTF-8 without BOM.
Running the program results in the following error:
Code: Select all
Helvetica has waving hand sign: false
Apple Color Emoji has waving hand sign: true
Error: main.lua:15: TrueType Font glyph error: FT_Load_Glyph failed (0x7)
stack traceback:
[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
[C]: in function 'print'
main.lua:15: in function 'draw'
[string "boot.lua"]:618: in function <[string "boot.lua"]:594>
[C]: in function 'xpcall'
Code: Select all
local notoFont = love.graphics.newFont("NotoColorEmoji.ttf", 10) -- results in an error with and without the size parameter
Code: Select all
Error: TrueType Font loading error: FT_Set_Pixel_Sizes failed: 0x17 (invalid size?)
stack traceback:
[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
[C]: at 0x010b587b60
[C]: in function 'newFont'
main.lua:2: in main chunk
[C]: in function 'require'
[string "boot.lua"]:570: in function <[string "boot.lua"]:380>
[C]: in function 'xpcall'
[string "boot.lua"]:787: in function <[string "boot.lua"]:780>
[C]: in function 'xpcall'