font-imp-compound.lmt /size: 1374 b    last modification: 2025-02-21 11:03
1if not modules then modules = { } end modules ['font-imp-compound'] = {
2    version   = 1.001,
3    comment   = "companion to font-ini.mkiv",
4    author    = "Hans Hagen, PRAGMA ADE",
5    copyright = "ConTeXt Development Team",
6    license   = "see context related readme files"
7}
8
9-- we can also make composed characters this way
10
11local compoundhyphen = fonts.helpers.newprivateslot("compoundhyphen")
12
13local function initialize(tfmdata,key,value)
14    if value then
15        local characters = tfmdata.characters
16        local hyphen     = characters[0x2D]
17        if hyphen then
18            local width = hyphen.width
19            if width then
20                characters[compoundhyphen] = {
21                    width    = 1.5*width,
22                    height   = hyphen.height,
23                    depth    = hyphen.depth,
24                    unicode  = hyphen.unicode,
25                    callback = "compile", -- needs documentation
26                    commands = {
27                        { "char", 0x2D },
28                        { "left", width/2 },
29                        { "char", 0x2D }
30                    },
31                }
32            end
33        end
34    end
35end
36
37fonts.handlers.otf.features.register {
38    name         = "compoundhyphen",
39    description  = "compoundhyphen",
40    manipulators = {
41        base = initialize,
42        node = initialize,
43    }
44}
45