* Change of nuts.dimensions function ? @ 2018-02-07 13:57 Joseph Canedo 2018-02-08 9:13 ` Hans Hagen 0 siblings, 1 reply; 4+ messages in thread From: Joseph Canedo @ 2018-02-07 13:57 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 840 bytes --] Hello all, It seems that with latest ConTeXt beta (with luatex 1.07.0) it seems that nuts.dimensions function behaviour has changed. Simple MWE shows the change. Which function should be used now to get natural width of a range [n, t[ of nodes please? Thanks a lot Regards Joseph Canedo \startluacode local nuts = nodes.nuts local getdimensions = nuts.dimensions local tonut = nuts.tonut local tonode = nuts.tonode local tasks = nodes.tasks function handler(head) head = tonut(head) print('Width=' .. getdimensions(head, head)) // used to be 0 (as per luatex doc), now it’s most likely the natural width of the box. return tonode(head) end tasks.appendaction("processors", "after", "handler") tasks.enableaction("processors", "handler") \stopluacode \starttext Foo. \stoptext [-- Attachment #1.2: Type: text/html, Size: 2821 bytes --] [-- Attachment #2: Type: text/plain, Size: 492 bytes --] ___________________________________________________________________________________ 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] 4+ messages in thread
* Re: Change of nuts.dimensions function ? 2018-02-07 13:57 Change of nuts.dimensions function ? Joseph Canedo @ 2018-02-08 9:13 ` Hans Hagen 2018-02-15 20:29 ` Joseph Canedo 0 siblings, 1 reply; 4+ messages in thread From: Hans Hagen @ 2018-02-08 9:13 UTC (permalink / raw) To: ntg-context On 2/7/2018 2:57 PM, Joseph Canedo wrote: > Hello all, > > It seems that with latest ConTeXt beta (with luatex 1.07.0) it seems > that nuts.dimensions function behaviour has changed. Simple MWE shows > the change. > > Which function should be used now to get natural width of a range [n, t[ > of nodes please? i'll check it but if you're on windows you're running the (currently very) experimental version which can actually be broken in some aspects (so you then need to update regularaly) 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] 4+ messages in thread
* Re: Change of nuts.dimensions function ? 2018-02-08 9:13 ` Hans Hagen @ 2018-02-15 20:29 ` Joseph Canedo 2018-02-16 11:06 ` Hans Hagen 0 siblings, 1 reply; 4+ messages in thread From: Joseph Canedo @ 2018-02-15 20:29 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 2129 bytes --] Hi Hans, Thanks a lot, the function nuts.dimensions seems to work again as before. Another issue I am seeing now is that for some reason the dir nodes push/pop are unbalanced. If I understand the logic of these whatsit nodes they behave like a stack to control the text direction, so I’d assume the number of push nodes and pop nodes is balanced. Currently I see 2 pop for 1 push in shipouts callback (but balanced pop/push nodes in processors callback). If that’s expected from now on I’ll change the logic in my handler. Simple MWE that reproduces is attached. Thanks Best regards Joseph De : Hans Hagen Envoyé le :jeudi 8 février 2018 10:14 À : ntg-context@ntg.nl Objet :Re: [NTG-context] Change of nuts.dimensions function ? On 2/7/2018 2:57 PM, Joseph Canedo wrote: > Hello all, > > It seems that with latest ConTeXt beta (with luatex 1.07.0) it seems > that nuts.dimensions function behaviour has changed. Simple MWE shows > the change. > > Which function should be used now to get natural width of a range [n, t[ > of nodes please? i'll check it but if you're on windows you're running the (currently very) experimental version which can actually be broken in some aspects (so you then need to update regularaly) 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 ___________________________________________________________________________________ [-- Attachment #1.2: Type: text/html, Size: 4785 bytes --] [-- Attachment #2: dir.tex --] [-- Type: application/octet-stream, Size: 1751 bytes --] \startluacode local nuts = nodes.nuts local tonut = nuts.tonut local tonode = nuts.tonode local getfield = nuts.getfield local getid = nuts.getid local getnext = nuts.getnext local getlist = nuts.getlist local tasks = nodes.tasks local nodecodes = nodes.nodecodes local traverse_id = nuts.traverse_id local dir_code = nodecodes.dir local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist function handler(head) local found_dir = false head = tonut(head) for dir_node in traverse_id(dir_code, head) do local dir, level = getfield(dir_node, 'dir'), getfield(dir_node, 'level') if not found_dir then print('processor') found_dir = true end print('dir=' .. dir .. ' level=' .. level) end return tonode(head) end function list_handler(list, found_dir) local n = list while n do local id = getid(n) if id == hlist_code or id == vlist_code then list_handler(getlist(n), found_dir) elseif id == dir_code then local dir, level = getfield(n, 'dir'), getfield(n, 'level') if not found_dir then print('shipout') found_dir = true end print('dir=' .. dir .. ' level=' .. level) end n = getnext(n) end end function handler2(head) head = tonut(head) local found_dir = false list_handler(head, found_dir) return tonode(head) end tasks.appendaction("processors", "after", "handler") tasks.enableaction("processors", "handler") tasks.appendaction("shipouts", "after", "handler2") tasks.enableaction("shipouts", "handler2") \stopluacode \starttext Foo {\setupalign[r2l]Right to left} Bar. Foo {\setupalign[r2l]Right {\setupalign[l2r]Left again} Right} Bar. \stoptext [-- Attachment #3: Type: text/plain, Size: 492 bytes --] ___________________________________________________________________________________ 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] 4+ messages in thread
* Re: Change of nuts.dimensions function ? 2018-02-15 20:29 ` Joseph Canedo @ 2018-02-16 11:06 ` Hans Hagen 0 siblings, 0 replies; 4+ messages in thread From: Hans Hagen @ 2018-02-16 11:06 UTC (permalink / raw) To: ntg-context On 2/15/2018 9:29 PM, Joseph Canedo wrote: > Hi Hans, > > Thanks a lot, the function nuts.dimensions seems to work again as before. > > Another issue I am seeing now is that for some reason the dir nodes > push/pop are unbalanced. If I understand the logic of these whatsit > nodes they behave like a stack to control the text direction, so I’d > assume the number of push nodes and pop nodes is balanced. Currently I > see 2 pop for 1 push in shipouts callback (but balanced pop/push nodes > in processors callback). If that’s expected from now on I’ll change the > logic in my handler. > > Simple MWE that reproduces is attached. i get dir=+TRT level=2 dir=-TRT level=1 processor dir=+TRT level=2 dir=+TLT level=3 dir=-TLT level=2 dir=-TRT level=1 shipout dir=+TRT level=2 dir=-TRT level=1 shipout dir=+TRT level=2 dir=+TLT level=3 dir=-TLT level=2 dir=-TRT level=1 (latest experimental ... keep in mind that experimental is *not* really meant for production as it's the branch where we put in code that we work on .. it can even be a temporsary snapshot) (btw, there is a preliminary bidi manual in the distribution which i use when testing some of the low level cleanup in progress) > Thanks > > Best regards > > Joseph > > *De : *Hans Hagen <mailto:pragma@wxs.nl> > *Envoyé le :*jeudi 8 février 2018 10:14 > *À : *ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> > *Objet :*Re: [NTG-context] Change of nuts.dimensions function ? > > On 2/7/2018 2:57 PM, Joseph Canedo wrote: > > > Hello all, > > > > > > It seems that with latest ConTeXt beta (with luatex 1.07.0) it seems > > > that nuts.dimensions function behaviour has changed. Simple MWE shows > > > the change. > > > > > > Which function should be used now to get natural width of a range [n, t[ > > > of nodes please? > > i'll check it but if you're on windows you're running the (currently > > very) experimental version which can actually be broken in some aspects > > (so you then need to update regularaly) > > 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 > > ___________________________________________________________________________________ > > > > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ > -- ----------------------------------------------------------------- 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] 4+ messages in thread
end of thread, other threads:[~2018-02-16 11:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-02-07 13:57 Change of nuts.dimensions function ? Joseph Canedo 2018-02-08 9:13 ` Hans Hagen 2018-02-15 20:29 ` Joseph Canedo 2018-02-16 11:06 ` 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).