On Wed, Oct 23, 2019 at 3:00 PM Marcel Fabian Krüger <tex@2krueger.de> wrote:
Hey,

in `writefont0.c` and `writefont2.c`, `ff_get_ttc_index` is called to
determine the index of the font in a font collection. This uses the
original filename from fd->fm->ff_name and therefore does not respect
lookups done using the find_opentype_file etc. callbacks.

In writefont0.c, this could be fixed relativly easily by passing using
cur_file_name, the name after the callback, instead. But even than there
are remianing problems because this still wouldn't respect
read_..._file callbacks. So implementing this correctly is quite tricky
and it also isn't really necessary in most cases: Especially when using
Lua-loaded fonts, the code creating the font needs to know the index
anyway. So maybe an approach like in Khaled Hosny's HarfTeX could be
used: Allow a Lua-loaded font to explicitly set the index and only use
ff_get_ttc_index if this index isn't set. Then backward-compatibility is
kept but the actually used index selection can be influenced using Lua.
(HarfTeX implemented this in
https://github.com/khaledhosny/harftex/commit/caded3e80f106687c84f9613aa318cb3023a1422)

done in  revision 7222 by Hans.

 
--
luigi