[NTG-context] Using virtual fonts defined with lua-code

Hans Hagen pragma at wxs.nl
Tue Feb 8 17:07:39 CET 2011


On 8-2-2011 3:46, Khaled Hosny wrote:
> On Tue, Feb 08, 2011 at 03:13:11PM +0100, Hans Hagen wrote:
>> On 8-2-2011 10:40, Ulrike Fischer wrote:
>>> Hello,
>>>
>>> The luatex documentation contains in section "7.2.2 Example virtual
>>> font" an example how to define a virtual font "cmr10-red". The font
>>> is defined by adding the code to the define_font callback.
>>>
>>> Does some interface exists in contex/mkiv which allows to use such
>>> virtual fonts together with the normal font loading code? E.g. could
>>> I move the code for the font to some file ("cmr10-red.vflua") so
>>> that a request \font\mytest="cmr10-red" will simply find this file
>>> and use the code like vf, tfm or otf-files are found and used when
>>> needed?
>>
>> It's relatively easy to add support for that. However, when I've
>> done that Khaled has to make sure that it also works in his wrapper
>> code as I don't know to what extend he overloads code. I can only
>> test in the plain variant and context.
>
> I keep it as minimal as possible (I've even some "feature requests" to
> keep our local changes more smaller, but no time to check it now).

You only need to load one extra file:

     loadmodule('font-lua.lua')

Then, if

   \font\mine=file:luatex-fonts-demo-vf-1.lua at 12pt

   \mine \input tufte \par

works ok, you're fine, otherwise you can delay integration. As lua 
lookup is not part of any font scheme best use an explicit suffix (the 
file: is not mandate, at least not in context).

It's anyway the user's responsibility to return a proper tfm table so no 
one can bother us about it not working as expected -)

(For context users there is actually some more virtual building code but 
as it's somewhat experimental I will clean that up before documenting it.)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: virtual-001.pdf
Type: application/pdf
Size: 22580 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20110208/d261ed2e/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: virtual-001.tex
Type: text/x-tex
Size: 106 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20110208/d261ed2e/attachment-0001.tex>


More information about the ntg-context mailing list