[NTG-context] fontloader error in latex: attempt to call upvalue 'getdirection' (a nil value)

2019-01-06 Thread Ulrike Fischer
I just tried to import the fontloader from 2019-01-03 into latex,
and get on a simple document the error

 (./test-utf8.aux)error:
...ad/texmf/tex/luatex/luaotfload/fontloader-2019-01-03.lua:23868:
attempt to call upvalue 'getdirection' (a nil value)
.
\newpage ...k \@nobreakfalse \everypar {}\fi \par
  \ifdim \prevdepth
>\z@ \vs...

l.51 \end{document}


I have no idea (yet) if this is latex specific or if it could affect
context too but thought I better mention it. The line refers to this
part of the code:

  pardirstate=function(start)
local nxt=getnext(start)
local dir=getdirection(start) --<--
if dir==lefttoright then
  return nxt,1,1




-- 
Ulrike Fischer 
https://www.troubleshooting-tex.de/

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] lua lpeg + utf8

2019-01-06 Thread Thomas A. Schmitz

On 06.01.19 23:08, Hans Hagen wrote:

what do you mean with "running luatex alone" ; you can run scripts with

mtxrun --script yourscript foo.txt

(or do you mean something different)


Hi Hans,

thanks, this is what I meant! I guess I was trying to reinvent the wheel 
and doing things in pure Lua, but processing utf8 is indeed much easier 
with all the context functions. So thanks, I hope I can take it from here!


Thomas
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] lua lpeg + utf8

2019-01-06 Thread Hans Hagen

On 1/6/2019 8:14 PM, Thomas A. Schmitz wrote:

On 06.01.19 19:20, Wolfgang Schuster wrote:

\starttext

\startluacode

print("abcdeφὴὰabcde")

local remap = utf.remapper { a = "y", c = "z", ὴ = "ή", ὰ = "ά" }

print(remap("abcdeφὴὰabcde"))

\stopluacode

\stoptext


Wolfgang, thank you, I should have looked into this manual! Is there an 
easy way to load the necessary additional libraries if I'm running 
luatex alone, outside of mtxrun?

what do you mean with "running luatex alone" ; you can run scripts with

mtxrun --script yourscript foo.txt

(or do you mean something different)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] lua lpeg + utf8

2019-01-06 Thread Thomas A. Schmitz

On 06.01.19 19:20, Wolfgang Schuster wrote:

\starttext

\startluacode

print("abcdeφὴὰabcde")

local remap = utf.remapper { a = "y", c = "z", ὴ = "ή", ὰ = "ά" }

print(remap("abcdeφὴὰabcde"))

\stopluacode

\stoptext


Wolfgang, thank you, I should have looked into this manual! Is there an 
easy way to load the necessary additional libraries if I'm running 
luatex alone, outside of mtxrun?


Thomas
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] lua lpeg + utf8

2019-01-06 Thread Wolfgang Schuster

Thomas A. Schmitz schrieb am 06.01.19 um 18:53:

Hi everybody,

best wishes for (the still new) 2019! My question is not strictly a 
ConTeXt problem, but about the way luatex (and pure Lua) can handle utf8 
in lpeg. Here is my Lua example:


mystring = "abcdeφὴὰabcde"

local replace_table = {
   a = "y",
   c = "z",
   ὴ = "ή",
   ὰ = "ά",
}

function replace(s)
 local patt = (lpeg.Cs(1)) / replace_table
 local parser = lpeg.Cs((patt + 1)^0)
 t = parser:match(s)
 return t
end

newstring = replace(mystring)

print(newstring)

This will successfully replace "a" and "c," but not "ὴ" or "ὰ" because 
lpeg.Cs(1) sees only the first byte of these multibyte characters. Pure 
Lua complains with an error message; luatex runs, but does not do the 
replacement. What would be a good way to work around this limitation?


Below is a modified version of the example on page 103 of the ConTeXt 
Lua Documents (cld-mkiv.pdf) manual.


\starttext

\startluacode

print("abcdeφὴὰabcde")

local remap = utf.remapper { a = "y", c = "z", ὴ = "ή", ὰ = "ά" }

print(remap("abcdeφὴὰabcde"))

\stopluacode

\stoptext

Wolfgang
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] lua lpeg + utf8

2019-01-06 Thread Thomas A. Schmitz

Hi everybody,

best wishes for (the still new) 2019! My question is not strictly a 
ConTeXt problem, but about the way luatex (and pure Lua) can handle utf8 
in lpeg. Here is my Lua example:


mystring = "abcdeφὴὰabcde"

local replace_table = {
  a = "y",
  c = "z",
  ὴ = "ή",
  ὰ = "ά",
}

function replace(s)
local patt = (lpeg.Cs(1)) / replace_table
local parser = lpeg.Cs((patt + 1)^0)
t = parser:match(s)
return t
end

newstring = replace(mystring)

print(newstring)

This will successfully replace "a" and "c," but not "ὴ" or "ὰ" because 
lpeg.Cs(1) sees only the first byte of these multibyte characters. Pure 
Lua complains with an error message; luatex runs, but does not do the 
replacement. What would be a good way to work around this limitation?


All best

Thomas
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Problem with grid alignment and paragraph

2019-01-06 Thread Wolfgang Schuster

Luca Donetti schrieb am 14.12.18 um 22:14:

Dear list,

I am facing a problem with grid alignment when using paragraphs. I 
think it could be a bug because the MWE below produces lines which are 
correctly aligned to the grid with the context version included in 
texlive 2017, but it does not seem to work with the context in texlive 
2018 and the current beta (ConTeXt  ver: 2018.12.07 19:37 MKIV beta  
fmt: 2018.12.14).

This is the MWE:

\setuplayout[grid=yes]
\defineparagraphs[twocols][n=2]
\showgrid

\starttext
\starttwocols
\input knuth
\nexttwocols
  \input knuth
\stoptwocols
\stoptext

Am I doing anything wrong? If not, I'll appreciate any suggestion or 
workaround.


https://tex.stackexchange.com/questions/468711/context-defineparagraphs-aligned-to-grid/

Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___