ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Fwd: Re: text width shadow background
       [not found] <030fe06a-f8fc-f7e6-015e-020348328a1d@freedom.nl>
@ 2023-07-08  9:39 ` Hans Hagen via ntg-context
  2023-07-08 11:07   ` Henning Hraban Ramm
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2023-07-08  9:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen




-------- Forwarded Message --------
Subject: Re: [NTG-context] Re: text width shadow background
Date: Sat, 8 Jul 2023 11:39:32 +0200
From: Hans Hagen <j.hagen@freedom.nl>
To: Henning Hraban Ramm <texml@fiee.net>

On 7/8/2023 8:55 AM, Henning Hraban Ramm wrote:
> Please, can you explain why the result of lmt_outline is shifted to the 
> right, if I use it in a macro?

no time now but you can do this instead of the lmt_text:

     draw lmt_outline [
         text = "\bf\strut #1",
         kind = "fillup",
         fillcolor = "white",
         rulethickness = rulesize,
     ];

(maybe spaces creep in due to loading font files / setups or so)

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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________


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

* Re: Fwd: Re: text width shadow background
  2023-07-08  9:39 ` Fwd: Re: text width shadow background Hans Hagen via ntg-context
@ 2023-07-08 11:07   ` Henning Hraban Ramm
       [not found]     ` <6c3569e3-411e-8cd9-912d-d318e822bb04@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Henning Hraban Ramm @ 2023-07-08 11:07 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

Am 08.07.23 um 11:39 schrieb Hans Hagen via ntg-context:
> On 7/8/2023 8:55 AM, Henning Hraban Ramm wrote:
>> Please, can you explain why the result of lmt_outline is shifted to 
>> the right, if I use it in a macro?
> 
> no time now but you can do this instead of the lmt_text:
> 
>      draw lmt_outline [
>          text = "\bf\strut #1",
>          kind = "fillup",
>          fillcolor = "white",
>          rulethickness = rulesize,
>      ];
> 
> (maybe spaces creep in due to loading font files / setups or so)

Thank you!
Yes, this works, and with rulethickness=0 it even looks like I wanted it to.

Hraban

[-- Attachment #2: outline-shadow.png --]
[-- Type: image/png, Size: 44986 bytes --]

[-- Attachment #3: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

* Re: Fwd: Re: text width shadow background
       [not found]     ` <6c3569e3-411e-8cd9-912d-d318e822bb04@gmail.com>
@ 2023-07-08 14:28       ` Henning Hraban Ramm
  2023-07-09 13:49         ` Keith McKay
  0 siblings, 1 reply; 7+ messages in thread
From: Henning Hraban Ramm @ 2023-07-08 14:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 08.07.23 um 15:14 schrieb Keith McKay:
> I played about with the number of shadow layers and added a wee bit 
> randomness which gave a nice effect. See the code below and the attached 
> png.

Good idea, makes sense for big text – my captions are only 8pt, there 10 
layers are already a lot, and the randomness doesn’t make a difference.

For titles, it would be nice to apply lmt_poisson to arbitrary paths.

I wonder what’s possible if we don’t _draw_ lmt_outline but use it as a 
base for more fun…

Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

* Re: Fwd: Re: text width shadow background
  2023-07-08 14:28       ` Henning Hraban Ramm
@ 2023-07-09 13:49         ` Keith McKay
  2023-07-09 15:56           ` Henning Hraban Ramm
  0 siblings, 1 reply; 7+ messages in thread
From: Keith McKay @ 2023-07-09 13:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Henning Hraban Ramm


[-- Attachment #1.1: Type: text/plain, Size: 1928 bytes --]

Hraban (and others),

You got me thinking so I added this code to end of your code as a bit of 
fun. It's code from the luametafun manual to which I added two and a 
half lines.

Best Wishes

Keith

%%%%%%%%%%%%%%%

\startMPcode
vardef tst (expr x, y, i, n) =
definecolor [ name = "MyColor1", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;
definecolor [ name = "MyColor2", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;
draw lmt_outline [
text = "Ein",
kind = "both",
fillcolor = "MyColor1",
drawcolor = "MyColor2",
rulethickness = 1/2,
]ysized (30+5*i/n) shifted (10x,10y) 
rotatedaround(origin,uniformdeviate(360));
enddef ;
draw lmt_poisson [
width = 20,
height = 20,
distance = 1,
count = 20,
macro = "tst"
arguments = 4,
] xsized 6cm ;
\stopMPcode

On 08/07/2023 15:28, Henning Hraban Ramm wrote:
> Am 08.07.23 um 15:14 schrieb Keith McKay:
>> I played about with the number of shadow layers and added a wee bit 
>> randomness which gave a nice effect. See the code below and the 
>> attached png.
>
> Good idea, makes sense for big text – my captions are only 8pt, there 
> 10 layers are already a lot, and the randomness doesn’t make a 
> difference.
>
> For titles, it would be nice to apply lmt_poisson to arbitrary paths.
>
> I wonder what’s possible if we don’t _draw_ lmt_outline but use it as 
> a base for more fun…
>
> Hraban
> ___________________________________________________________________________________ 
>
> If your question is of interest to others as well, please add an entry 
> to the Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : https://contextgarden.net
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 3582 bytes --]

[-- Attachment #2: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

* Re: text width shadow background
  2023-07-09 13:49         ` Keith McKay
