29.05.2014 Views

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong>refore, it will be no surprise that LuaTEX does not simply implement the OpenType<br />

specication as such. On the one hand it implements a way to load information stored in<br />

the font, on the other hand it implements mechanisms to fulll the demands <strong>of</strong> such fonts<br />

and more. <strong>The</strong> glue between both is done with Lua. In the simple case <strong>of</strong> ligatures and<br />

kerns this goes as follows. A user (or macropackage) specied a font, and this call can be<br />

intercepted using a callback. This callback can use a built in function that loads an otf or ttf<br />

font. From this table, a font table is constructed that is passed on to TEX. <strong>The</strong> construction<br />

may involve building ligature and kerning tables using the information present in the font<br />

le, but it may as well mean more. So, given a bare LuaTEX system, OpenType font support<br />

is not giving you automatically handling <strong>of</strong> features, or more precisely, there is no hard<br />

coded support for features.<br />

This may sound as a disadvantage but as soon as you start looking at how TEX users use<br />

their system (in most cases by using a macro package) you may understand that exibility<br />

is larger this way. Instead <strong>of</strong> adding more and more control and exceptions, and thereby<br />

making the kernel more instable and complex, we delegate control to the macro package.<br />

<strong>The</strong> advantage is that there are no (everlasting) discussions on how to deal with<br />

things and in the end the user will use a high level interface anyway. Of course the macro<br />

package needs proper access to the font's internals, but this is provided: the code used<br />

for reading in the data comes from FontForge (an advanced font editor) and is presented<br />

via Lua tables in a well organized way.<br />

Given that users expect OpenType features to be supported, how do we provide an interface.<br />

In ConTEXt the user interface has always be an important aspect and consistency is<br />

a priority. On the other hand, there has been the tradition <strong>of</strong> specifying the size explicity<br />

and a new custom introduced by X TEX to enhance fontname with directives. Traditional<br />

TEX provides:<br />

\font \name filename [optional size]<br />

X TEX accepts<br />

E<br />

E<br />

\font \name "fontname[:optional features]" [optional size]<br />

\font \name fontname[:optional features] [optional size]<br />

Instead <strong>of</strong> a fontname one can pass a lename between square brackets. LuaTEX handles:<br />

\font \name anything [optional size]<br />

\font \name {anything} [optional size]<br />

where anything as well as the size are passed on to the callback.<br />

This permits us to implement a traditional specication, support X TEX like denitions, and<br />

easily pass information from a macro package down to the callback as well. Interpreting<br />

anything is done in Lua.<br />

E<br />

36 A fresh look at fonts

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!