ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* bug with special hyphenation?
@ 2018-02-08 19:00 Pablo Rodriguez
  2018-02-08 23:03 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Rodriguez @ 2018-02-08 19:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug with special hyphenation?
  2018-02-08 19:00 bug with special hyphenation? Pablo Rodriguez
@ 2018-02-08 23:03 ` Hans Hagen
  2018-02-09 16:03   ` Pablo Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2018-02-08 23:03 UTC (permalink / raw)
  To: ntg-context

On 2/8/2018 8:00 PM, Pablo Rodriguez wrote:

> Have I hit an issue with the new hyphenator, or am I simply missing
> somehting?
it's a border case that i'll look into

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug with special hyphenation?
  2018-02-08 23:03 ` Hans Hagen
@ 2018-02-09 16:03   ` Pablo Rodriguez
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Rodriguez @ 2018-02-09 16:03 UTC (permalink / raw)
  To: ntg-context

On 02/09/2018 12:03 AM, Hans Hagen wrote:
> On 2/8/2018 8:00 PM, Pablo Rodriguez wrote:
> 
>> Have I hit an issue with the new hyphenator, or am I simply missing
>> somehting?
> 
> it's a border case that i'll look into

Many thanks for your fast fix in latest beta, Hans.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-09 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 19:00 bug with special hyphenation? Pablo Rodriguez
2018-02-08 23:03 ` Hans Hagen
2018-02-09 16:03   ` Pablo Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).