Allow skippig the font cache in font.getfont
Hello, could font.getfont get an option to always return a new font table instead of returning the current one? While for many fonts a cached table makes sense, sometimes it would be useful to also have access to the ooriginal table, e.g. to see which characters are `used`, inspect the result of `font.addcharacters` or inspect other changes which might be applied to the underlying font from TeX. I attached a patch implementing this by adding a `nocache` parameter to `font.getfont`, such that `font.getfont(true, font_id)` always generates a new table. IMO `font.getfont(font_id, true)` would look nicer, but that wouldn't be compatible to older LuaTeX versions which always expect the font is as last parameter. Best regards, Marcel
Hello,
could font.getfont get an option to always return a new font table instead of returning the current one? While for many fonts a cached table makes sense, sometimes it would be useful to also have access to the ooriginal table, e.g. to see which characters are `used`, inspect the result of `font.addcharacters` or inspect other changes which might be applied to the underlying font from TeX.
I attached a patch implementing this by adding a `nocache` parameter to `font.getfont`, such that `font.getfont(true, font_id)` always generates a new table. IMO `font.getfont(font_id, true)` would look nicer, but that wouldn't be compatible to older LuaTeX versions which always expect the font is as last parameter. For such a feature I prefer "font.getcopy(id)". I'll add it to my todo
On 12/12/2019 2:06 PM, Marcel Fabian Krüger wrote: list. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Marcel Fabian Krüger