>> With
>>
>> ```
>> f = fontloader.open("EBGaramond-Regular.otf")
>> fonttable = fontloader.to_table(f)
>> ```
>>
>> the OTF file modified as described contains the following data
>> added to `fonttable.glyphs[741]` (which is for glyph `uni0364`):
>>
>> ```
>> ["anchors"] = {
>> ["mark"] = {
>> ["Anchor-0"] = {
>> ["x"] = 115,
>> ["y"] = 440,
>> ["lig_index"] = 0 }
>> }
>> },
>> ["class"] = mark,
>> ```
>>
>> 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! However, how can I access the `glyphs` table via `tfmdata`?
Or do I have to manipulate another structure? I looked into
`tfmdata.resources.sequences[50].steps[1].coverage[868]`, but this is
much more low-level and quite ugly to work with IMHO since I have to
explicitly compute the offsets between the base glyph and the
diacritic...
Werner