% language=us runpath=texruns:manuals/fonts

\startenvironment fonts-environment

    % we need to do this beforehand

    \blockligatures[fi,fl,ff]

    \startbuffer[extraminus]
    \startluacode
        fonts.helpers.addextraprivate("smallminus", function(tfmdata)
            local hchar = tfmdata.characters[0x002D]
            local mchar = tfmdata.characters[0x2212]
            if hchar and mchar then
                return {
                    width    = hchar.width,
                    height   = mchar.height,
                    commands = {
                        { "down", hchar.height - mchar.height },
                        { "char", 0x002D },
                    }
                }
            end
        end)
        fonts.helpers.addextraprivate("highminus", function(tfmdata)
            local hchar = tfmdata.characters[0x002D]
            local mchar = tfmdata.characters[0x2212]
            local xchar = tfmdata.characters[0x0058]
            if hchar and mchar and xchar then
                return {
                    width    = hchar.width,
                    height   = mchar.height,
                    commands = {
                        { "down", - xchar.height + mchar.height },
                        { "char", 0x002D },
                    }
                }
            end
        end)
    \stopluacode
    \stopbuffer

    \getbuffer[extraminus]

    % so far for preloading

    \environment manuals-explaining-environment
    \environment manuals-explaining-cover

    \enabledirectives[visualizers.fraction=2]

    \usemodule [s] [fonts-tables]
    \usemodule [s] [fonts-missing]
    \usemodule [s] [fonts-vectors]
    \usemodule [s] [fonts-features]
    \usemodule [s] [math-extensibles]

    \definefontfeature[demo-onum][kern=yes,onum=yes]
    %definefontfeature[demo-lnum][kern=yes,lnum=yes]
    \definefontfeature[demo-tnum][kern=yes,tnum=yes]
    \definefontfeature[demo-pnum][kern=yes,pnum=yes]
    \definefontfeature[demo-zero][zero=yes]
    \definefontfeature[demo-none][]

    \definefont[DemoOnumLM][file:lmroman10-regular*demo-onum at 42pt]
    %definefont[DemoLnumLM][file:lmroman10-regular*demo-lnum at 42pt]
    \definefont[DemoTnumLM][file:lmroman10-regular*demo-tnum at 42pt]
    \definefont[DemoPnumLM][file:lmroman10-regular*demo-pnum at 42pt]

    \definefont[DemoZeroLM][file:lmroman10-regular*demo-zero at 42pt]
    \definefont[DemoNoneLM][file:lmroman10-regular*demo-none at 42pt]

    \definefont[DemoZeroLT][file:lmtypewriter10-regular*demo-zero at 42pt]
    \definefont[DemoNoneLT][file:lmtypewriter10-regular*demo-none at 42pt]

\stopenvironment
