[luatex] virtual font example from the documentation

luigi scarso luigi.scarso at gmail.com
Sun Nov 2 15:16:53 CET 2014


On Sun, Nov 2, 2014 at 11:19 AM, Herbert Voss <Herbert.Voss at fu-berlin.de>
wrote:

> 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
>
No seg fault with luatex  experimental
$ luatex --version
This is LuaTeX, Version beta-0.79.2 (TeX Live 2015/dev)


-- 
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20141102/3f4ada8f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 27812 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20141102/3f4ada8f/attachment-0001.pdf>


More information about the luatex mailing list