* lua code prevents compilation @ 2015-03-30 15:19 Pablo Rodriguez 2015-03-30 20:33 ` Hans Hagen 0 siblings, 1 reply; 5+ messages in thread From: Pablo Rodriguez @ 2015-03-30 15:19 UTC (permalink / raw) To: mailing list for ConTeXt users 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? 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lua code prevents compilation 2015-03-30 15:19 lua code prevents compilation Pablo Rodriguez @ 2015-03-30 20:33 ` Hans Hagen 2015-04-01 23:21 ` Pablo Rodriguez 0 siblings, 1 reply; 5+ messages in thread From: Hans Hagen @ 2015-03-30 20:33 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lua code prevents compilation 2015-03-30 20:33 ` Hans Hagen @ 2015-04-01 23:21 ` Pablo Rodriguez 2015-04-02 0:23 ` Hans Hagen 0 siblings, 1 reply; 5+ messages in thread From: Pablo Rodriguez @ 2015-04-01 23:21 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lua code prevents compilation 2015-04-01 23:21 ` Pablo Rodriguez @ 2015-04-02 0:23 ` Hans Hagen 2015-04-02 7:35 ` Pablo Rodriguez 0 siblings, 1 reply; 5+ messages in thread From: Hans Hagen @ 2015-04-02 0:23 UTC (permalink / raw) To: mailing list for ConTeXt users On 4/2/2015 1:21 AM, Pablo Rodriguez wrote: > 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? the message is fuzzy (and i have to check a lua stack issue maybe but not now) ... if char is nil then char.depth is an error > I think this might be a bug. > 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 ----------------------------------------------------------------- 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lua code prevents compilation 2015-04-02 0:23 ` Hans Hagen @ 2015-04-02 7:35 ` Pablo Rodriguez 0 siblings, 0 replies; 5+ messages in thread From: Pablo Rodriguez @ 2015-04-02 7:35 UTC (permalink / raw) To: mailing list for ConTeXt users On 04/02/2015 02:23 AM, Hans Hagen wrote: > On 4/2/2015 1:21 AM, Pablo Rodriguez wrote: >> [...] >> 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. >> [...] >> Would it be possible that ConTeXt silently ignores that the font doesn’t >> contain the glyph? > > the message is fuzzy (and i have to check a lua stack issue maybe but > not now) ... if char is nil then char.depth is an error > >> I think this might be a bug. > > > function document.addfunnyhyphen(tfmdata) > > local underscore = utf.byte("_") > > local char = tfmdata.characters[underscore] > > if not char then return end Many thanks for your help, Hans. This solves my issue. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-02 7:35 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-03-30 15:19 lua code prevents compilation Pablo Rodriguez 2015-03-30 20:33 ` Hans Hagen 2015-04-01 23:21 ` Pablo Rodriguez 2015-04-02 0:23 ` Hans Hagen 2015-04-02 7:35 ` 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).