ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* nuts.setfield is nil in generic code
@ 2021-07-08 14:21 Michal Vlasák
  2021-07-08 21:08 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Vlasák @ 2021-07-08 14:21 UTC (permalink / raw)
  To: ntg-context

Hello,

in the generic font loader code `nuts.setfield` is `nil`.

This is because in `luatex-basics-nod.lua` there is a wrong assignment
for `nuts.setfield` on line 121 (there is no `setfield` at that scope,
it should be `direct.setfield`). This is the required patch:

```diff
--- a/luatex-basics-nod.lua
+++ b/luatex-basics-nod.lua
@@ -118,7 +118,7 @@ nuts.setcomponents = direct.setcomponents
 nuts.setdirection  = direct.setdirection
 nuts.setdisc       = direct.setdisc
 nuts.setreplace    = direct.setreplace
-nuts.setfield      = setfield
+nuts.setfield      = direct.setfield
 nuts.setkern       = direct.setkern
 nuts.setlink       = direct.setlink
 nuts.setlist       = direct.setlist
```

This surfaced because `nuts.setreplace` in the generic code is defined
in terms of `nuts.setfield`. Previously `nuts.setreplace` wasn't used
anywhere (I think), but since 20th May 2021 it is used when injecting
kerns into discretionaries (font-otj.lua):

See also https://www.mail-archive.com/ntg-context@ntg.nl/msg98463.html.

Minimal not working example is:

```
\font\f=file:{./BaskervilleF-BoldItalic.otf}:mode=node;script=latn;kern=yes; at10pt
\f B\-C

\bye
```

Fails with:
"warning  (node filter): error: ./luatex-fonts-merged.lua:5166: attempt to call a nil value (upvalue 'setfield')".

Interestingly I can't reproduce the issue with Latin Modern, although it
seems to have a similar kern:

```
\font\f=file:lmroman10-regular.otf:mode=node;script=latn;kern=yes; at10pt
\f V\-a

\bye
```

Originally reported at https://github.com/latex3/luaotfload/issues/194.

Regards,
Michal Vlasák
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: nuts.setfield is nil in generic code
  2021-07-08 14:21 nuts.setfield is nil in generic code Michal Vlasák
@ 2021-07-08 21:08 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2021-07-08 21:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Michal Vlasák

On 7/8/2021 4:21 PM, Michal Vlasák wrote:
> Hello,
> 
> in the generic font loader code `nuts.setfield` is `nil`.
> 
> This is because in `luatex-basics-nod.lua` there is a wrong assignment
> for `nuts.setfield` on line 121 (there is no `setfield` at that scope,
> it should be `direct.setfield`). This is the required patch:
> 
> ```diff
> --- a/luatex-basics-nod.lua
> +++ b/luatex-basics-nod.lua
> @@ -118,7 +118,7 @@ nuts.setcomponents = direct.setcomponents
>   nuts.setdirection  = direct.setdirection
>   nuts.setdisc       = direct.setdisc
>   nuts.setreplace    = direct.setreplace
> -nuts.setfield      = setfield
> +nuts.setfield      = direct.setfield

ok, will do

>   nuts.setkern       = direct.setkern
>   nuts.setlink       = direct.setlink
>   nuts.setlist       = direct.setlist
> ```
> 
> This surfaced because `nuts.setreplace` in the generic code is defined
> in terms of `nuts.setfield`. Previously `nuts.setreplace` wasn't used
> anywhere (I think), but since 20th May 2021 it is used when injecting
> kerns into discretionaries (font-otj.lua):
> 
> See also https://www.mail-archive.com/ntg-context@ntg.nl/msg98463.html.
> 
> Minimal not working example is:
> 
> ```
> \font\f=file:{./BaskervilleF-BoldItalic.otf}:mode=node;script=latn;kern=yes; at10pt
> \f B\-C
> 
> \bye
> ```
> 
> Fails with:
> "warning  (node filter): error: ./luatex-fonts-merged.lua:5166: attempt to call a nil value (upvalue 'setfield')".
> 
> Interestingly I can't reproduce the issue with Latin Modern, although it
> seems to have a similar kern:
> 
> ```
> \font\f=file:lmroman10-regular.otf:mode=node;script=latn;kern=yes; at10pt
> \f V\-a
> 
> \bye

one is injected before and one after so one ends up in the replacement 
part which involves setfield

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-08 21:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 14:21 nuts.setfield is nil in generic code Michal Vlasák
2021-07-08 21:08 ` Hans Hagen

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).