On 9/25/2018 9:33 PM, Marcel Krüger wrote:
Hi,
while looking into a [luaotfload bug][bug] caused by the fontloader
being confused when LuaTeX overwrites the `parameters` in a
cached font table, I wondered why `write_lua_parameters` always
creates a new table instead of altering a potentially preexisting table.
Changing this should lead to some small performance improvement
because Lua no longer has to create a new table every time a cached
font table is queried and more importantly it allows additional string
keys in `parameters` to be preserved.
sounds more like an issue of luaotfload ... it should manage the
parameters well
we're not going to change the current behaviour in the engine which is
creating these tables (same for math constant etc) from mem (changing
such things might solve your specific issue but introduce issues for
others)
Hans
Best regards
Marcel
[bug]: https://github.com/u-fischer/luaotfload/issues/3
A patch implementing the suggested change:
---
source/texk/web2c/luatexdir/font/luafont.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/source/texk/web2c/luatexdir/font/luafont.c
b/source/texk/web2c/luatexdir/font/luafont.c
index e64aaffc1..68e74ffc5 100644
--- a/source/texk/web2c/luatexdir/font/luafont.c
+++ b/source/texk/web2c/luatexdir/font/luafont.c
@@ -349,7 +349,11 @@ static void write_lua_parameters(lua_State * L, int f)
{
int k;
lua_push_string_by_name(L,parameters);
- lua_newtable(L);
+ lua_pushvalue(L, -1);
+ if (LUA_TNIL == lua_rawget(L, -3)) {
+ lua_pop(L, 1);
+ lua_newtable(L);
+ }
for (k = 1; k <= font_params(f); k++) {
switch (k) {
case slant_code:
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-luatex