From ce0d4aa5bf93782eca7e03e281f9122873e072c6 Mon Sep 17 00:00:00 2001 From: "Henry So, Jr." Date: Mon, 28 Dec 2015 18:36:22 -0500 Subject: [PATCH 1/2] Applied the lazy-load workaround for compatibility with luaotfload 2.6. Fixes #734. --- tex/gregoriotex-nabc.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tex/gregoriotex-nabc.lua b/tex/gregoriotex-nabc.lua index 7365225bb..f21083a1f 100644 --- a/tex/gregoriotex-nabc.lua +++ b/tex/gregoriotex-nabc.lua @@ -71,6 +71,15 @@ local function gregallreadfont(font_id) local tab = {} local metrics = {} local fontdata = fonts.hashes.identifiers[font_id] + -- The unicodes table may be lazy-loaded, so iterating it may not + -- return everything. Attempting to retrieve the code point of a + -- glyph that has not already been loaded will trigger the __index + -- method in the metatable (implemented by the fontloader) to load + -- the table until the glyph is found. When iterating the + -- unicodes, we want the whole table to be filled, so we try to + -- access a non-existing glyph in order to force load the entire + -- table. + local ignored = fontdata.resources.unicodes['_this_is_hopefully_a_nonexistent_glyph_'] for key, value in pairs(fontdata.resources.unicodes) do local g = fontdata.characters[value] local name = key:gsub("B", ">"):gsub("N", "-"):gsub("E", "!"):gsub("T", "~") From 2c4615151cb6508fb0262289daa0ca87715ed457 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Tue, 29 Dec 2015 10:14:11 +0100 Subject: [PATCH 2/2] don't access fonts.hashes.identifiers --- tex/gregoriotex-nabc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tex/gregoriotex-nabc.lua b/tex/gregoriotex-nabc.lua index f21083a1f..639579afe 100644 --- a/tex/gregoriotex-nabc.lua +++ b/tex/gregoriotex-nabc.lua @@ -70,7 +70,7 @@ local gregallaliases = { local function gregallreadfont(font_id) local tab = {} local metrics = {} - local fontdata = fonts.hashes.identifiers[font_id] + local fontdata = font.getfont(font_id) -- The unicodes table may be lazy-loaded, so iterating it may not -- return everything. Attempting to retrieve the code point of a -- glyph that has not already been loaded will trigger the __index