Re: [NTG-context] Use MetaPost to distort images?
On Sun, 5 Sep 2021, Henning Hraban Ramm via ntg-context wrote: > > > Am 05.09.2021 um 10:10 schrieb Hans Hagen : > >> BTW, here’s my script: > >> Here are some results: > > > > Did you try that with the filter module? It would make it more portable > > I completely forgot I could do that (and I even know how). See attached. Basically, you can just copy-paste your script as the value of the filtercommand, and that's it. Aditya PS: I realized that there is a regression, and \externalfilterbasefile does not remove the file extension. So, the output is named mill.png-taped.png rather than mill-taped.png. I'll look into it later rotate.tex Description: TeX document ___ 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] zint barcode module on LMTX/MacOS
On 9/5/2021 7:53 PM, Michal Vlasák wrote: On Sun Sep 5, 2021 at 7:37 PM CEST, Hans Hagen wrote: On 9/5/2021 5:51 PM, Michal Vlasák via ntg-context wrote: Hello Hraban, "execute" should be a function defined in LuaMetaTeX, that internally calls zint functions. does context libs-imp-zint.mkxl produce something? Empty page (empty content stream) and Crop/Media/TrimBox is [ 0 0 7.790488 103.5872 ]. The line: local result = zintlib_execute(specification) returns false each time. it took me a while to figure it out on a linux box but the following nbeeds to be changed in the texmfcnf.lua file: CLUAINPUTS = ".;$SELFAUTOLOC/lib/$engine//", kind of subtle ... so no lua path in there (one needs to run mtxrun --genenate after changing this) (it went unnoticed because i have that in my texmf-local tree and as i had patched some files when testing an update i did was fooled by newer timestamps so i ended up in the wrong cache) anyway, zint works on linux (one needs to copy the file to the texm-platform tree and get rid of the version number in the name; long ago i dealt with that so maybe i need to reintroduce that ugly hackery again; installing zint in linux didn't create a simple .so link) so ... i've added some error messages in the process (so that "result, message = ..." can handle it) but no upload yet when it works, you will see some mp magick kicking in (becvause we use the vectorized output) ... if you are bored you can try to make a simple cmake file for compiling zint (i couldn't compile because of some depedencies, i.e. gcc not found by cmake; we don't need all that qt stuff anyway but i didn't want to waste time on that now) 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] zint barcode module on LMTX/MacOS
> Am 05.09.2021 um 19:53 schrieb Michal Vlasák via ntg-context > : > > On Sun Sep 5, 2021 at 7:37 PM CEST, Hans Hagen wrote: >> does >> >> context libs-imp-zint.mkxl >> >> produce something? > > Empty page (empty content stream) and Crop/Media/TrimBox is > [ 0 0 7.790488 103.5872 ]. > > The line: > > local result = zintlib_execute(specification) > > returns false each time. Same here. HR ___ 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] zint barcode module on LMTX/MacOS
On Sun Sep 5, 2021 at 7:37 PM CEST, Hans Hagen wrote: > On 9/5/2021 5:51 PM, Michal Vlasák via ntg-context wrote: > > Hello Hraban, > > > "execute" should be a function defined in LuaMetaTeX, that internally > > calls zint functions. > does > > context libs-imp-zint.mkxl > > produce something? Empty page (empty content stream) and Crop/Media/TrimBox is [ 0 0 7.790488 103.5872 ]. The line: local result = zintlib_execute(specification) returns false each time. Michal ___ 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] zint barcode module on LMTX/MacOS
On 9/5/2021 5:51 PM, Michal Vlasák via ntg-context wrote: Hello Hraban, "execute" should be a function defined in LuaMetaTeX, that internally calls zint functions. does context libs-imp-zint.mkxl produce something? - 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] zint barcode module on LMTX/MacOS
On Sun Sep 5, 2021 at 6:30 PM CEST, Henning Hraban Ramm via ntg-context wrote: > > Am 05.09.2021 um 17:51 schrieb Michal Vlasák : > > "execute" should be a function defined in LuaMetaTeX, that internally > > calls zint functions. > > Hm, ok, but where are the zint API calls defined? Sorry, do you mean what zint functions luametatex calls to implement "execute"? Then I don't know. And a quick reverse engineering try didn't turn up anything either. Michal ___ 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] zint barcode module on LMTX/MacOS
Hi Michal, thank you! > Am 05.09.2021 um 17:51 schrieb Michal Vlasák : > > On Sun Sep 5, 2021 at 4:15 PM CEST, Henning Hraban Ramm via ntg-context wrote: >> Hi again, >> >> the LMTX zint module uses libzint, while MkIV calls the zint binary. >> The latter works for me, the first not. >> >> On MacOS, the library is "/opt/local/lib/libzint.dylib"*. >> I changed that in the source and the file appears to be found. >> Could you add that, Hans? > > From libraries-mkiv: > >It is best to keep libraries in a place where you can keep an eye on >them being updated, like > > c:/data/tex-context/tex/texmf-win64/bin/lib/luametatex/foo/libfoo.dll Oh, yes, I should still know that from mujs. Works with a symlink. I.e. no need to change that in the module. >> But then still zintlib.execute returns nothing. > > I can confirm this as well. > >> I wonder if this works on Windows? >> The API docs don’t mention an "execute" function. >> https://www.zint.org.uk/manual/chapter/5 > > "execute" should be a function defined in LuaMetaTeX, that internally > calls zint functions. Hm, ok, but where are the zint API calls defined? Hraban ___ 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] zint barcode module on LMTX/MacOS
Hello Hraban, On Sun Sep 5, 2021 at 4:15 PM CEST, Henning Hraban Ramm via ntg-context wrote: > Hi again, > > the LMTX zint module uses libzint, while MkIV calls the zint binary. > The latter works for me, the first not. > > On MacOS, the library is "/opt/local/lib/libzint.dylib"*. > I changed that in the source and the file appears to be found. > Could you add that, Hans? From libraries-mkiv: It is best to keep libraries in a place where you can keep an eye on them being updated, like c:/data/tex-context/tex/texmf-win64/bin/lib/luametatex/foo/libfoo.dll You could of course use the ones provided by the system or maybe use symbolic links so that you still keep en eye on changes. On Linux I get: resolvers > libraries > library 'libzint' resolved via 'tds lib' path to '/home/michal/src/context/tex/texmf-linux-64/bin/lib/luametatex/zint/libzint.so' where the file is a copy of the system library. You probably need a similar setup (but you should prefer symlink), also with a ".so" extension as that's what ConTeXt uses on non Windows systems. > *) Previously, zint for MacOS was only available via HomeBrew; I don’t > know where that would install libzint, probably in /usr/local/lib/ like > on Linux. Yesterday a MacPorts port was added that I used; MacPorts > install everything under /opt/. In libs-ini.lua essentially three ways are tried: 1) TDS search, thats what I used above 2) PATH search (but this will try paths like "/usr/local/bin" not "/usr/local/lib"). 3) Current directory Copying the library file as I did is probably not the best idea in general, since the library can have dependencies (zint requires libpng which in turn needs zlib) and those get loaded from the system paths anyways: 28099: file=/home/michal/src/context/tex/texmf-linux-64/bin/lib/luametatex/zint/libzint.so [0]; dynamically loaded by /home/michal/src/context/tex/texmf-linux-64/bin/luametatex [0] 28099: file=libpng16.so.16 [0]; needed by /home/michal/src/context/tex/texmf-linux-64/bin/lib/luametatex/zint/libzint.so [0] 28099: file=libz.so.1 [0]; needed by /usr/lib/libpng16.so.16 [0] and one would want to ensure ABI compatibility. But then again, same issue applies to the luametatex -> optional library ABI. > But then still zintlib.execute returns nothing. I can confirm this as well. > I wonder if this works on Windows? > The API docs don’t mention an "execute" function. > https://www.zint.org.uk/manual/chapter/5 "execute" should be a function defined in LuaMetaTeX, that internally calls zint functions. Michal ___ 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] cld questions
> Am 05.09.2021 um 13:01 schrieb Hans Hagen : > > On 9/5/2021 12:01 PM, Henning Hraban Ramm via ntg-context wrote: >> * How translates \ifodd\realpageno ? >> This doesn’t work: >> if ((tex.getcount("realpageno") mod 2) == 1) then >> a = 1 >> end > > we're talking lua: 9 % 2 == 0 Oops. Too many languages... >> TeX: >> \def\Something{1cm} >> Lua: >> context.Something() > > yes (assuming you're in scope) Then I’m out of scope. \def is in my environment, directly before I load the Lua functions with \loadluafile. How can I access the macros from the environment there? >> Is tex.strut and tex.par supposed to work? Or how should I access these? > > \strut is not is primitive > > context.strut() and context.par() should just work It does. I thought I had tried that... > 0) I don’t understand what “permanent” does and why I should maybe disable > it. (cld-mkiv, p.146) > > overload protection > > \permanent\def\Whatever{?} > \overloadmode=0 > %\overloadmode=3 > %\overloadmode=4 > \def\Whatever{!} > > try 3 and 4 (actually, try to run your documents with overloadmode set and > you might see where you replace core macros) > > %enabledirectives[overloadmode=warning] > \enabledirectives[overloadmode=error] > > btw, you can temporary do > > \pushoverloadmode > potentially risky definitions > \popoverloadmode Thank you, I’ll try. (While I’m quite sure I never overload core macros.) >> 1) The parameter y is actually supposed to be a dimension, but if I declare >> it "dimen", ConTeXt says there wasn’t a number at "1cm". >>Or is a measure like that not a dimension? > > if you want to use {} around it use "dimenargument" > >> 2) The original interface of \MyFun had two optional parameters. I couldn’t >> find how to do that with interfaces.implement. >>cld-mkiv, p.151 (12.7) shows how to do lists or key=value, but not single >> optional args. > > there is "optional" > > and ... cld is not yet updated to lmtx in this respect so some newer features > are missing Thank you! Must I then declare "string optional" etc.? Hraban ___ 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] zint barcode module on LMTX/MacOS
Hi again, the LMTX zint module uses libzint, while MkIV calls the zint binary. The latter works for me, the first not. On MacOS, the library is "/opt/local/lib/libzint.dylib"*. I changed that in the source and the file appears to be found. Could you add that, Hans? *) Previously, zint for MacOS was only available via HomeBrew; I don’t know where that would install libzint, probably in /usr/local/lib/ like on Linux. Yesterday a MacPorts port was added that I used; MacPorts install everything under /opt/. But then still zintlib.execute returns nothing. I wonder if this works on Windows? The API docs don’t mention an "execute" function. https://www.zint.org.uk/manual/chapter/5 Hraban ___ 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] MetaFun : textext.dflt / textext.dlft and MkIV / LMTX
Hi, After https://mailman.ntg.nl/pipermail/ntg-context/2021/102052.html It seems that there is no backward compatibility between MkIV and LMTX for textext.dflt (MVE below) | MkIV | LMTX | -|---|--| textext.dflt | OK | KO | as DefauLT (unlike ulft and llft) textext.dlft | KO | OK | as Default + LeFT (like ulft and llft) For backward compatibility, would it be possible to add textext.dflt to LMTX as a synonym of textext.dlft ? % \startuseMPgraphic{MonGraphique} StartPage ; picture Pict ; % Pict := textext.dlft("Brouillon DLFT") xsized (.5PaperWidth); % OK with LMTX 2021.09.03 18:49 % KO with MkIV 2020.03.10 14:44 Pict := textext.dflt("Brouillon DFLT") xsized (.5PaperWidth); % KO with LMTX 2021.09.03 18:49 % OK with MkIV 2020.03.10 14:44 Pict := Pict shifted (bbwidth Pict /2 , (bbheight Pict / -2) ) ; Pict := Pict rotated 45; Pict := Pict shifted (.5PaperWidth, .5PaperHeight) ; draw Pict withcolor darkyellow ; StopPage ; \stopuseMPgraphic %- \defineoverlay[MonOverlay][\useMPgraphic{MonGraphique}] \setupbackgrounds[page][background=MonOverlay] \starttext \input knuth \stoptext ___ 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] Automatically adjust number of table columns
Dear List, I'm trying to make "\startchoice", "\stopchoice", and "\choice", such that: \startchoice \choice -1 \choice 0 \choice 1 \choice N/A \stopchoice results in (_ for whitespace) A. -1__B. 0__C. 1__D. N/A while \startchoice \choice not so short choice \choice must wrap here \choice another choice \choice yet another choice \stopchoice results in A. not so short choiceB. must wrap here C. another choice___D. yet another choice In another word, it should have the same effect as the addData() function in the page below (save as whatever.html and open it) table { width: 100%; border: 1px solid black; } #root { width: 10cm; } function make(tag, children) { const node = document.createElement(tag); for (const c of children) { if (typeof c === "string") { node.appendChild(document.createTextNode(c)); } else { node.appendChild(c); } } return node; } function addData(data) { const root = document.getElementById("root"); let table = make("table", [make("tr", data.map(d => make("td", [d])))]); root.appendChild(table); if (table.scrollWidth <= root.offsetWidth) { return; } root.removeChild(table); table = make("table", [ make("tr", [make("td", [data[0]]), make("td", [data[1]])]), make("tr", [make("td", [data[2]]), make("td", [data[3]])]), ]); root.appendChild(table); if (table.scrollWidth <= root.offsetWidth) { return; } root.removeChild(table); table = make("table", data.map(d => make("tr", [make("td", [d])]))); root.appendChild(table); } addData(["1".repeat(10), "2".repeat(10), "3".repeat(10), "4".repeat(10), ]); addData(["1".repeat(20), "2".repeat(20), "3".repeat(20), "4".repeat(20), ]); addData(["1".repeat(30), "2".repeat(30), "3".repeat(30), "4".repeat(30), ]); Does anyone have an idea how it can be implemented in context? Thanks in advance! Best, Sylvain ___ 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] cld questions
On 9/5/2021 12:01 PM, Henning Hraban Ramm via ntg-context wrote: Hi again, I’m converting a few macros into Lua (LMTX), but couldn’t find some answers in the docs: * How translates \ifodd\realpageno ? This doesn’t work: if ((tex.getcount("realpageno") mod 2) == 1) then a = 1 end we're talking lua: 9 % 2 == 0 TeX: \def\Something{1cm} Lua: context.Something() yes (assuming you're in scope) * TeX primitives Is tex.strut and tex.par supposed to work? Or how should I access these? \strut is not is primitive context.strut() and context.par() should just work 0) I don’t understand what “permanent” does and why I should maybe disable it. (cld-mkiv, p.146) overload protection \permanent\def\Whatever{?} \overloadmode=0 %\overloadmode=3 %\overloadmode=4 \def\Whatever{!} try 3 and 4 (actually, try to run your documents with overloadmode set and you might see where you replace core macros) %enabledirectives[overloadmode=warning] \enabledirectives[overloadmode=error] btw, you can temporary do \pushoverloadmode potentially risky definitions \popoverloadmode 1) The parameter y is actually supposed to be a dimension, but if I declare it "dimen", ConTeXt says there wasn’t a number at "1cm". Or is a measure like that not a dimension? if you want to use {} around it use "dimenargument" 2) The original interface of \MyFun had two optional parameters. I couldn’t find how to do that with interfaces.implement. cld-mkiv, p.151 (12.7) shows how to do lists or key=value, but not single optional args. there is "optional" and ... cld is not yet updated to lmtx in this respect so some newer features are missing 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] getting line numbers
Hi, I am trying to test this file but without success. I just do context test.tex but I suspect that is not it. When you say > We compile and run: > Which command is it with ? Thanks Fabrice Le ven. 3 sept. 2021 à 18:26, Hans Hagen via ntg-context a écrit : > On 9/3/2021 3:53 PM, Aditya Mahajan via ntg-context wrote: > > On Fri, 3 Sep 2021, Thierry Horsin via ntg-context wrote: > > > >> Hi everybody > >> > >> Is there a way to have an automatic access to the current line number > of a specific place inside a tex file ? To be more precise, here is what I > would like to do. > > > > Also look at the filter module. > > > > https://github.com/adityam/filter > > > > Behind the scenes, it works by saving the content in an external file > and then > > running it through any external program. It also allows for caching the > > result, and has many options for customizing the behavior. > you forgot to mention that it also makes sure that you only process when > there has been a change (after all calling gcc comes at a price) > > 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 ___
[NTG-context] cld questions
Hi again, I’m converting a few macros into Lua (LMTX), but couldn’t find some answers in the docs: * How translates \ifodd\realpageno ? This doesn’t work: if ((tex.getcount("realpageno") mod 2) == 1) then a = 1 end I found tex.ifodd but don’t know how to use it either. * How to access my \def’d macros? Is this supposed to work?: TeX: \def\Something{1cm} Lua: context.Something() (It doesn’t in my case, but if it should, I can investigate.) * TeX primitives Is tex.strut and tex.par supposed to work? Or how should I access these? * interface definitions: Lua: interfaces.implement { name = "MyFun", public= true, --permanent = false, -- what does this mean? arguments = { "string", "string", "string", "string" }, actions = function(reference, y, text, filename) -- a lot end, } TeX: \MyFun{ref:some}{1cm}{bla}{hacker} 0) I don’t understand what “permanent” does and why I should maybe disable it. (cld-mkiv, p.146) 1) The parameter y is actually supposed to be a dimension, but if I declare it "dimen", ConTeXt says there wasn’t a number at "1cm". Or is a measure like that not a dimension? 2) The original interface of \MyFun had two optional parameters. I couldn’t find how to do that with interfaces.implement. cld-mkiv, p.151 (12.7) shows how to do lists or key=value, but not single optional args. I’d be glad to get a few hints. Hraban ___ 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] Use MetaPost to distort images?
> Am 05.09.2021 um 10:10 schrieb Hans Hagen : > > On 9/5/2021 9:40 AM, Henning Hraban Ramm via ntg-context wrote: >>> Am 04.09.2021 um 19:06 schrieb Hans Hagen : >>> >>> On 9/4/2021 2:18 PM, Henning Hraban Ramm via ntg-context wrote: >>> I guess it’s on me to write a wiki page about GM. >>> >>> you can then also add some comparison with im (i.e. what does it offer more >>> than gm) >> Oh no... >> IM and GM have a history, and I don’t want to get involved. >> GM accuses IM of security issues, feature and dependency bloat, bad code >> quality, inefficiency, frequent API changes, license changes and whatnot. > > ah, i think i remember ... i switched to gm just because im didn't run well > at that time on windows > > personally i think that "accuses of .." show that down side of the open > source community (which includes the tex community btw) ... it gets even > worse when something sells itself for big money and then after a few years > spins off again attacking those who paid them ... i suppose that > unconstrianed social media also play a role in this (one reason why i'm not > really interested in discussions around this in public) I hear you. Of course there are reasons to be opinionated and to fork some open source projects if they move into a direction that you don’t like. But that doesn’t mean you can’t be polite about it. And the GM maintainers focus too much on their hate for IM’s developer(s) for my taste. Maybe it helps them to stay focused and write better code if they have an enemy... > (what to think of: https://www.youtube.com/watch?v=BhTQyeEdnzs) The video doesn’t run for me, just read the description: I’m sure the problem exists, but it’s maybe exaggerated? >> Dependencies according to MacPorts: >> Full Name: GraphicsMagick @1.3.36_1+q8 >> Library Dependencies: libxml2, bzip2, xz, zlib, libpng, tiff, freetype, >> libiconv, libtool, lcms2, jasper, libjpeg-turbo, webp > > makes me wonder if there is some simple image manipulation lib that just > deals with the pixels .. we don't need xml, freetype, libiconv, ... Maybe use these libs (libpng etc.) directly? I don’t know what they can do. Is there a Lua lib that parallels Python’s Pillow? It also has a lot of dependencies to support image formats or add features, but most of them are optional, see https://pillow.readthedocs.io/en/latest/installation.html#building-from-source >> Full Name: ImageMagick @6.9.11-60_1+x11 >> Library Dependencies: bzip2, djvulibre, xz, jbigkit, libjpeg-turbo, lcms2, >> libpng, libraw, tiff, webp, zlib, fftw-3, freetype, fontconfig, ghostscript, >> libiconv, libtool, openjpeg, openexr, expat, libxml2, libheif, pkgconfig, >> xorg-libX11, xorg-libXext, xorg-libXt >> Runtime Dependencies: urw-fonts > > hm, that looks bad ... maybe not have a look after all ... i get the > impression that many originally small programs get bloated by pulling in one > lib that then pulls in more, Exactly. The criticism by the GM maintainers probably *is* justified. (When I installed IM, actually all of the dependecies were already installed for other programs.) > even if nothing of that is used or useful to the task (we sort of had that > when luatex used xpdf from which we only need the reading part but we could > not really complain about that because it has been so from the start but it > triggered quite a bit of updating) It might make sense for some projects to dive into these libs and pull out and combine the parts that they really need. Even if that’s against the meaning of shared libraries and makes it harder to watch upstream for security fixes... > keep in mind that we can just call them as programs using os.execute (or the > filter module or ...) ... no need to waste time in integration (apart from a > fun aspect) Of course. I never wanted to suggest integrating GM, IM or whatever. >> It’s probably not wise to run IM in a web server process for security and >> efficiency reasons, but if I run it only on my own computer there shouldn’t >> be a problem. > > hm, why not? all it does in the end is "bits in - bits out" Apparently there were bugs in IM that bite web developers – if you used IM via PHP and allowed users to upload arbitrary images (e.g. avatars), they could exploit buffer overflows or something like that to hack your system. Or at least stall it (DoS attack). >> BTW, here’s my script: >> Here are some results: > > Did you try that with the filter module? It would make it more portable I completely forgot I could do that (and I even know how). Working on too many building sites at the same time... Hraban ___ 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/conte
Re: [NTG-context] parameters TeX->LuaTeX
On 9/5/2021 10:14 AM, Hans van der Meer via ntg-context wrote: There is something I do not understand in the passing of parameters from TeX to LuaTex. This is my TeX definition: \def\ListSort[#1]#2{\directlua{hvdm.listsort([===[#2]===],[===[#1]===])}} tex haalt de {} rond #2 weg Calling \ListSort[sep={ + }]{} delivers the string 'sep={ + }' into LuaTeX as the printout in the logfile shows and as intended. However in \ListSort[{ + }]{} the braces have disappeared and transferred is nothing more than '+ '. Why is the transfer messing up the character string I am passing by removing the outer braces? Is this a bug or is it an unavoidable consequence of the TeX-LuaTeX interface? \starttext \def\foo#1{\detokenize{#1}} \foo{hvdm has to read the tex book} \def\foo#+{\detokenize{#1}} \foo{hvdm has to read the luametatex manual} \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] Use MetaPost to distort images?
On 9/5/2021 9:40 AM, Henning Hraban Ramm via ntg-context wrote: OTOH IM offers much more features (e.g. the geometric transformations I inquired about), and you can find lots of interesting examples (including the scripts Bruce mentioned). I couldn’t find another CLI tool that can do most of these things, at least not with much more programming. one thing the api offers is a way to pass 'command line like options' to the converter ... so i might cook up a variant for it in the end because it needs not much interfacing 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] parameters TeX->LuaTeX
And \ListSort[[abc]]{value} turns out to be worse: doesn't makes it into LuaTeX at all. dr. Hans van der Meer > On 5 Sep 2021, at 10:14, Hans van der Meer via ntg-context > wrote: > > There is something I do not understand in the passing of parameters from TeX > to LuaTex. > This is my TeX definition: > \def\ListSort[#1]#2{\directlua{hvdm.listsort([===[#2]===],[===[#1]===])}} > > Calling \ListSort[sep={ + }]{} delivers the string 'sep={ + }' into LuaTeX > as the printout in the logfile shows and as intended. > However in \ListSort[{ + }]{} the braces have disappeared and transferred is > nothing more than ' + '. > > Why is the transfer messing up the character string I am passing by removing > the outer braces? Is this a bug or is it an unavoidable consequence of the > TeX-LuaTeX interface? > > dr. Hans van der Meer > > > ___ > 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 ___
[NTG-context] parameters TeX->LuaTeX
There is something I do not understand in the passing of parameters from TeX to LuaTex. This is my TeX definition: \def\ListSort[#1]#2{\directlua{hvdm.listsort([===[#2]===],[===[#1]===])}} Calling \ListSort[sep={ + }]{} delivers the string 'sep={ + }' into LuaTeX as the printout in the logfile shows and as intended. However in \ListSort[{ + }]{} the braces have disappeared and transferred is nothing more than ' + '. Why is the transfer messing up the character string I am passing by removing the outer braces? Is this a bug or is it an unavoidable consequence of the TeX-LuaTeX interface? dr. Hans van der Meer ___ 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] Use MetaPost to distort images?
On 9/5/2021 9:40 AM, Henning Hraban Ramm via ntg-context wrote: Am 04.09.2021 um 19:06 schrieb Hans Hagen : On 9/4/2021 2:18 PM, Henning Hraban Ramm via ntg-context wrote: I guess it’s on me to write a wiki page about GM. you can then also add some comparison with im (i.e. what does it offer more than gm) Oh no... IM and GM have a history, and I don’t want to get involved. GM accuses IM of security issues, feature and dependency bloat, bad code quality, inefficiency, frequent API changes, license changes and whatnot. ah, i think i remember ... i switched to gm just because im didn't run well at that time on windows personally i think that "accuses of .." show that down side of the open source community (which includes the tex community btw) ... it gets even worse when something sells itself for big money and then after a few years spins off again attacking those who paid them ... i suppose that unconstrianed social media also play a role in this (one reason why i'm not really interested in discussions around this in public) like: what is bad code quality ... i bet one can find examples of bad, inefficient, etc in gm too (it would be quite a claim to say one can't), and the more people touch the code ... also, what about the code quality of libs then ... one bug in those could affect lots of programs using them ... most is about trust .. and even more in 'working with people you like working with' btw, 'bug' and 'many bugs' and 'big bug' are popular in subject titles and mail bodies, even it's small bugs or side effects or something that has to be tested but it might make people feel good 'security fix' is another one, which often just means: programming error e.g. array out of bounds; nowadays for me the way an email is written determines the reading order, but there is no good filter for that yet; same for (tech) websites: bluffing and barking agianst a tree (like your mentioned 'accuses' makes me go away immediately and discard whatever would follow) (what to think of: https://www.youtube.com/watch?v=BhTQyeEdnzs) OTOH IM offers much more features (e.g. the geometric transformations I inquired about), and you can find lots of interesting examples (including the scripts Bruce mentioned). I couldn’t find another CLI tool that can do most of these things, at least not with much more programming. ok, i'll have a look later, maybe it can be compiled lean-and-mean Dependencies according to MacPorts: Full Name: GraphicsMagick @1.3.36_1+q8 Library Dependencies: libxml2, bzip2, xz, zlib, libpng, tiff, freetype, libiconv, libtool, lcms2, jasper, libjpeg-turbo, webp makes me wonder if there is some simple image manipulation lib that just deals with the pixels .. we don't need xml, freetype, libiconv, ... Full Name: ImageMagick @6.9.11-60_1+x11 Library Dependencies: bzip2, djvulibre, xz, jbigkit, libjpeg-turbo, lcms2, libpng, libraw, tiff, webp, zlib, fftw-3, freetype, fontconfig, ghostscript, libiconv, libtool, openjpeg, openexr, expat, libxml2, libheif, pkgconfig, xorg-libX11, xorg-libXext, xorg-libXt Runtime Dependencies: urw-fonts hm, that looks bad ... maybe not have a look after all ... i get the impression that many originally small programs get bloated by pulling in one lib that then pulls in more, even if nothing of that is used or useful to the task (we sort of had that when luatex used xpdf from which we only need the reading part but we could not really complain about that because it has been so from the start but it triggered quite a bit of updating) keep in mind that we can just call them as programs using os.execute (or the filter module or ...) ... no need to waste time in integration (apart from a fun aspect) It’s probably not wise to run IM in a web server process for security and efficiency reasons, but if I run it only on my own computer there shouldn’t be a problem. hm, why not? all it does in the end is "bits in - bits out" BTW, here’s my script: #!/bin/bash #INPUT=$1 OUTPUT=${INPUT/.JPG/.png} OUTPUT=${OUTPUT/.jpg/.png} OUTPUT=${OUTPUT/in\//out\/} # random rotation ±1.5˚ ROTATION=`jot -r 1 -1.5 1.5` echo $OUTPUT ${ROTATION}˚ # downscale, add a white border and a shadow, rotate, move down, add a piece of tape (tesa1.png), grayscale convert "$INPUT" \ -auto-orient \ -resize 800x800 \ -bordercolor white -border 10 \ \( +clone -background black -shadow 80x3+2+2 \) +swap \ -background transparent \ -layers merge \ -rotate ${ROTATION} \ +repage \ -gravity north \ -splice 0x10 \ \( tesa1.png -resize 200x50! \) -compose Multiply -composite \ -colorspace Gray \ "$OUTPUT" Here are some results: https://sedna.fiee.net/d/2c3218730f8341aab1fa/ Did you try that with the filter module? It would make it more portable Hans ps. It is still on my todo list to see of we can add some of metafont's bit stuff. -
Re: [NTG-context] Use MetaPost to distort images?
> Am 04.09.2021 um 19:06 schrieb Hans Hagen : > > On 9/4/2021 2:18 PM, Henning Hraban Ramm via ntg-context wrote: > >> I guess it’s on me to write a wiki page about GM. > > you can then also add some comparison with im (i.e. what does it offer more > than gm) Oh no... IM and GM have a history, and I don’t want to get involved. GM accuses IM of security issues, feature and dependency bloat, bad code quality, inefficiency, frequent API changes, license changes and whatnot. OTOH IM offers much more features (e.g. the geometric transformations I inquired about), and you can find lots of interesting examples (including the scripts Bruce mentioned). I couldn’t find another CLI tool that can do most of these things, at least not with much more programming. Dependencies according to MacPorts: Full Name: GraphicsMagick @1.3.36_1+q8 Library Dependencies: libxml2, bzip2, xz, zlib, libpng, tiff, freetype, libiconv, libtool, lcms2, jasper, libjpeg-turbo, webp Full Name: ImageMagick @6.9.11-60_1+x11 Library Dependencies: bzip2, djvulibre, xz, jbigkit, libjpeg-turbo, lcms2, libpng, libraw, tiff, webp, zlib, fftw-3, freetype, fontconfig, ghostscript, libiconv, libtool, openjpeg, openexr, expat, libxml2, libheif, pkgconfig, xorg-libX11, xorg-libXext, xorg-libXt Runtime Dependencies: urw-fonts It’s probably not wise to run IM in a web server process for security and efficiency reasons, but if I run it only on my own computer there shouldn’t be a problem. BTW, here’s my script: #!/bin/bash #INPUT=$1 OUTPUT=${INPUT/.JPG/.png} OUTPUT=${OUTPUT/.jpg/.png} OUTPUT=${OUTPUT/in\//out\/} # random rotation ±1.5˚ ROTATION=`jot -r 1 -1.5 1.5` echo $OUTPUT ${ROTATION}˚ # downscale, add a white border and a shadow, rotate, move down, add a piece of tape (tesa1.png), grayscale convert "$INPUT" \ -auto-orient \ -resize 800x800 \ -bordercolor white -border 10 \ \( +clone -background black -shadow 80x3+2+2 \) +swap \ -background transparent \ -layers merge \ -rotate ${ROTATION} \ +repage \ -gravity north \ -splice 0x10 \ \( tesa1.png -resize 200x50! \) -compose Multiply -composite \ -colorspace Gray \ "$OUTPUT" Here are some results: https://sedna.fiee.net/d/2c3218730f8341aab1fa/ Hraban ___ 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 ___