[Dev-luatex] Minimal example of using OTF/TTF?

Hans Hagen pragma at wxs.nl
Fri Apr 6 20:28:25 CEST 2007

Geoffrey Alan Washburn wrote:
> There is probably a really simple answer to this, but what is the 
> current method for loading OpenType/TrueType fonts in luatex?  I've 
> tried a few things that do not appear to work, and I haven't been able 
> to find any complete examples of how to do so.
> \pdfoutput=1
> \font\myfont={Vera.ttf}  % This doesn't work
> %\font\myfont={cmr10} % This does work
> {\myfont Testing}
> \end
> % luatex --fmt=plain foo.tex
> This is luaTeX, Version 3.141592-snapshot-2007040613 (Web2C 7.5.6)
> (foo.tex
> ! Font \myfont=Vera.ttf not loadable: Metric (TFM/OFM) file not found 
> or bad.
> <to be read again>
>                   \par
> l.4
you need to define a callback (define_font) that 

(1) loads the open type font 
(2) create a tfm-line table using this data
(3) returns this table 

the manual mentions this but the mapping is upto yourself. 

Open type support is somewhat experimental. We have plans to 
provide a few helper functions that will make this mapping easy and convenient. 

Luatex will provide the means, but the support for open type and esp features will be up to the macro package. The main reason for this is that each macro package does things different, users may want to have control, etc. etc. and there hardly any common ground. 

Hardcoding open type support is not on the agenda because this contradicts the luatex way. Luatex only provide the machinery. 

XeTeX on the other hand uses libraries and supports open type out of the box but does not provide the detailed control that LuaTeX will give. Somewhere next year we expect macro packages to have support for luatex and open type. 


Ps. When there is enough interest in this, I can provide lua code for the basic mapping. I have plans to write some code for plain tex but will do that once we're sure that the things work as we expect (derived from code used in ConTeXt) 

                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl

More information about the dev-luatex mailing list