[NTG-context] lua code prevents compilation

Hans Hagen pragma at wxs.nl
Mon Mar 30 22:33:30 CEST 2015


On 3/30/2015 5:19 PM, Pablo Rodriguez wrote:
> Dear list,
>
> I have the following sample:
>
> \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
>
>
> \def\CoverImageFile{}%\externalfigure[TypeWriter][width=\textwidth]}
> \definefontfamily[ornamenta][rm][FontAwesome]
> \def\CoverImageFont{\scale[width=\textwidth]{\ornamenta }}
> \def\CoverImage{\doifsomethingelse{\CoverImageFile}{\CoverImageFile}{\CoverImageFont}}
>
> \starttext
> \CoverImage
> \stoptext
>
> For some reason unknown to me, the only way to compile the sample is to
> remove the luacode snippet.
>
> I need the lua code to have underscore hyphenation in type commands. And
> I need two extra \definehyphenationfeatures and \sethyphenationfeatures
> to invoke it.
>
> Have I hit a bug or what am I missing?

I don't know as i see nothing at all with that code .. this is more fun:

\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 },
             }
         }
         tfmdata.characters[0xFE001]   = {
             width    = 0,
             height   = 0,
             depth    = 0,
             commands = {
                 { "down", char.depth },
                 { "slot", 1, underscore },
                 { "right", char.width },
             }
         }
     end


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

\stopluacode

\setuplanguage[en][righthyphenchar="FE000,lefthyphenchar="FE001]

\starttext
     \input tufte
\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