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.

when writing the result to le, TEX wants to insert the glyph data in the le. In both cases<br />

we end up with a message in the log le and a result le with missing data.<br />

In ConTEXt MkIV we intercept the node lists at several points and one <strong>of</strong> those is directly<br />

after the construction. So let's consider the previous example again.<br />

<br />

Because the font has no character 124 we need a way to substitute it with another character.<br />

All we have to do is to change the font identier 32 into one that makes sense. Such<br />

a replacement loop is kind <strong>of</strong> trivial.<br />

for n in traverse_id(glyph,head) do<br />

local v = vectors[n.font]<br />

if v then<br />

local id = v[n.char]<br />

if id then<br />

n.font = id<br />

end<br />

end<br />

end<br />

We have a table (vectors) that can have a subtable (v) for font with id (n.font) in which<br />

there can be a reference from the current character (n.char) to another font (id) that we<br />

use to replace the font reference (n.font).<br />

Filling the table is relatively easy but an explanation is beyond this chapter. We only show<br />

the high level interface, one that certainly will evolve.<br />

\definefontfallback<br />

[SerifFallback]<br />

[Mono]<br />

[0x000-0x3FF]<br />

[check=yes,force=no]<br />

This command registers an entry in the SerifFallback namespace. <strong>The</strong>re can be multiple<br />

replacement in row (by just using more <strong>of</strong> these commands), but here we have only<br />

one. <strong>The</strong> range 0x000–0x3FF will be checked and if the main font lacks a glyph in that<br />

range, it will be taken from the font with the symbolic name Mono. That name will be resolved<br />

when the fallback is associated with a font. <strong>The</strong> check option tells the machinery<br />

that we need to check for existence and because we don't force, we will only replace<br />

missing glyphs. <strong>The</strong>re is also an rscale option, that permits relative scaling <strong>of</strong> the fallback<br />

font to the main font, something that may be needed when fonts come from different<br />

sources.<br />

234 Virtual Reality

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

Saved successfully!

Ooh no, something went wrong!