Skip to content

Commit

Permalink
Merge pull request #735 from henryso/fix-734
Browse files Browse the repository at this point in the history
Applied the lazy-load workaround for compatibility with luaotfload 2.6.
  • Loading branch information
henryso committed Dec 29, 2015
2 parents 013e92f + 9048b1b commit 2ddc954
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tex/gregoriotex-nabc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@ 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
-- 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", "~")
Expand Down

0 comments on commit 2ddc954

Please sign in to comment.