Hi Werner,
On Tue, 2025-09-16 at 08:02 +0000, Werner LEMBERG wrote:
> > Attached is an improved version.
>
> As usual: right after sending an improved version I find a problem :-)
>
> The old version only checked the first lookup of a 'mark' feature;
> this is now fixed.
Looks good to me. One other tip is that you can fake a "continue"
statement with "goto", which will let you reduce the amount of nested
"if"s:
for _, step in ipairs(sequence.steps) do
local coverage = step.coverage
if not coverage then
goto continue
end
local coverage_mark = coverage[uni_mark]
if not coverage_mark then
goto continue
end
mark_glyph_in_coverage = true
local coverage_base = coverage_mark[1][uni_base]
if not coverage_base then
goto continue
end
base_glyph_in_coverage = true
for i, baseclass in ipairs(step.baseclasses) do
if baseclass[uni_base] then
report("log", 0, "add_to_mark",
"found base-mark glyph combination '%s+%s'"
.. " in 'mark' feature of font '%s'",
base, mark, filename)
-- Report OpenType value for anchor class, not
-- the one used in luatex.
report("log", 0, "add_to_mark",
"adding glyph '%s' to anchor class %d",
acc, i - 1)
coverage[uni_acc] = {baseclass, {x, y}}
return
end
end
::continue::
end
Another suggestion is to use a more descriptive name for your
"luaotfload.patch_font" callback, since "patch-fonts" isn't the most
informative. "add-to-mark" would probably be a good name.
But otherwise, this looks great.
Thanks,
-- Max