Hi Werner,

On Mon, 2025-09-08 at 06:02 +0000, Werner LEMBERG wrote:
> It seems that I have to do a brute-force approach by directly
> modifying `fonttable`.  My question is: How can I insert this data to
> the `fonttable` structure whenever the (unmodified)
> `EBGaramond-Regular.otf` gets loaded?  Is there a hook for that?

Something like the following should work (untested):

    local patch_functions = {}

    patch_functions["EBGaramond-Regular.otf"] = function(tfmdata)
        tfmdata.some_key = "some value"
    end

    luatexbase.add_to_callback(
        "luaotfload.patch_font",
        function(tfmdata, specification, font_id)
            local path = tfmdata.specification.filename
            local filename = file.basename(path)
            local patch_function = patch_functions[filename]

            if not patch_function then
                return
            end
            patch_function(tfmdata)
        end,
        "patch-fonts"
    )

Thanks,
-- Max

Reply via email to