Re: [NTG-context] \clip isn’t clipping any more
On 1/20/2021 11:24 AM, Henning Hraban Ramm wrote: In the following example, the image is calculated after the clipped width, but the full image is shown: \setupexternalfigures[location=default] \showframe \starttext \strut \hfill\clip[width=20mm]{\externalfigure[cow][height=30mm]} \stoptext This happens in current LMTX (2020-01-18), it was still ok in LMTX as of 2020-01-11. It also works in MkIV. see previous mails fixed in next upload 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 ___
[NTG-context] \clip isn’t clipping any more
In the following example, the image is calculated after the clipped width, but the full image is shown: \setupexternalfigures[location=default] \showframe \starttext \strut \hfill\clip[width=20mm]{\externalfigure[cow][height=30mm]} \stoptext This happens in current LMTX (2020-01-18), it was still ok in LMTX as of 2020-01-11. It also works in MkIV. 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] image align in \clip
On 12/9/20 9:38 AM, Jan U. Hasecke wrote: > Dear all, > > I use \clip to simplify working with images. Hi Jan-Ulrich, this command is really useful. > In my real document the clipped image is shifted to the right as if > indented by 1em or so. I have read that Hans solved your issue. I thought of another approach (which isn’t your case): \showframe\showgrid \setupindenting[yes, always, big] \setupexternalfigure[location=default] \showframe \starttext \clip[height=50mm] {\externalfigure[cow.pdf][width=\textwidth]} \dontleavehmode \clip[height=50mm] {\externalfigure[cow.pdf][width=\textwidth]} \noindentation \dontleavehmode \clip[height=50mm] {\externalfigure[cow.pdf][width=\textwidth]} \stoptext I thought that you had your image in horizontal mode (inside a paragraph) and then the paragraph was indented. Cheers 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] image align in \clip
Am 09.12.20 um 11:26 schrieb Hans Hagen: > what if you put \removeunwantedspaces in front of the clip The space vanishes when I put it right before \externalfigure. Thanks a lot, Hans! (Still, I would like to know how the space came up in the first place.) juh ___ 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] image align in \clip
Dear all, I use \clip to simplify working with images. I have a problem that I am unable to reproduce in a MWE. \setupexternalfigure[location=default] \showframe \starttext \externalfigure[cow.pdf][width=\textwidth] \clip[height=50mm] {\externalfigure[cow.pdf][width=\textwidth]} \stoptext In my real document the clipped image is shifted to the right as if indented by 1em or so. Any hints where to look for the reason? TIA juh ___ 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] image align in \clip
On 12/9/2020 12:08 PM, Jan U. Hasecke wrote: Am 09.12.20 um 11:26 schrieb Hans Hagen: what if you put \removeunwantedspaces in front of the clip The space vanishes when I put it right before \externalfigure. Thanks a lot, Hans! (Still, I would like to know how the space came up in the first place.) hard to say without knowing what happens before you do the \externalfigure command you can put \tracingall someplace before it and \tracingnone after the \removeunwantesspaces and then check the log and see where a space is injected 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] image align in \clip
On 12/9/2020 9:38 AM, Jan U. Hasecke wrote: Dear all, I use \clip to simplify working with images. I have a problem that I am unable to reproduce in a MWE. \setupexternalfigure[location=default] \showframe \starttext \externalfigure[cow.pdf][width=\textwidth] \clip[height=50mm] {\externalfigure[cow.pdf][width=\textwidth]} \stoptext In my real document the clipped image is shifted to the right as if indented by 1em or so. Any hints where to look for the reason? what if you put \removeunwantedspaces in front of the clip 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 ___
[NTG-context] resize and center and clip image
Hi! Assume that I want to fill in the text area with images, and I want to clip and scale them according to these rules: 1) If the image is too wide (in sense of proportions), then scale it so that the height fits the text area height, center it, and clip it to the text area. (See the attached image, on top, where the blue area is supposed to show the text area and the red rectangle the image.) 2) If the image is too high (in sense of proportions), then scale it so that the width fits the text area width, center it, and clip it to the text area. (See the attached image, on bottom.) The background why I want to do this is that I'm making a small template for presentations, and I'd like the users to insert images as background without really having to think about if their proportions fit or not. Best regards, Mikael ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] resize and center and clip image
OK, sorry for the noise. I think I have the solution: \startexternalfigurecollection[k.jpg] \useexternalfigure[k.jpg][k.jpg] \stopexternalfigurecollection \externalfigurecollectionminwidth{k.jpg} \externalfigurecollectionmaxheight{k.jpg} \clip[width=8cm,height=7cm]{% \framed[width=8cm,height=7cm,align={middle,lohi},offset=overlay]{% \dimen0=\externalfigurecollectionminwidth{k.jpg} \dimen2=\externalfigurecollectionmaxheight{k.jpg} \dimen4=8cm \dimen6=7cm \startluacode if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({k.jpg},{width=8cm}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({k.jpg},{height=7cm}) context.sprint(bar) end \stopluacode }} If there are any bad side effects of this or simplifications, please do not hesitate to tell me :) /Mikael On Thu, May 1, 2014 at 1:50 PM, Mikael P. Sundqvist mic...@gmail.com wrote: Hi! Assume that I want to fill in the text area with images, and I want to clip and scale them according to these rules: 1) If the image is too wide (in sense of proportions), then scale it so that the height fits the text area height, center it, and clip it to the text area. (See the attached image, on top, where the blue area is supposed to show the text area and the red rectangle the image.) 2) If the image is too high (in sense of proportions), then scale it so that the width fits the text area width, center it, and clip it to the text area. (See the attached image, on bottom.) The background why I want to do this is that I'm making a small template for presentations, and I'd like the users to insert images as background without really having to think about if their proportions fit or not. Best regards, Mikael ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] resize and center and clip image
Hi Mikael, Out of curiosity I tried to typeset your example (after adding the usual \starttext, \stoptext), but using ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: english/english I obtained a TeX error: tex errorerror on line 13 in file /Users/kavian/Context/essais/mkii/figures/resize-and-center.tex: ! Undefined control sequence \startexternalfigurecollection ...igurecollection {#1}\settrue \c_grph_inclu... l.13 \clip[width=8cm,height=7cm] {% 3 \startexternalfigurecollection[k.jpg] 4 \useexternalfigure[k.jpg][k.jpg] 5 \stopexternalfigurecollection I did not understand what is the « Undefined control sequence », since I think \clip is a known control sequence. Best regards: OK On 1 mai 2014, at 15:38, Mikael P. Sundqvist mic...@gmail.com wrote: OK, sorry for the noise. I think I have the solution: \startexternalfigurecollection[k.jpg] \useexternalfigure[k.jpg][k.jpg] \stopexternalfigurecollection \externalfigurecollectionminwidth{k.jpg} \externalfigurecollectionmaxheight{k.jpg} \clip[width=8cm,height=7cm]{% \framed[width=8cm,height=7cm,align={middle,lohi},offset=overlay]{% \dimen0=\externalfigurecollectionminwidth{k.jpg} \dimen2=\externalfigurecollectionmaxheight{k.jpg} \dimen4=8cm \dimen6=7cm \startluacode if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({k.jpg},{width=8cm}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({k.jpg},{height=7cm}) context.sprint(bar) end \stopluacode }} If there are any bad side effects of this or simplifications, please do not hesitate to tell me :) /Mikael On Thu, May 1, 2014 at 1:50 PM, Mikael P. Sundqvist mic...@gmail.com wrote: Hi! Assume that I want to fill in the text area with images, and I want to clip and scale them according to these rules: 1) If the image is too wide (in sense of proportions), then scale it so that the height fits the text area height, center it, and clip it to the text area. (See the attached image, on top, where the blue area is supposed to show the text area and the red rectangle the image.) 2) If the image is too high (in sense of proportions), then scale it so that the width fits the text area width, center it, and clip it to the text area. (See the attached image, on bottom.) The background why I want to do this is that I'm making a small template for presentations, and I'd like the users to insert images as background without really having to think about if their proportions fit or not. Best regards, Mikael ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] resize and center and clip image
Interesting, I use ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: english/english and it works. I now defined this with argument: \startluacode userdata = userdata or {} function userdata.lundklippfyllbild(str, bredd, hojd) if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({str},{width=bredd}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({str},{height=hojd}) context.sprint(bar) end end \stopluacode \unexpanded\def\lundklippfyllbild#1#2#3{% \startexternalfigurecollection[#1]% \useexternalfigure[#1][#1]% \stopexternalfigurecollection% \clip[ width=#2, height=#3, hoffset=0mm, voffset=0mm, ]{% \framed[width=#2,height=#3,align={middle,lohi},offset=overlay,frame=off]{% \dimen0=\externalfigurecollectionminwidth{#1}% \dimen2=\externalfigurecollectionmaxheight{#1}% \dimen4=#2% \dimen6=#3% {\ctxlua{userdata.lundklippfyllbild([==[#1]==],[==[#2]==],[==[#3]==])} and then run \lundklippfyllbild{k.jpg}{\textwidth}{\textheight} it works well. Of course you should replace k.jpg with some other image name... /Mikael PS And please, if someone has opinions about the code, don't hesitate to tell me. This is my first time using lua... On Thu, May 1, 2014 at 4:59 PM, Otared Kavian ota...@gmail.com wrote: Hi Mikael, Out of curiosity I tried to typeset your example (after adding the usual \starttext, \stoptext), but using ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: english/english I obtained a TeX error: tex errorerror on line 13 in file /Users/kavian/Context/essais/mkii/figures/resize-and-center.tex: ! Undefined control sequence \startexternalfigurecollection ...igurecollection {#1}\settrue \c_grph_inclu... l.13 \clip[width=8cm,height=7cm] {% 3 \startexternalfigurecollection[k.jpg] 4 \useexternalfigure[k.jpg][k.jpg] 5 \stopexternalfigurecollection I did not understand what is the « Undefined control sequence », since I think \clip is a known control sequence. Best regards: OK On 1 mai 2014, at 15:38, Mikael P. Sundqvist mic...@gmail.com wrote: OK, sorry for the noise. I think I have the solution: \startexternalfigurecollection[k.jpg] \useexternalfigure[k.jpg][k.jpg] \stopexternalfigurecollection \externalfigurecollectionminwidth{k.jpg} \externalfigurecollectionmaxheight{k.jpg} \clip[width=8cm,height=7cm]{% \framed[width=8cm,height=7cm,align={middle,lohi},offset=overlay]{% \dimen0=\externalfigurecollectionminwidth{k.jpg} \dimen2=\externalfigurecollectionmaxheight{k.jpg} \dimen4=8cm \dimen6=7cm \startluacode if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({k.jpg},{width=8cm}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({k.jpg},{height=7cm}) context.sprint(bar) end \stopluacode }} If there are any bad side effects of this or simplifications, please do not hesitate to tell me :) /Mikael On Thu, May 1, 2014 at 1:50 PM, Mikael P. Sundqvist mic...@gmail.com wrote: Hi! Assume that I want to fill in the text area with images, and I want to clip and scale them according to these rules: 1) If the image is too wide (in sense of proportions), then scale it so that the height fits the text area height, center it, and clip it to the text area. (See the attached image, on top, where the blue area is supposed to show the text area and the red rectangle the image.) 2) If the image is too high (in sense of proportions), then scale it so that the width fits the text area width, center it, and clip it to the text area. (See the attached image, on bottom.) The background why I want to do this is that I'm making a small template for presentations, and I'd like the users to insert images as background without really having to think about if their proportions fit or not. Best regards, Mikael ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
Re: [NTG-context] resize and center and clip image
Hi Mikael, With your new definitions and lua code I could typeset and test a few examples: it is very nice, thanks for sharing! Best regards: OK On 1 mai 2014, at 17:07, Mikael P. Sundqvist mic...@gmail.com wrote: Interesting, I use ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: english/english and it works. I now defined this with argument: \startluacode userdata = userdata or {} function userdata.lundklippfyllbild(str, bredd, hojd) if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({str},{width=bredd}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({str},{height=hojd}) context.sprint(bar) end end \stopluacode \unexpanded\def\lundklippfyllbild#1#2#3{% \startexternalfigurecollection[#1]% \useexternalfigure[#1][#1]% \stopexternalfigurecollection% \clip[ width=#2, height=#3, hoffset=0mm, voffset=0mm, ]{% \framed[width=#2,height=#3,align={middle,lohi},offset=overlay,frame=off]{% \dimen0=\externalfigurecollectionminwidth{#1}% \dimen2=\externalfigurecollectionmaxheight{#1}% \dimen4=#2% \dimen6=#3% {\ctxlua{userdata.lundklippfyllbild([==[#1]==],[==[#2]==],[==[#3]==])} and then run \lundklippfyllbild{k.jpg}{\textwidth}{\textheight} it works well. Of course you should replace k.jpg with some other image name... /Mikael PS And please, if someone has opinions about the code, don't hesitate to tell me. This is my first time using lua... On Thu, May 1, 2014 at 4:59 PM, Otared Kavian ota...@gmail.com wrote: Hi Mikael, Out of curiosity I tried to typeset your example (after adding the usual \starttext, \stoptext), but using ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: english/english I obtained a TeX error: tex errorerror on line 13 in file /Users/kavian/Context/essais/mkii/figures/resize-and-center.tex: ! Undefined control sequence \startexternalfigurecollection ...igurecollection {#1}\settrue \c_grph_inclu... l.13 \clip[width=8cm,height=7cm] {% 3 \startexternalfigurecollection[k.jpg] 4 \useexternalfigure[k.jpg][k.jpg] 5 \stopexternalfigurecollection I did not understand what is the « Undefined control sequence », since I think \clip is a known control sequence. Best regards: OK On 1 mai 2014, at 15:38, Mikael P. Sundqvist mic...@gmail.com wrote: OK, sorry for the noise. I think I have the solution: \startexternalfigurecollection[k.jpg] \useexternalfigure[k.jpg][k.jpg] \stopexternalfigurecollection \externalfigurecollectionminwidth{k.jpg} \externalfigurecollectionmaxheight{k.jpg} \clip[width=8cm,height=7cm]{% \framed[width=8cm,height=7cm,align={middle,lohi},offset=overlay]{% \dimen0=\externalfigurecollectionminwidth{k.jpg} \dimen2=\externalfigurecollectionmaxheight{k.jpg} \dimen4=8cm \dimen6=7cm \startluacode if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({k.jpg},{width=8cm}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({k.jpg},{height=7cm}) context.sprint(bar) end \stopluacode }} If there are any bad side effects of this or simplifications, please do not hesitate to tell me :) /Mikael On Thu, May 1, 2014 at 1:50 PM, Mikael P. Sundqvist mic...@gmail.com wrote: Hi! Assume that I want to fill in the text area with images, and I want to clip and scale them according to these rules: 1) If the image is too wide (in sense of proportions), then scale it so that the height fits the text area height, center it, and clip it to the text area. (See the attached image, on top, where the blue area is supposed to show the text area and the red rectangle the image.) 2) If the image is too high (in sense of proportions), then scale it so that the width fits the text area width, center it, and clip it to the text area. (See the attached image, on bottom.) The background why I want to do this is that I'm making a small template for presentations, and I'd like the users to insert images as background without really having to think about if their proportions fit or not. Best regards, Mikael ___ 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
Re: [NTG-context] resize and center and clip image
On Thu, 1 May 2014, Mikael P. Sundqvist wrote: \startluacode userdata = userdata or {} function userdata.lundklippfyllbild(str, bredd, hojd) if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({str},{width=bredd}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({str},{height=hojd}) context.sprint(bar) end end \stopluacode \unexpanded\def\lundklippfyllbild#1#2#3{% \startexternalfigurecollection[#1]% \useexternalfigure[#1][#1]% \stopexternalfigurecollection% \clip[ width=#2, height=#3, hoffset=0mm, voffset=0mm, ]{% \framed[width=#2,height=#3,align={middle,lohi},offset=overlay,frame=off]{% \dimen0=\externalfigurecollectionminwidth{#1}% \dimen2=\externalfigurecollectionmaxheight{#1}% \dimen4=#2% \dimen6=#3% {\ctxlua{userdata.lundklippfyllbild([==[#1]==],[==[#2]==],[==[#3]==])} and then run \lundklippfyllbild{k.jpg}{\textwidth}{\textheight} Here is an eTeX solution. \unprotect \newdimen\d_scaleandclip_actual_wd \newdimen\d_scaleandclip_actual_ht \newdimen\d_scaleandclip_requested_wd \newdimen\d_scaleandclip_requested_ht \newbox\scaleandclip_box \installnamespace{scaleandclip} \installcommandhandler \scaleandclip {scaleandclip} \scaleandclip \setupscaleandclip [width=\textwidth, height=\textheight] \unexpanded\def\scaleandclip{\dodoubleempty\doscaleandclip} \def\doscaleandclip[#1][#2]% {\bgroup \ifsecondargument \edef\currentscaleandclip{#1}% \setupcurrentscaleandclip[#2]% \else\iffirstargument \doifassignmentelse{#1} {\let\currentscaleandclip\empty \setupcurrentscaleandclip[#1]} {\edef\currentscaleandclip{#1}} \else \let\currentscaleandclip\empty \fi\fi \dowithnextboxcs\scaleandclip_finish\hbox} \def\scaleandclip_finish {% \d_scaleandclip_requested_wd \dimexpr\scaleandclipparameter\c!width\relax \d_scaleandclip_requested_ht \dimexpr\scaleandclipparameter\c!height\relax % \d_scaleandclip_actual_wd\wd\nextbox \d_scaleandclip_actual_ht\dimexpr\ht\nextbox + \dp\nextbox\relax % \ifdim\dimexpr\d_scaleandclip_actual_wd*100/\d_scaleandclip_requested_wd \dimexpr\d_scaleandclip_actual_ht*100/\d_scaleandclip_requested_ht \relax \setbox\scaleandclip_box\hbox {\scale[\c!width=\d_scaleandclip_requested_wd]{\box\nextbox}}% \scratchdimen=\the\dimexpr(\ht\scaleandclip_box - \d_scaleandclip_requested_ht)/2\relax \clip [ \c!voffset=\scratchdimen, \c!height=\d_scaleandclip_requested_ht, ]{\box\scaleandclip_box}% \else \setbox\scaleandclip_box\hbox {\scale[\c!height=\d_scaleandclip_requested_ht]{\box\nextbox}}% \scratchdimen=\the\dimexpr(\wd\scaleandclip_box - \d_scaleandclip_requested_wd)/2\relax \clip [ \c!hoffset=\scratchdimen, \c!width=\d_scaleandclip_requested_wd, ]{\box\scaleandclip_box}% \fi \egroup} \protect The usage is: \scaleandclip[width=..., height=...]{ ... any box ...} simimlar to the usage of \scale macro. \starttext \dontleavehmode \scaleandclip[width=3cm, height=3cm]{\externalfigure[cow.pdf][width=3cm,frame=on]} \scale[maxwidth=3cm, maxheight=3cm]{\externalfigure[cow.pdf][width=3cm,frame=on]} \dontleavehmode \scaleandclip[width=3cm, height=3cm]{\externalfigure[cow.pdf][width=3cm,height=10cm,frame=on]} \scale[maxwidth=3cm, maxheight=3cm]{\externalfigure[cow.pdf][width=3cm,height=10cm,frame=on]} \dontleavehmode \scaleandclip[width=3cm, height=3cm]{\externalfigure[cow.pdf][width=10cm,height=3cm,frame=on]} \scale[maxwidth=3cm, maxheight=3cm]{\externalfigure[cow.pdf][width=10cm,height=3cm,frame=on]} \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] resize and center and clip image
On Thu, May 1, 2014 at 8:00 PM, Aditya Mahajan adit...@umich.edu wrote: On Thu, 1 May 2014, Mikael P. Sundqvist wrote: \startluacode userdata = userdata or {} function userdata.lundklippfyllbild(str, bredd, hojd) if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({str},{width=bredd}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({str},{height=hojd}) context.sprint(bar) end end \stopluacode \unexpanded\def\lundklippfyllbild#1#2#3{% \startexternalfigurecollection[#1]% \useexternalfigure[#1][#1]% \stopexternalfigurecollection% \clip[ width=#2, height=#3, hoffset=0mm, voffset=0mm, ]{% \framed[width=#2,height=#3,align={middle,lohi},offset=overlay,frame=off]{% \dimen0=\externalfigurecollectionminwidth{#1}% \dimen2=\externalfigurecollectionmaxheight{#1}% \dimen4=#2% \dimen6=#3% {\ctxlua{userdata.lundklippfyllbild([==[#1]==],[==[#2]==],[==[#3]==])} and then run \lundklippfyllbild{k.jpg}{\textwidth}{\textheight} Here is an eTeX solution. \unprotect \newdimen\d_scaleandclip_actual_wd \newdimen\d_scaleandclip_actual_ht \newdimen\d_scaleandclip_requested_wd \newdimen\d_scaleandclip_requested_ht \newbox\scaleandclip_box \installnamespace{scaleandclip} \installcommandhandler \scaleandclip {scaleandclip} \scaleandclip \setupscaleandclip [width=\textwidth, height=\textheight] \unexpanded\def\scaleandclip{\dodoubleempty\doscaleandclip} \def\doscaleandclip[#1][#2]% {\bgroup \ifsecondargument \edef\currentscaleandclip{#1}% \setupcurrentscaleandclip[#2]% \else\iffirstargument \doifassignmentelse{#1} {\let\currentscaleandclip\empty \setupcurrentscaleandclip[#1]} {\edef\currentscaleandclip{#1}} \else \let\currentscaleandclip\empty \fi\fi \dowithnextboxcs\scaleandclip_finish\hbox} \def\scaleandclip_finish {% \d_scaleandclip_requested_wd \dimexpr\scaleandclipparameter\c!width\relax \d_scaleandclip_requested_ht \dimexpr\scaleandclipparameter\c!height\relax % \d_scaleandclip_actual_wd\wd\nextbox \d_scaleandclip_actual_ht\dimexpr\ht\nextbox + \dp\nextbox\relax % \ifdim\dimexpr\d_scaleandclip_actual_wd*100/\d_scaleandclip_requested_wd \dimexpr\d_scaleandclip_actual_ht*100/\d_scaleandclip_requested_ht \relax \setbox\scaleandclip_box\hbox {\scale[\c!width=\d_scaleandclip_requested_wd]{\box\nextbox}}% \scratchdimen=\the\dimexpr(\ht\scaleandclip_box - \d_scaleandclip_requested_ht)/2\relax \clip [ \c!voffset=\scratchdimen, \c!height=\d_scaleandclip_requested_ht, ]{\box\scaleandclip_box}% \else \setbox\scaleandclip_box\hbox {\scale[\c!height=\d_scaleandclip_requested_ht]{\box\nextbox}}% \scratchdimen=\the\dimexpr(\wd\scaleandclip_box - \d_scaleandclip_requested_wd)/2\relax \clip [ \c!hoffset=\scratchdimen, \c!width=\d_scaleandclip_requested_wd, ]{\box\scaleandclip_box}% \fi \egroup} \protect The usage is: \scaleandclip[width=..., height=...]{ ... any box ...} simimlar to the usage of \scale macro. \starttext \dontleavehmode \scaleandclip[width=3cm, height=3cm]{\externalfigure[cow.pdf][width=3cm,frame=on]} \scale[maxwidth=3cm, maxheight=3cm]{\externalfigure[cow.pdf][width=3cm,frame=on]} \dontleavehmode \scaleandclip[width=3cm, height=3cm]{\externalfigure[cow.pdf][width=3cm,height=10cm,frame=on]} \scale[maxwidth=3cm, maxheight=3cm]{\externalfigure[cow.pdf][width=3cm,height=10cm,frame=on]} \dontleavehmode \scaleandclip[width=3cm, height=3cm]{\externalfigure[cow.pdf][width=10cm,height=3cm,frame=on]} \scale[maxwidth=3cm, maxheight=3cm]{\externalfigure[cow.pdf][width=10cm,height=3cm,frame=on]} \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ Thanks Aditya! That is more general and looks more ConTeXt-ish to me with the options. I should study your code in detail to learn how that is done. Mikael ___ If your question is of interest to others
Re: [NTG-context] resize and center and clip image
Am 01.05.2014 um 20:00 schrieb Aditya Mahajan adit...@umich.edu: On Thu, 1 May 2014, Mikael P. Sundqvist wrote: \startluacode userdata = userdata or {} function userdata.lundklippfyllbild(str, bredd, hojd) if tex.dimen[0] / tex.dimen[2] tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) context(\\vskip%ssp, skalning) context.externalfigure({str},{width=bredd}) context.sprint(foo) else local skalning = -0.5*(tex.dimen[6]/tex.dimen[2]*tex.dimen[0]-tex.dimen[4]) context(\\hskip%ssp, skalning) context.externalfigure({str},{height=hojd}) context.sprint(bar) end end \stopluacode \unexpanded\def\lundklippfyllbild#1#2#3{% \startexternalfigurecollection[#1]% \useexternalfigure[#1][#1]% \stopexternalfigurecollection% \clip[ width=#2, height=#3, hoffset=0mm, voffset=0mm, ]{% \framed[width=#2,height=#3,align={middle,lohi},offset=overlay,frame=off]{% \dimen0=\externalfigurecollectionminwidth{#1}% \dimen2=\externalfigurecollectionmaxheight{#1}% \dimen4=#2% \dimen6=#3% {\ctxlua{userdata.lundklippfyllbild([==[#1]==],[==[#2]==],[==[#3]==])} and then run \lundklippfyllbild{k.jpg}{\textwidth}{\textheight} Here is an eTeX solution. \unprotect \newdimen\d_scaleandclip_actual_wd \newdimen\d_scaleandclip_actual_ht \newdimen\d_scaleandclip_requested_wd \newdimen\d_scaleandclip_requested_ht \newbox\scaleandclip_box \installnamespace{scaleandclip} \installcommandhandler \scaleandclip {scaleandclip} \scaleandclip \setupscaleandclip [width=\textwidth, height=\textheight] \unexpanded\def\scaleandclip{\dodoubleempty\doscaleandclip} \def\doscaleandclip[#1][#2]% {\bgroup \ifsecondargument \edef\currentscaleandclip{#1}% \setupcurrentscaleandclip[#2]% \else\iffirstargument \doifassignmentelse{#1} {\let\currentscaleandclip\empty \setupcurrentscaleandclip[#1]} {\edef\currentscaleandclip{#1}} \else \let\currentscaleandclip\empty \fi\fi \dowithnextboxcs\scaleandclip_finish\hbox} \def\scaleandclip_finish {% \d_scaleandclip_requested_wd \dimexpr\scaleandclipparameter\c!width\relax \d_scaleandclip_requested_ht \dimexpr\scaleandclipparameter\c!height\relax % \d_scaleandclip_actual_wd\wd\nextbox \d_scaleandclip_actual_ht\dimexpr\ht\nextbox + \dp\nextbox\relax % \ifdim\dimexpr\d_scaleandclip_actual_wd*100/\d_scaleandclip_requested_wd \dimexpr\d_scaleandclip_actual_ht*100/\d_scaleandclip_requested_ht \relax \setbox\scaleandclip_box\hbox {\scale[\c!width=\d_scaleandclip_requested_wd]{\box\nextbox}}% \scratchdimen=\the\dimexpr(\ht\scaleandclip_box - \d_scaleandclip_requested_ht)/2\relax \clip [ \c!voffset=\scratchdimen, \c!height=\d_scaleandclip_requested_ht, ]{\box\scaleandclip_box}% \else \setbox\scaleandclip_box\hbox {\scale[\c!height=\d_scaleandclip_requested_ht]{\box\nextbox}}% \scratchdimen=\the\dimexpr(\wd\scaleandclip_box - \d_scaleandclip_requested_wd)/2\relax \clip [ \c!hoffset=\scratchdimen, \c!width=\d_scaleandclip_requested_wd, ]{\box\scaleandclip_box}% \fi \egroup} \protect The usage is: \scaleandclip[width=..., height=...]{ ... any box ...} simimlar to the usage of \scale macro. We should convince Hans to add this functionality to the \scale macro with “factor=clip”. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Clip and framed not precise in MKIV
Hi, I've used ConTeXt to chop up a big map svg on separate A4 papers like this: \setuplayout[width=190mm,backspace=10mm,height=297mm,topspace=10mm, header=0mm] \setupclipping[nx=3,ny=3] \starttext \dorecurse{3}{\framed{\clip[x=\recurselevel,y=1]{\externalfigure[map.svg][width=570mm]}}} \dorecurse{3}{\framed{\clip[x=\recurselevel,y=2]{\externalfigure[map.svg][width=570mm]}}} \dorecurse{3}{\framed{\clip[x=\recurselevel,y=3]{\externalfigure[map.svg][width=570mm]}}} \stoptext I'm using framed to indicate where the pieces should be cut. The problem is that \framed does not frame the area produced by \clip precisely. There is a small gap between the frame border and the clipped image area and the gap is of different size on the left and right sizes than for example on the bottom. Am I overlooking some default setting? Shouldn't \framed frame the object inside it without leaving a padding between them? Best regards, Otso Helenius ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Clip and framed not precise in MKIV
Am 21.09.2011 14:26, schrieb Otso Helenius: Hi, I've used ConTeXt to chop up a big map svg on separate A4 papers like this: \setuplayout[width=190mm,backspace=10mm,height=297mm,topspace=10mm, header=0mm] \setupclipping[nx=3,ny=3] \starttext \dorecurse{3}{\framed{\clip[x=\recurselevel,y=1]{\externalfigure[map.svg][width=570mm]}}} \dorecurse{3}{\framed{\clip[x=\recurselevel,y=2]{\externalfigure[map.svg][width=570mm]}}} \dorecurse{3}{\framed{\clip[x=\recurselevel,y=3]{\externalfigure[map.svg][width=570mm]}}} \stoptext I'm using framed to indicate where the pieces should be cut. The problem is that \framed does not frame the area produced by \clip precisely. There is a small gap between the frame border and the clipped image area and the gap is of different size on the left and right sizes than for example on the bottom. Am I overlooking some default setting? Shouldn't \framed frame the object inside it without leaving a padding between them? \framed is normally used for text elements, so the default offset is some pt (no offset would look ugly). For graphics (and no offset) use \framed[offset=0pt,strut=no,...]{...} offset=0pt no additional offset between border and content; 'offset=none' should work too strut=nostrut is not added (makes only sense for text) Best wishes, Peter ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Trying to get figure frame corners to clip figure
On Thu, 2011-07-07 at 07:35 +0200, Wolfgang Schuster wrote: There is a example in the metafun manual: http://pragma-ade.com/show-man-7.htm Wolfgang Wolfgang, I appreciate the effort, but you've linked me to a 657 page manual which is totally useless to me. I don't have time to learn another language. I've already spent a great deal of time just trying to learn ConTeXt and get that up and running. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com signature.asc Description: This is a digitally signed message part ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Trying to get figure frame corners to clip figure
Hey list, I'd like the rounded corners of my figure's frame to clip off the outside corners of the image so they aren't sticking out. This is what I'm making do with: \setupexternalfigures [frame=on, corner=25, framecolor=colour_frame_border, background=color, backgroundcolor=colour_page, rulethickness=2pt] It almost works, but the image still sticks out at the corners beyond the frame edge. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com signature.asc Description: This is a digitally signed message part ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Trying to get figure frame corners to clip figure
On Wed, 6 Jul 2011, Kip Warner wrote: Hey list, I'd like the rounded corners of my figure's frame to clip off the outside corners of the image so they aren't sticking out. This is what I'm making do with: \setupexternalfigures [frame=on, corner=25, framecolor=colour_frame_border, background=color, backgroundcolor=colour_page, rulethickness=2pt] It almost works, but the image still sticks out at the corners beyond the frame edge. You can use \clip[mp=...]{\framed[...]{...}} (I think that the metafun manual gives an example). Aditya ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Trying to get figure frame corners to clip figure
On Wed, 2011-07-06 at 23:48 -0400, Aditya Mahajan wrote: You can use \clip[mp=...]{\framed[...]{...}} (I think that the metafun manual gives an example). Aditya Thanks Aditya, I'll look into it. I searched both the reference and tutorial pdf and there is no description of \clip, but I found some things that use it on the wiki. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com signature.asc Description: This is a digitally signed message part ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Trying to get figure frame corners to clip figure
On Wed, 2011-07-06 at 23:48 -0400, Aditya Mahajan wrote: You can use \clip[mp=...]{\framed[...]{...}} (I think that the metafun manual gives an example). Aditya Aditya, correct me if wrong, but it looks like \clip performs rectangular clipping only? As I mentioned earlier, I'd like the rounded corners of my figure's frame to clip off the outside corners of the image so they aren't sticking out. This is what I'm making do with so far: \setupexternalfigures [frame=on, corner=25, framecolor=colour_frame_border, background=color, backgroundcolor=colour_page, rulethickness=2pt] What would the syntax for \setupclipping look like to have that done? I can find scant documentation for either that or \clip. -- Kip Warner -- Software Engineer OpenPGP encrypted/signed mail preferred http://www.thevertigo.com signature.asc Description: This is a digitally signed message part ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Trying to get figure frame corners to clip figure
Am 07.07.2011 um 07:18 schrieb Kip Warner: On Wed, 2011-07-06 at 23:48 -0400, Aditya Mahajan wrote: You can use \clip[mp=...]{\framed[...]{...}} (I think that the metafun manual gives an example). Aditya Aditya, correct me if wrong, but it looks like \clip performs rectangular clipping only? As I mentioned earlier, I'd like the rounded corners of my figure's frame to clip off the outside corners of the image so they aren't sticking out. This is what I'm making do with so far: \setupexternalfigures [frame=on, corner=25, framecolor=colour_frame_border, background=color, backgroundcolor=colour_page, rulethickness=2pt] What would the syntax for \setupclipping look like to have that done? I can find scant documentation for either that or \clip. There is a example in the metafun manual: http://pragma-ade.com/show-man-7.htm 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Using text as a clip path for Metafun free shape paragraphs
Thanks to Wolfgang for the instructions on changing fonts, \switchtobodyfont works as expected. I still have to dig up the exact definitions of both \switchtobodyfont and \switchtotypeface, as the latter command seems to work in Hans' examples (for example showfont.pdf) but not with my installation. Now, I've been trying to use metapost for achieving magazine type layout with ConTeXt, and have a question about the following features: 1) Is it possible to use TeX typeset text as a clipping path for MP graphics? What I would like to achieve is a similar cut mask as seen in this picture: https://modernpost.files.wordpress.com/2009/10/rockstar11091.jpg i.e. the text outline cuts a hole in the brown filled rectangle revealing the bitmap below. I can cut pictures easily with paths in MP like so: \startMPcode fill unitsquare xysized (100mm,100mm) withcolor green; picture cur; cur := currentpicture; currentpicture := nullpicture; fill unitsquare xysized (100mm,100mm) withcolor blue; path mask; mask := unitsquare xysized (100mm,100mm) -- reverse unitsquare xysized (100mm,10mm) shifted (0mm,45mm) -- cycle; clip cur to mask; draw cur; \stopMPcode But I can't cut pictures with pictures (only with masks), nor have I found a way in any of the manuals (mmakempy.pdf, metafun-p.pdf, metapostmanual.pdf) to output text outline as paths which could be used for cutting a hole in the mask picture. Is this possible? 2) MP gives an easy way to format free flowing paragraph shapes similar to this image: http://www.davidlcade.com/images/gropius/g2.png . I have followed the instructions on pages 435-444. The problem with this approach is that the text which will be placed in a freely shaped paragraph will be a separate block which won't flow freely with other text in the document body if the contents on earlier pages change. I guess this drops in the category of big feature requests, but it would be nice to be able to define the shapes and positions of ConTeXt columns/paragraphs with MP graphics. In InDesign columns of any shape anywhere on the page can be connected without having to separate one block of text from the rest. With this feature one could define for example a 2-page spread for a magazine (with free shape graphics and columns) in between two ordinarily defined pages and would not have to manually disrupt the body text flow through the document. Best regards, Otso Helenius ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Using text as a clip path for Metafun free shape paragraphs
On 22-5-2011 5:09, Otso Helenius wrote: With this feature one could define for example a 2-page spread for a magazine (with free shape graphics and columns) in between two ordinarily defined pages and would not have to manually disrupt the body text flow through the document. It can probably be done with transparency (soft/hard masking) but I never looked into that (never needed it and I have no pdf examples anyway). Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] problem with mp clip
Patrick Gundlach schrieb: Is there a way to add the test pictures (cont-img.zip) to 'live context'? They are already installed, but not in a local path. I have changed 'live context' so now the sample figures are in the search path. Patrick Thanks Patrick! This makes life easier :) Peter ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] problem with mp clip
Hans Hagen schrieb: Peter Rolf wrote: Hi, it seems, that clipping with a MetaPost path is broken (at least on my machine). I couldn't test it on Contextgarden, as the standard example pictures are not installed (or the !!path is not searched). Anyhow, if someone can test this please. has to do with the changed mp output ... in supp-mps.tex change this ... \bgroup \catcode`\%=\@@active \catcode`\/=\@@comment \gdef\dograbMPclippath/ {\setbox\scratchbox=\hbox\bgroup/ \catcode`\%=\@@active \obeylines\let\obeyedline\space \def\do##1q n##2p W##3\od/ {\xdef\MPclippath{##2}\endinput}/ \def%##1%%EOF/ {\do##1q np W\od\endinput}/ \readfile{\MPgraphicfile.\the\currentMPgraphic}{}{}/ \ifx\MPclippath\empty \def\do##1newpath##2closepath##3\od/ {\xdef\MPclippath{##2}\endinput}/ \def%##1%%EOF/ {\do##1newpathclosepath\od\endinput}/ \readfile{\MPgraphicfile.\the\currentMPgraphic}{}{}/ \fi \deallocateMPslot\currentMPgraphic / new \egroup} \egroup keep in mind that it's still a dirty trick Many thanks Hans. Works like a charm (dirty trick, but clean cut). Peter I work with the latest minimal distribution (XP), ConTeXt beta from 03.07.2007, pdftex 1.40.4 and mpost 1.0. Thanks in advance, Peter @Patrick: Is there a way to add the test pictures (cont-img.zip) to 'live context'? ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] problem with mp clip
Hi, it seems, that clipping with a MetaPost path is broken (at least on my machine). I couldn't test it on Contextgarden, as the standard example pictures are not installed (or the !!path is not searched). Anyhow, if someone can test this please. I work with the latest minimal distribution (XP), ConTeXt beta from 03.07.2007, pdftex 1.40.4 and mpost 1.0. Thanks in advance, Peter @Patrick: Is there a way to add the test pictures (cont-img.zip) to 'live context'? \setupcolors[state=start] \setuppagenumber[state=stop] \startMPclip{ClipTest} clip currentpicture to unitcircle scaled 3cm; \stopMPclip \starttext \clip[width=3cm,height=3cm,mp=ClipTest]{\externalfigure[mill.png]} \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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] problem with mp clip
Is there a way to add the test pictures (cont-img.zip) to 'live context'? They are already installed, but not in a local path. I have changed 'live context' so now the sample figures are in the search path. Patrick ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] problem with mp clip
Peter Rolf wrote: Hi, it seems, that clipping with a MetaPost path is broken (at least on my machine). I couldn't test it on Contextgarden, as the standard example pictures are not installed (or the !!path is not searched). Anyhow, if someone can test this please. has to do with the changed mp output ... in supp-mps.tex change this ... \bgroup \catcode`\%=\@@active \catcode`\/=\@@comment \gdef\dograbMPclippath/ {\setbox\scratchbox=\hbox\bgroup/ \catcode`\%=\@@active \obeylines\let\obeyedline\space \def\do##1q n##2p W##3\od/ {\xdef\MPclippath{##2}\endinput}/ \def%##1%%EOF/ {\do##1q np W\od\endinput}/ \readfile{\MPgraphicfile.\the\currentMPgraphic}{}{}/ \ifx\MPclippath\empty \def\do##1newpath##2closepath##3\od/ {\xdef\MPclippath{##2}\endinput}/ \def%##1%%EOF/ {\do##1newpathclosepath\od\endinput}/ \readfile{\MPgraphicfile.\the\currentMPgraphic}{}{}/ \fi \deallocateMPslot\currentMPgraphic / new \egroup} \egroup keep in mind that it's still a dirty trick I work with the latest minimal distribution (XP), ConTeXt beta from 03.07.2007, pdftex 1.40.4 and mpost 1.0. Thanks in advance, Peter @Patrick: Is there a way to add the test pictures (cont-img.zip) to 'live context'? ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] clip bug?
Dear Hans, it seems to me that \clip was extended by the useful params left|right|top|bottomoffset. But they do not work: \starttext \clip [leftoffset=1cm,rightoffset=1cm,topoffset=2cm,bottomoffset=.5cm] {\externalfigure[cow]} \stoptext Thanks Vit ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context