Re: [NTG-context] Using \overloaded
On 1/24/2021 10:16 PM, Rik Kabel wrote: I can find no information on \aliased and the push/pop for overloademode and such, so will leave documenting that in the wiki to somebody with a few more clues. it will be (and often is) in documentation and manuals in the distribution and in articles in user group journals and so but anyway it's kind of new and i still need to flag all visible (low level) macros and variables (still some 700 to go) the same is also done for metafun (mostly done but also some to go) it roughly works as follows: - primitives are marked as 'primitive' (already by the engine) - we mark all registers we allocate as 'permanent' - most constants are marked as 'immutable' - if we don't care (or can't) we mark something as 'mutable' - user defined instances are 'frozen' (can be \overloaded) - \aliased just means: take the properties (applies to \let cs) - \enforced (in the body of a macro) does just that the last one is special because it gets internalized in ini mode (when the format is made) there are (and might be some more) flags (like \noaligned) the other large effort is removing some indirectness (using the extended lightweight macro argument parsing features) (mostly done, but it can introduce issues due to the rather large amount of tiny adptions but luckily these are reported here by users) anyway, what happens after that depends on \overloadmode (th ehigher the more strict, odd a warning, even an error) it is not (and can never be) complete in terms of protection (too many macro definitions, also runtime) but good enough for what i have in mind: help users to keep their run working by not redefining essential macros 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] new font trickery
On 1/24/2021 6:16 PM, Pablo Rodriguez wrote: But MuPDF and SumtraPDF (based on MuPDF) display it fine. An (in the meantime probably old version of) okular (windows) also shows it ok ... time to ditch (or update) evince I guess. 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] Using \overloaded
Hi, Rik. If it helps, flags are explained in lowlevel-security manual: https://www.pragma-ade.com/general/manuals/lowlevel-security.pdf Jairo :) El dom, 24 de ene. de 2021 a la(s) 16:16, Rik Kabel ( cont...@rik.users.panix.com) escribió: > On 1/24/2021 04:33, Wolfgang Schuster wrote: > > Rik Kabel schrieb am 24.01.2021 um 05:13: > >> Hans and all, > >> > >> Preparing my standard environments for future strict enforcement of > >> overloading prevention, I have run into one issue. > >> > >> I had been using the following construction to change the formatting > >> of URLs: > >> > >> \let\OrigHyphenatedurl\hyphenatedurl > >> \starttexdefinition hyphenatedurl #URL > >>\begingroup > >> \URLfont\OrigHyphenatedurl{#URL} > >>\endgroup > >> \stoptexdefinition > > > > > > You can use a hook to change the font for \hyphenatedurl. > > > > \starttext > > > > \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} > > > > \appendtoks > > \it > > \to \everyhyphenatedurl > > > > \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} > > > > \stoptext > > > > > >> This results in the following warning about overloading \hyphenatedurl: > >> > >> csname overload > warning, protection level 3, control sequence > >> 'hyphenatedurl', properties 'permanent protected', file > >> 'env_layout.mkvi', line 1 > >> > >> I have tried adding \overloaded to indicate the intentional > >> overloading, but \overloaded cannot be used with \starttexdefinition, > >> so I rewrote it as: > >> > >> \let\OrigHyphenatedurl\hyphenatedurl > >> \overloaded\define[1]\hyphenatedurl{% > >>\begingroup% > >> \URLfont\OrigHyphenatedurl{#1}% > >>\endgroup}% > >> > >> but that (and also with \overloaded\def\hyphenatedurl#1...) gives the > >> same (except for the line number) warning: > >> > >> csname overload > warning, protection level 3, control sequence > >> 'hyphenatedurl', properties 'permanent protected', file > >> 'env_layout.mkvi', line 822 > >> > >> So, what is the proper way to indicate intentional overloading? Or > >> should this redefinition be done in another way? > > > > > > The best solution is *to not* overload commands because there are either > > alternative ways to achieve the desired result or other commands which > > can be used. > > > > > > \overloadmode=4 > > > > \starttext > > > > \permanent\def\mycommand#1{[#1]} > > > > \mycommand{Old definition} > > > > \pushoverloadmode > > > > \aliased\let\originalmycommand\mycommand > > > > \permanent\def\mycommand#1% > > {{\it\originalmycommand{#1}}} > > > > \popoverloadmode > > > > \mycommand{New definition} > > > > \stoptext > > > > > > Wolfgang > > Thank you, Wolfgang (and Hans), > > The hook is perfect for this. I had avoided that construction for a long > time thinking that it is too low-level, but looking at it again it seems > to be the right thing here. > > I can find no information on \aliased and the push/pop for overloademode > and such, so will leave documenting that in the wiki to somebody with a > few more clues. > > -- > Rik > > > ___ > 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 ___
Re: [NTG-context] Using \overloaded
On 1/24/2021 04:33, Wolfgang Schuster wrote: Rik Kabel schrieb am 24.01.2021 um 05:13: Hans and all, Preparing my standard environments for future strict enforcement of overloading prevention, I have run into one issue. I had been using the following construction to change the formatting of URLs: \let\OrigHyphenatedurl\hyphenatedurl \starttexdefinition hyphenatedurl #URL \begingroup \URLfont\OrigHyphenatedurl{#URL} \endgroup \stoptexdefinition You can use a hook to change the font for \hyphenatedurl. \starttext \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} \appendtoks \it \to \everyhyphenatedurl \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} \stoptext This results in the following warning about overloading \hyphenatedurl: csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 1 I have tried adding \overloaded to indicate the intentional overloading, but \overloaded cannot be used with \starttexdefinition, so I rewrote it as: \let\OrigHyphenatedurl\hyphenatedurl \overloaded\define[1]\hyphenatedurl{% \begingroup% \URLfont\OrigHyphenatedurl{#1}% \endgroup}% but that (and also with \overloaded\def\hyphenatedurl#1...) gives the same (except for the line number) warning: csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 822 So, what is the proper way to indicate intentional overloading? Or should this redefinition be done in another way? The best solution is *to not* overload commands because there are either alternative ways to achieve the desired result or other commands which can be used. \overloadmode=4 \starttext \permanent\def\mycommand#1{[#1]} \mycommand{Old definition} \pushoverloadmode \aliased\let\originalmycommand\mycommand \permanent\def\mycommand#1% {{\it\originalmycommand{#1}}} \popoverloadmode \mycommand{New definition} \stoptext Wolfgang Thank you, Wolfgang (and Hans), The hook is perfect for this. I had avoided that construction for a long time thinking that it is too low-level, but looking at it again it seems to be the right thing here. I can find no information on \aliased and the push/pop for overloademode and such, so will leave documenting that in the wiki to somebody with a few more clues. -- Rik ___ 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] rscale not working
Hans, rscale doesn’t work with latest from 2021.01.24 16:07: \definefontfamily[mainface][rm][Latin Modern Serif] \definefontfamily[mainface][tt][Latin Modern Sans][rscale=2] \setupbodyfont[mainface, 60pt] \starttext \dorecurse{26} {\character{\recurselevel}{\tt\character{\recurselevel} }} \stoptext Or am I missing something? 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] new font trickery
On 1/24/21 5:51 PM, Hans Hagen wrote: >> [...] >> I only get black cows and black squares for bitmap images. >> >> I think this isn’t intended. > Works ok here ... so are the images found? Buggy pdf viewer? Many thanks for your reply, Hans. Images are found, but not with "directory=default", but with "location=default". Evince doesn’t display the images or colors. Acrobat for Linux doesn’t display it either (this is why I thought it might be a bug). But MuPDF and SumtraPDF (based on MuPDF) display it fine. Sorry for the noise and 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] new font trickery
On 1/24/21 4:44 PM, Hans Hagen wrote: > \starttext > > \setupexternalfigure[directory={global,default}] > > \startsetups box:demo:103 > \externalfigure[cow-brown.pdf][height=12pt] > \stopsetups > > \startsetups box:demo:104 > \externalfigure[cow-black.pdf][height=10pt] > \stopsetups > > \startsetups box:demo:105 > \externalfigure[mill.png][height=12pt] > \stopsetups > > \startsetups box:demo:106 > \externalfigure[hacker.jpg][height=12pt] > \stopsetups Sorry, Hans, but I’m afraid it doesn’t work for me. To find images, I neeed to add: \setupexternalfigure[location={default}] I only get black cows and black squares for bitmap images. I think this isn’t intended. 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] new font trickery
Hi Jairo, (to the list for those who want to play with it) In addition to the metapost fotn subsystem I also made a tex variant. That one is currently based on setups. So, we now can use mp as well as tex to make fonts. Of course this is mostly for special purposes and for fun but both are quite efficient. \starttext \setupexternalfigure[directory={global,default}] \startsetups box:demo:103 \externalfigure[cow-brown.pdf][height=12pt] \stopsetups \startsetups box:demo:104 \externalfigure[cow-black.pdf][height=10pt] \stopsetups \startsetups box:demo:105 \externalfigure[mill.png][height=12pt] \stopsetups \startsetups box:demo:106 \externalfigure[hacker.jpg][height=12pt] \stopsetups \registerboxglyph category {demo} unicode 103 \relax % rather low level for now \registerboxglyph category {demo} unicode 104 \relax % rather low level for now \registerboxglyph category {demo} unicode 105 \relax % rather low level for now \registerboxglyph category {demo} unicode 106 \relax % rather low level for now \definefontfeature[whatever][box=demo] \definedfont[Serif*whatever] % \enabletrackers[fonts.collecting] \startTEXpage%[offset=0pt] %\hbox{g}% \hbox{\char103}% \hbox{\char104}% \stopTEXpage \startsetups box:demo:whatever \startMPcode picture p ; p := image (draw figure "hacker.jpg" ysized 10pt); fill boundingbox p enlarged .5pt randomized 2pt withcolor "darkgray" ; clip p to boundingbox p enlarged -1pt randomized 2pt ; draw p ; \stopMPcode \stopsetups % in current font! \iffontchar\font\privatecharactercode{demo:whatever}\else \setboxglyph { category {demo} name {demo:whatever} setups {box:demo:whatever} }% \fi \startTEXpage[offset=10pt] \char\privatecharactercode{demo:whatever}% \stopTEXpage \startTEXpage%[offset=0pt] \ruledhbox{\char103} \ruledhbox{\char104} \ruledhbox{\char105} \ruledhbox{\char106} \stopTEXpage \dorecurse{1000}{ \char 103\relax \space \char 104\relax \space \char 105\relax \space \char 106\relax \space } \page \setupalign[verytolerant,flushleft] \dorecurse{100}{ #1: \glyph yoffset -2pt `i\relax \glyph yoffset -3pt `j\relax\space } \stoptext - 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] m-ipsum broken
On 1/24/2021 2:10 AM, Jairo A. del Rio wrote: Hi, list Compiling m-ipsum yields an error in latest LMTX (2021.01.22 09:41) not only the latest i think ... lua became more strict on escapes over time ... i'll update the interface 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] Using \overloaded
On 1/24/2021 5:13 AM, Rik Kabel wrote: Hans and all, Preparing my standard environments for future strict enforcement of overloading prevention, I have run into one issue. I had been using the following construction to change the formatting of URLs: \let\OrigHyphenatedurl\hyphenatedurl \starttexdefinition hyphenatedurl #URL \begingroup \URLfont\OrigHyphenatedurl{#URL} \endgroup \stoptexdefinition This results in the following warning about overloading \hyphenatedurl: csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 1 I have tried adding \overloaded to indicate the intentional overloading, but \overloaded cannot be used with \starttexdefinition, so I rewrote it as: \let\OrigHyphenatedurl\hyphenatedurl \overloaded\define[1]\hyphenatedurl{% \begingroup% \URLfont\OrigHyphenatedurl{#1}% \endgroup}% but that (and also with \overloaded\def\hyphenatedurl#1...) gives the same (except for the line number) warning: csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 822 So, what is the proper way to indicate intentional overloading? Or should this redefinition be done in another way? \pushoverloadmode ... \popoverloadmode (Also, it is interesting that the line number in the first warning message does not point to the actual line.) that has ot do with whne an error is encountered not where it originates from 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] Using \overloaded
Rik Kabel schrieb am 24.01.2021 um 05:13: Hans and all, Preparing my standard environments for future strict enforcement of overloading prevention, I have run into one issue. I had been using the following construction to change the formatting of URLs: \let\OrigHyphenatedurl\hyphenatedurl \starttexdefinition hyphenatedurl #URL \begingroup \URLfont\OrigHyphenatedurl{#URL} \endgroup \stoptexdefinition You can use a hook to change the font for \hyphenatedurl. \starttext \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} \appendtoks \it \to \everyhyphenatedurl \hyphenatedurl{https://wiki.contextgarden.net/Main_Page} \stoptext This results in the following warning about overloading \hyphenatedurl: csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 1 I have tried adding \overloaded to indicate the intentional overloading, but \overloaded cannot be used with \starttexdefinition, so I rewrote it as: \let\OrigHyphenatedurl\hyphenatedurl \overloaded\define[1]\hyphenatedurl{% \begingroup% \URLfont\OrigHyphenatedurl{#1}% \endgroup}% but that (and also with \overloaded\def\hyphenatedurl#1...) gives the same (except for the line number) warning: csname overload > warning, protection level 3, control sequence 'hyphenatedurl', properties 'permanent protected', file 'env_layout.mkvi', line 822 So, what is the proper way to indicate intentional overloading? Or should this redefinition be done in another way? The best solution is *to not* overload commands because there are either alternative ways to achieve the desired result or other commands which can be used. \overloadmode=4 \starttext \permanent\def\mycommand#1{[#1]} \mycommand{Old definition} \pushoverloadmode \aliased\let\originalmycommand\mycommand \permanent\def\mycommand#1% {{\it\originalmycommand{#1}}} \popoverloadmode \mycommand{New definition} \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 ___