[NTG-context] lua code prevents compilation

Pablo Rodriguez oinos at gmx.es
Thu Apr 2 01:21:40 CEST 2015


On 03/30/2015 10:33 PM, Hans Hagen wrote:
> On 3/30/2015 5:19 PM, Pablo Rodriguez wrote:
>> [...]
>> 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:

Many thanks for your reply, Hans,

The following code shows the problem:

\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[ornamenta][rm][TypographyTribute]
\definehyphenationfeatures[underscore][righthyphenchar="FE000]
\setuphyphenation[method=traditional]
\sethyphenationfeatures[strict]
\setupbodyfont[ornamenta]
\starttext
\hsize\zeropoint
{\sethyphenationfeatures[underscore]\tt pandoc}
A
\stoptext

If you uncomment the line with the font definition, font loading crashes
compilation. It only crashes with this font
(http://www.dafont.com/typographytribute.font) or FontAwesome
(http://www.fontawesome.io).

Both lack the underscore glyph. This causes the crash, since it works
fine if I replace the glyph with an existing glyph in the font.

Error message:

code.tex: ! LuaTeX fatal error error in error handling
\font_helpers_low_level_define ...\scaledfontmode
                                                  \relax \ifcase
\scaledfont...
\font_helpers_trigger_define ..._identifier_class
                                                  \csname
\v_font_identifier...
\applyfontclassstrategies ...\fontface \endcsname
                                                  \else \expandafter
\font_h...
\font_helpers_synchronize_font ...classstrategies
                                                  \fi \setfalse
\c_font_auto...
\rm ->\ifmmode \mathrm \else \normalrm
                                       \fi
\font_basics_switch_style ...ntstyle #1\endcsname
                                                  \edef \fontstyle
{#1}\ifmm...
...

Would it be possible that ConTeXt silently ignores that the font doesn’t
contain the glyph?

I think this might be a bug.

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk


More information about the ntg-context mailing list