Dear list,

I have been experiencing an issue with the new hyphenator for months (or
maybe almost a year), but it took me a while to discover what was
triggering it.

First, the mandatory sample:

    \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")

    local shared = {
        start  = 1,
        length = 1,
        before = utf.char(0xFE000),
        after  = nil,
        left   = false,
        right  = false,
    }

    local all = table.setmetatableindex({ }, function(t,k)
        return shared
    end)

    languages.hyphenators.traditional.installmethod("sha",
        function(dictionary,word,n)
            return all
    end
    )
    \stopluacode

    \definehyphenationfeatures
       [sha]
       [characters=all,
        alternative=sha,
        righthyphenchar="FE000]

    \unexpanded\def\sha#1%
       {\begingroup\tt
        \sethyphenationfeatures[sha]%
        \setuphyphenation[method=traditional]%
        #1%
        \endgroup}

    \showframe

    \starttext
         some sha
         \sha{8b984688efec2}.\par

         \sha{8b984688efec2}\hskip0pt.\par

         {\sha{8b984688efe3a}\hskip0pt.}\par
    \stoptext

Just in case you wonder, I need this to add SHA512 sums of attached
files to PDF documents. (I have mixed the code from different samples
that Hans gave me in replies to diverse questions.)

If I use the \sha command right before a point, I get:

- Only the first and the last character from the especially-hyphenated
text are formatted with the monospaced font. The other ones are
formatted with the Roman font.

- The point outside the command is formatted with the monospaced font,
instead of the Roman one.

- It might be possible that hyphenation could behave wrong in this case.

The simplest way to avoid the issue seems to be to use a zero-width space.

Have I hit an issue with the new hyphenator, or am I simply missing
somehting?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to