Hi, On Sun, Aug 08, 2021 at 12:19:36PM +0200, luigi scarso wrote:
Patch is now ok, but I am perplexed by this line
- run_callback(callback_id, "ddd->L", tex_font, g->gd[i].gid, streamprovider, &result); + run_callback(callback_id, "ddd->L", tex_font, g->gd[i].gid, 2, &result);
It's not clear why now we use 2.
Basically this call is always compatible with the call made if the streamprovider were 2, so 2 is passed to differentiate it from the second call which actually provides behavior specific to streamprovider 3 and therefore uses streamprovider 3. We could also do this differently, e.g. by letting the Lua code determine it automatically by looking at the number of arguments passed to the callback or using different callback names, but since I would assume that most implementations would want to treat the callback from streamprovider 2 and the streamprovider 2 compatible call from streamprovider 3 identically anyway I considered this nicer.
Perhaps it's better to introduce another variable, i.e. int actual_streamprovider ; if actual_streamprovider>2 { actual_streamprovider=2; } run_callback(callback_id, "ddd->L", tex_font, g->gd[i].gid, actual_streamprovider, &result);
Or add a comment before , something like /* The streamprovider here is always 2 because... */
Suggested comment: /* The streamprovider here is always 2, even when we actually have streamprovider == 3, to differentiate this call which behaves exactly like the call in the streamprovider == 2 case from the streamprovider == 3 specific call earlier. */ Best regards, Marcel
-- luigi
_______________________________________________ dev-luatex mailing list dev-luatex@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-luatex