[luatex] Loading fonts from within LuaTeX

Robert Krug destiny6 at mac.com
Fri Feb 19 00:55:45 CET 2021


Greetings,



Given the following Lua fragment:



==========



xxx = fonts.definers.read("drm10.otf:mode=base;liga=false;kern=false;", tex.sp("10pt"))
x = font.define(xxx)
font.current(x)
print()
print("Current font: " .. font.current())
print()
print("font.fonts[font.current()] does work:")
print(font.fonts[font.current()])
print()
print("But font.getfont doesn't work.")
print(font.getfont(font.current()))



==========



I get the following output:



==========



system : loading luc file '/home/<name>/.texlive2020/texmf-var/luatex-cache/gene
ric/fonts/otl/drm10.luc'
Current font: 65

font.fonts[font.current()] does work:
table: 0x938bd4cc080

But font.getfont doesn't work.
nil



==========



Is there a better way to load a font from withing Lua code?

I assume that this has something to do with this note:



Also note the following: assignments can only be made to fonts that have already been defined
in TEX, but have not been accessed at all since that definition.



since I have not defined anything from within TeX. Should I just use the font.fonts table, instead of font.getfont()? Or am I doing something else wrong?



I am using:

This is LuaTeX, Version 1.12.0 (TeX Live 2020-OpenBSD_Ports)
with the luatex-plain format. I built this format after moving the "merged" files as the warnings suggested on the first attempt, so I believe I am using the more current, supported files.



Many Thanks for all your work and the LuaTeX system,

Robert


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20210218/63bcd6ec/attachment.html>


More information about the luatex mailing list.