On 12/10/2014 9:03 PM, Pablo Rodriguez wrote:
Hans,

the sample below hyphenates right what comes before \TexC in the
paragraph. Also the contents of \TexC are hyphenated right.

But hyphen is removed from standard text after the last \TexC command in
the paragraph.

I have just accidentally discovered it.

Fixed, thanks for noticing, it had to do with picking up the right settings after a change in alternative (we operate on several axis: language, glyph and hyphenation properties).


Many thanks for your help,

Pablo



\startluacode

     function document.addfunnyhyphen(tfmdata)
         local underscore = utf.byte("_")
         local char       = tfmdata.characters[underscore]
         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

\definefontfamily[mainface][serif][GaramondNo8]
\definefontfamily[mainface][mono][Mechanica]
\setupbodyfont[mainface, 14pt]

\definetype
       [TeXcode]
       [option=TEX,
        compact=absolute,
        lines=hyphenated]

\definehyphenationfeatures
       [whatever]
       [righthyphenchar="FE000]

\setuphyphenation[method=traditional]
\sethyphenationfeatures[strict]

\unexpanded\def\TexC#1%
       {\dontleavehmode\begingroup
        \sethyphenationfeatures[whatever]%
        \normalexpanded{\TeXcode{\letterbackslash#1}}%
        \endgroup}

\starttext
         \hsize\zeropoint
         newlargewordwithhyphen
         \TexC{definebodyfont}
         newlargewordwithnohyphen
\stoptext



--

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to