[NTG-context] does font expansion break -char.width?

Pablo Rodriguez oinos at gmx.es
Sun May 17 21:06:53 CEST 2020


Dear list,

in this sample for underscore hyphenation (which comes from Hans), font
expansion breaks char.width and displaces the underscore:

    \startluacode
    function document.addfunnyhyphen(tfmdata)
        local underscore = utf.byte("_")
        local char       = tfmdata.characters[underscore]
        if not char then return end
        tfmdata.characters[0xFE000]   = {
            width    = 0,
            height   = 0,
            depth    = 0,
            commands = {
                { "right", -char.width },
                { "down", char.depth },
                { "slot", 1, underscore },
            }
        }
    end

    utilities.sequencers.appendaction("aftercopyingcharacters",
    "after","document.addfunnyhyphen")
    \stopluacode

        \definehyphenationfeatures
            [underscore]
            [righthyphenchar="FE000]

        \setuphyphenation
            [method=traditional]

    \unexpanded\def\sha#1%
       {\begingroup\tt
        \sethyphenationfeatures[underscore]%
        #1%
        \endgroup}

    \definefontfeature[default][default][expansion=quality]
    \setupalign[hanging, hz]

    \definefontfamily[mainface][tt][Cousine][scale=0.85]
    \setupbodyfont[mainface]
    \starttext
    \hsize\zeropoint
    \sha{\dorecurse{25}{asdfasdfasdfaeasfae}}
    \stoptext

I’m using latest from 2020.05.12 16:21.

Have I hit a bug or am I missing something?

Many thanks for your help,

Pablo
--
http://www.ousia.tk


More information about the ntg-context mailing list