[NTG-context] two issues with new hyphenator

Hans Hagen pragma at wxs.nl
Wed Dec 3 20:30:46 CET 2014


On 12/3/2014 7:48 PM, Pablo Rodriguez wrote:
> Many thanks for your new beta, Hans.
>
>  From the previous beta with the new hyphenator, I have two issues.
>
> With the new hyphenator, \hyphenation isn’t honored, such as in this sample:
>
>      \setuphyphenation[method=traditional]
>      \hyphenation{Nietz-sche}
>      \starttext
>      \hsize\zeropoint
>      Nietzsche
>      \stoptext
>
> Has the command been deprecated with the new hyphenator?

no, on the todo list is a variant (in fact you can add pretty complex 
patterns in different ways already)

> The second issue is the ability to enable underscore hyphenation. Is
> there any way to apply the following definition to \hyphenatedurl?
>
> \unexpanded\def\underscorehyphenation#1%
>     {\dontleavehmode
>      \begingroup
>      \prehyphenchar\minusone
>      \localrightbox{\llap{\smash{\lower.1ex\hbox{_}}}}%
>      \setbox\scratchbox\hbox{#1}%
>      \prehyphenchar`-\relax
>      \unhbox\scratchbox
>      \endgroup}
>
> (This is adapted from the last sample in lang-url.mkiv.)

no need to mess like that:

\startluacode

     local function addfunnyhyphen(tfmdata)
         local exheight = tfmdata.parameters.xheight
         local emwidth  = tfmdata.parameters.quad
         local width    = emwidth
         local height   = exheight / 10
         local depth    = exheight / 2
         tfmdata.characters[0xFE000]   = {
             width    = 0,
             height   = 0,
             depth    = 0,
             commands = {
                 { "right", -width },
                 { "down", depth },
                 { "rule", height, width },
             }
         }
     end

     fonts.constructors.newfeatures("otf").register {
         name        = "funnyhyphen",
         description = "funny hyphen",
         manipulators = {
             base = addfunnyhyphen,
             node = addfunnyhyphen,
         }
     }

\stopluacode

\definefontfeature[default][default][funnyhyphen=yes]

\starttext

     \prehyphenchar"FE000

     \hsize 1mm

     averylongword

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


More information about the ntg-context mailing list