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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

XXVII Virtual Reality<br />

When a font lacks glyphs we can add new ones by making the font virtual. A virtual font<br />

has virtual glyphs: instead <strong>of</strong> a reference to a slot in the current font, such a glyph refers<br />

to a slot in another font, or it combines several glyphs into one, or it just contains code<br />

that ends up in the result (for instance a sequence <strong>of</strong> pdf commands that describes the<br />

shape). For TEX a character and its dimensions are what matters and what ends up in the<br />

result is mostly a matter for the backend. In LuaTEX the backend is integrated but even<br />

then during the typesetting process only the characteristics <strong>of</strong> a glyph are used and not<br />

the shape.<br />

In ConTEXt we have a feature called ‘compose’ which extends the font with extra characters<br />

and constructs its representation from those <strong>of</strong> other characters.<br />

\definefontfeature<br />

[composes]<br />

[kern=yes,ligatures=yes,compose=yes]<br />

When this feature is applied, ConTEXt will try to ll in the gaps in the Unicode vector <strong>of</strong><br />

the font based on for instance (de)composition information. Of course this has some limitations.<br />

For instance OpenType fonts can ships with features, like smallcaps. Currently<br />

we ignore this property when we add composed characters. Technically it is no big deal<br />

to add variants but we simply didn't do it yet at the time <strong>of</strong> this writing. After all, such<br />

fallbacks can best be avoided by using proper fonts.<br />

Our ConTEXt MkIV wishlist mentions a mechanism for combining fonts into one font. For<br />

this we can use virtual fonts and the machinery for that is in available in Lua code. However<br />

such a mechanism will be used for more drastic completion <strong>of</strong> a font than the compose<br />

feature. For instance, <strong>of</strong>ten Chinese fonts lack proper Latin glyphs and vise versa.<br />

But when we combine such fonts we really do want to keep OpenType features working<br />

and so we cannot use virtual fonts (unless we start merging features which can become<br />

really messy and runtime consuming).<br />

<strong>The</strong>re is a relative simple solution using real fonts that kind <strong>of</strong> behave like virtual ones:<br />

virtual real fonts. <strong>The</strong> trick is in the fact that TEX permits access to characters not present<br />

in the font. Say that we have<br />

<br />

and that slot 124 has no glyph. In that case TEX just inserts a glyph node with a reference<br />

to the current font and this character. Of course, when we let TEX carry on, at some point<br />

it will need glyph properties like the width, height and/or depth. And in the backend,<br />

Virtual Reality 233

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

Saved successfully!

Ooh no, something went wrong!