font-lig.lmt /size: 1097 b    last modification: 2024-01-16 10:22
1if not modules then modules = { } end modules ['font-lig'] = {
2    version   = 1.001,
3    comment   = "companion to font-ini.mkiv",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files",
7}
8
9-- We keep this for compatibility reasons and demonstration purposes. We delay
10-- definition of the data table in order to save some memory.
11
12-- data['c'] = { 'a', 'b' }
13-- data['d'] = { 'c', 'c' }
14
15local next = next
16local setmetatableindex = table.setmetatableindex
17
18local data = { }
19
20setmetatableindex(data,function(t,k)
21    for first, seconds in next, characters.graphemes do
22        for second, combined in next, seconds do
23            data[combined] = { first, second }
24        end
25    end
26    setmetatableindex(data)
27    return t[k]
28end)
29
30local feature = {
31    name    = "collapse",
32    type    = "ligature",
33    prepend = true,
34    dataset = {
35        { data = data }, -- twice ?
36        { data = data },
37    }
38}
39
40-----.handlers.afm.addfeature(feature)
41fonts.handlers.otf.addfeature(feature)
42