font-imp-checks.lmt /size: 1203 b    last modification: 2025-02-21 11:03
1if not modules then modules = { } end modules ['font-imp-checks'] = {
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
9if not context then return end
10
11local function manipulate(tfmdata,key,value)
12    if key and value then
13        local characters = tfmdata.characters
14        if not characters[0x2012] then
15            local data = characters[0x2013]
16            local zero = characters[0x0030]
17            if data and zero then
18                local copy  = table.copy(data)
19                local width = zero.width or 0
20                if width > 0 then
21                    characters[0x2012] = copy
22                    copy.effect = {
23                        extend = width/copy.width
24                    }
25                    copy.unicode = 0x2012
26                    copy.width = width
27                end
28            end
29        end
30    end
31end
32
33fonts.handlers.otf.features.register {
34    name        = "checkmissing",
35    description = "checkmissing",
36    manipulators = {
37        base = manipulate,
38        node = manipulate,
39    }
40}
41
42