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.

<strong>of</strong> them. Each lookup has a detailed specication <strong>of</strong> what language and/or scripts it<br />

applies to.<br />

• For each lookup we do a run over the list <strong>of</strong> glyphs. So, if we have 50 lookups, and a<br />

paragraph has 500 glyphs, we do some 25000 loops. Keep in mind that for arab we<br />

start with a sequence <strong>of</strong> characters and vowels, and during a run, these might be replaced<br />

by for instance ligatures and combined vowels, so the 500 stepwise becomes<br />

less.<br />

• We only process the features that are enabled. Normally the lookups are organized<br />

in such a way that features take place in a similar way: (de)composition, replacement<br />

<strong>of</strong> initial, medial, nal and isolated forms, specic replacements by one or more variant,<br />

composition <strong>of</strong> ligatures, mark positioning, cursive corrections and kerning. <strong>The</strong><br />

font itself does not contain information about what features are to be enabled by default.<br />

Some applications have built in presets, others might extend their repertoire<br />

over time.<br />

• A lookup can be a contextual lookup, which means that treatment takes place on a<br />

match <strong>of</strong> a sequence <strong>of</strong> characters (glyphs), either <strong>of</strong> not preceded or followed by<br />

specic other characters (glyphs). We we loop over all contexts till we have a match.<br />

Some fonts have lots <strong>of</strong> contextual lookups, which in turn might increase the number<br />

<strong>of</strong> loops over the list <strong>of</strong> characters (glyphs). If we have a match, we process the<br />

associated list <strong>of</strong> sublookups. Technically it is possible to replace (say) ve characters<br />

by rst a ligature (that replaces the rst two by one), then a multiple substitution<br />

(resulting in an extra three glyphs replacing one) and then discarding the other rest<br />

(being two characters). Because by that time characters (say, unicode points) might<br />

have been replaced by glyphs (an index in the font) a contextual lookup can involve<br />

quite some match points.<br />

In ConTEXt we do this for each font that is used in a list, so in practice we have quite some<br />

nested loops. Each font can have its own set <strong>of</strong> features enables <strong>of</strong> features might be<br />

applied dynamically, independent <strong>of</strong> font related settings. So, around the mentioned<br />

loops there is another one: a loop over the fonts used in a list (paragraph).<br />

We process the whole list and then consult the glyph nodes. An alternative approach is to<br />

collect strings <strong>of</strong> characters using the same font including spaces (because some lookups<br />

involve spaces). However, we then need to reconstruct the list which is no fun. Also, we<br />

need to carry quite some information, like attributes, so eventually we don't gain much<br />

(if we gain something at all).<br />

Another consideration has been to operate on sublists <strong>of</strong> font usage (using a subhead<br />

and subtail) but again this would complicate matters as we then neext to keep track <strong>of</strong><br />

a changing subhead and subtail. On the other hand, this might save some runtime. <strong>The</strong><br />

250 Tracking

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

Saved successfully!

Ooh no, something went wrong!