@ 2023-07-09 15:56           ` Henning Hraban Ramm
  2023-07-09 17:37             ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Henning Hraban Ramm @ 2023-07-09 15:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 09.07.23 um 15:49 schrieb Keith McKay:
> Hraban (and others),
> 
> You got me thinking so I added this code to end of your code as a bit of 
> fun. It's code from the luametafun manual to which I added two and a 
> half lines.

That’s funny.
I replaced the text by \TeX and published it here: 
https://fosstodon.org/@context/110684919994406565

But is it possible to fill a path (e.g. an lmt_outline) with a 
lmt_poisson pattern?

Hraban

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

* Re: text width shadow background
  2023-07-09 15:56           ` Henning Hraban Ramm
@ 2023-07-09 17:37             ` Hans Hagen via ntg-context
  2023-07-09 18:50               ` Keith McKay
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2023-07-09 17:37 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 7/9/2023 5:56 PM, Henning Hraban Ramm wrote:
> Am 09.07.23 um 15:49 schrieb Keith McKay:
>> Hraban (and others),
>>
>> You got me thinking so I added this code to end of your code as a bit 
>> of fun. It's code from the luametafun manual to which I added two and 
>> a half lines.
> 
> That’s funny.
> I replaced the text by \TeX and published it here: 
> https://fosstodon.org/@context/110684919994406565
> 
> But is it possible to fill a path (e.g. an lmt_outline) with a 
> lmt_poisson pattern?
Here's something to get you and Keith starting:

\startMPpage
picture p ; p := lmt_outline [
     text = "\bf TEST",
     kind = "path",
] ;

path q ; q := for i within p :
     if picture i :
         pathpart i &&
     fi endfor cycle ;

draw q
     withpattern
         textext("\TEX")
         withpatternscale (1/20,1/20)
     ;
\stopMPpage

so the trick is to come up with a pattern that has the right size

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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

* Re: text width shadow background
  2023-07-09 17:37             ` Hans Hagen via ntg-context
@ 2023-07-09 18:50               ` Keith McKay
  0 siblings, 0 replies; 7+ messages in thread
From: Keith McKay @ 2023-07-09 18:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2957 bytes --]

Well this is fun.  Getting the right patterns could make some 
interesting with fonts.

Thanks for the tip Hans!

Best Wishes

Keith McKay

%%%%%%%%%%%%%

\startMPpage
vardef tst (expr x, y, i, n) =
definecolor [ name = "MyColor1", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;
definecolor [ name = "MyColor2", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;
draw lmt_outline [
text = "\TeX",
kind = "both",
fillcolor = "MyColor1",
drawcolor = "MyColor2",
rulethickness = 1/2,
]ysized (30+5*i/n) shifted (10x,10y) 
rotatedaround(origin,uniformdeviate(360));
enddef ;
picture p ; p := lmt_outline [
text = "\bf TEST",
kind = "path",
] scaled 5cm;
path q ; q := for i within p :
if picture i :
pathpart i &&
fi endfor cycle ;
picture r; r:= lmt_poisson [
width = 20,
height = 20,
distance = 1,
count = 10,
macro = "tst"
arguments = 4,
] xsized 6cm ;
draw q
withpattern
r
withpatternscale (1/10,1/3)
;
\stopMPpage

On 09/07/2023 18:37, Hans Hagen via ntg-context wrote:
> On 7/9/2023 5:56 PM, Henning Hraban Ramm wrote:
>> Am 09.07.23 um 15:49 schrieb Keith McKay:
>>> Hraban (and others),
>>>
>>> You got me thinking so I added this code to end of your code as a 
>>> bit of fun. It's code from the luametafun manual to which I added 
>>> two and a half lines.
>>
>> That’s funny.
>> I replaced the text by \TeX and published it here: 
>> https://fosstodon.org/@context/110684919994406565
>>
>> But is it possible to fill a path (e.g. an lmt_outline) with a 
>> lmt_poisson pattern?
> Here's something to get you and Keith starting:
>
> \startMPpage
> picture p ; p := lmt_outline [
>     text = "\bf TEST",
>     kind = "path",
> ] ;
>
> path q ; q := for i within p :
>     if picture i :
>         pathpart i &&
>     fi endfor cycle ;
>
> draw q
>     withpattern
>         textext("\TEX")
>         withpatternscale (1/20,1/20)
>     ;
> \stopMPpage
>
> so the trick is to come up with a pattern that has the right size
>
> 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 / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : https://contextgarden.net
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 5570 bytes --]

[-- Attachment #2: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2023-07-09 18:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <030fe06a-f8fc-f7e6-015e-020348328a1d@freedom.nl>
2023-07-08  9:39 ` Fwd: Re: text width shadow background Hans Hagen via ntg-context
2023-07-08 11:07   ` Henning Hraban Ramm
     [not found]     ` <6c3569e3-411e-8cd9-912d-d318e822bb04@gmail.com>
2023-07-08 14:28       ` Henning Hraban Ramm
2023-07-09 13:49         ` Keith McKay
2023-07-09 15:56           ` Henning Hraban Ramm
2023-07-09 17:37             ` Hans Hagen via ntg-context
2023-07-09 18:50               ` Keith McKay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).