[luatex] virtual font example from the documentation
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Sun Nov 2 11:19:35 CET 2014
This is an example from the LuaTeX documentation (pp 166--167)
which works well in the past.
\directlua {
callback.register('define_font',
function (name,size)
if name == 'cmr10-red' then
f = font.read_tfm('cmr10',size)
f.name = 'cmr10-red'
f.type = 'virtual'
f.fonts = {{ name = 'cmr10', size = size }}
for i,v in pairs(f.characters) do
if (string.char(i)):find('[tacohanshartmut]') then
v.commands = {{'special','pdf: 1 0 0 rg'},{'char',i},{'special','pdf:
0 g'},}
else
v.commands = {{'char',i}}
end
end
else
f = font.read_tfm(name,size)
end
return f
end)
}
\font\myfont = cmr10-red at 10pt \myfont This is a line of text \par
\font\myfontx= cmr10 at 10pt \myfontx Here is another line of text
\bye
But with current up-to-date TeXLive I get a segmentation fault:
This is LuaTeX, Version beta-0.79.1 (TeX Live 2014/dev) (rev 4972)
restricted \write18 enabled.
(./vfont.texSpeicherzugriffsfehler
[ ... ]
or at least a wrong output, the character table is missing:
voss at shania:~/tmp> luatex vfont.tex
This is LuaTeX, Version beta-0.79.1 (TeX Live 2014/dev) (rev 4972)
restricted \write18 enabled.
(./vfont.tex
LuaTeX warning: lua-loaded font [51] (cmr10-red) has no character table!
[1{/usr/local/texlive/2014/texmf-var/fonts/map/pdftex/updmap/pdftex.map}])
(see the transcript file for additional
information)<</usr/local/texlive/2014/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on vfont.pdf (1 page, 13026 bytes).
Transcript written on vfont.log.
---------------------------------------------------------------------
If I use the updated callback syntax:
\input luatexbase.sty
\directlua {
luatexbase.add_to_callback('define_font',
function (name,size)
[ ... ]
----------------------------------------------------------------------
then I always get a segmentation fault.
Can someone confirm this behaviour?
Herbert
More information about the luatex
mailing list