ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MetaPost label font size
@ 2022-07-05 23:00 Henning Hraban Ramm via ntg-context
  2022-07-06  5:17 ` Aditya Mahajan via ntg-context
  2022-07-06 13:24 ` Fabrice L via ntg-context
  0 siblings, 2 replies; 10+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-07-05 23:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm

How can I change the font size of labels within one picture?

Hraban

\startMPpage
defaultfont := "\truefontname{Sans}";
defaultfontsize := \the\bodyfontsize;

label.top(defaultfontsize, (0,0));

defaultfontsize := 4bp;

label.top(defaultfontsize, (50,0));
% shows that the variable changed,
% but font size is the same

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

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

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

* Re: MetaPost label font size
  2022-07-05 23:00 MetaPost label font size Henning Hraban Ramm via ntg-context
@ 2022-07-06  5:17 ` Aditya Mahajan via ntg-context
  2022-07-06  9:23   ` Henning Hraban Ramm via ntg-context
  2022-07-06 13:24 ` Fabrice L via ntg-context
  1 sibling, 1 reply; 10+ messages in thread
From: Aditya Mahajan via ntg-context @ 2022-07-06  5:17 UTC (permalink / raw)
  To: Henning Hraban Ramm via ntg-context; +Cc: Aditya Mahajan

On Wed, 6 Jul 2022, Henning Hraban Ramm via ntg-context wrote:

> How can I change the font size of labels within one picture?

(Untested): See https://www.contextgarden.net/Command/setupMPinstance

\setupMPinstance[metafun][textstyle=sans]

Or define a new instance, which sets the textstyle to sans.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: MetaPost label font size
  2022-07-06  5:17 ` Aditya Mahajan via ntg-context
@ 2022-07-06  9:23   ` Henning Hraban Ramm via ntg-context
  2022-07-06 10:19     ` fv leung via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-07-06  9:23 UTC (permalink / raw)
  To: ntg-context; +Cc: Henning Hraban Ramm

Am 06.07.22 um 07:17 schrieb Aditya Mahajan via ntg-context:
> On Wed, 6 Jul 2022, Henning Hraban Ramm via ntg-context wrote:
> 
>> How can I change the font size of labels within one picture?
> 
> (Untested): See https://www.contextgarden.net/Command/setupMPinstance
> 
> \setupMPinstance[metafun][textstyle=sans]
> 
> Or define a new instance, which sets the textstyle to sans.

Thank you for trying, but that doesn’t seem to have anything to do with 
my question.

I need a different font size for different labels within one picture.

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
___________________________________________________________________________________

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

* Re: MetaPost label font size
  2022-07-06  9:23   ` Henning Hraban Ramm via ntg-context
@ 2022-07-06 10:19     ` fv leung via ntg-context
  2022-07-06 10:45       ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: fv leung via ntg-context @ 2022-07-06 10:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: fv leung


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

My stupid way to get labels of different sizes:

\starttext

\startMPcode

  label("normal label", (0, 0));

  label("\setsmallbodyfont small label", (0, 18));

  label("\setbigbodyfont big label", (0, -18));

\stopMPcode

\stoptext

Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl> 於 2022年7月6日 週三
下午5:23寫道:

> Am 06.07.22 um 07:17 schrieb Aditya Mahajan via ntg-context:
> > On Wed, 6 Jul 2022, Henning Hraban Ramm via ntg-context wrote:
> >
> >> How can I change the font size of labels within one picture?
> >
> > (Untested): See https://www.contextgarden.net/Command/setupMPinstance
> >
> > \setupMPinstance[metafun][textstyle=sans]
> >
> > Or define a new instance, which sets the textstyle to sans.
>
> Thank you for trying, but that doesn’t seem to have anything to do with
> my question.
>
> I need a different font size for different labels within one picture.
>
> 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
>
> ___________________________________________________________________________________
>

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

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

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

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

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

* Re: MetaPost label font size
  2022-07-06 10:19     ` fv leung via ntg-context
@ 2022-07-06 10:45       ` Hans Hagen via ntg-context
  2022-07-06 11:36         ` Henning Hraban Ramm via ntg-context
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen via ntg-context @ 2022-07-06 10:45 UTC (permalink / raw)
  To: fv leung via ntg-context; +Cc: Hans Hagen

On 7/6/2022 12:19 PM, fv leung via ntg-context wrote:
> My stupid way to get labels of different sizes:
> 
> \starttext
> 
> \startMPcode
> 
>    label("normal label", (0, 0));
> 
>    label("\setsmallbodyfont small label", (0, 18));
> 
>    label("\setbigbodyfont big label", (0, -18));
> 
> \stopMPcode
> 
> \stoptext
nothing stupid about that ... it's how i would do it

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

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

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

* Re: MetaPost label font size
  2022-07-06 10:45       ` Hans Hagen via ntg-context
@ 2022-07-06 11:36         ` Henning Hraban Ramm via ntg-context
  2022-07-06 12:26           ` fv leung via ntg-context
  2022-07-06 12:36           ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 10+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-07-06 11:36 UTC (permalink / raw)
  To: ntg-context; +Cc: Henning Hraban Ramm

Am 06.07.22 um 12:45 schrieb Hans Hagen via ntg-context:
> On 7/6/2022 12:19 PM, fv leung via ntg-context wrote:
>> My stupid way to get labels of different sizes:
>>
>> \starttext
>>
>> \startMPcode
>>
>>    label("normal label", (0, 0));
>>
>>    label("\setsmallbodyfont small label", (0, 18));
>>
>>    label("\setbigbodyfont big label", (0, -18));
>>
>> \stopMPcode
>>
>> \stoptext
> nothing stupid about that ... it's how i would do it

Okay. So there’s really no possibility to adapt whatever defines the 
label font size except defaultfontsize inbetween? Strange.

My solution so far was to split the picture and re-combine it afterwards.

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
___________________________________________________________________________________

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

* Re: MetaPost label font size
  2022-07-06 11:36         ` Henning Hraban Ramm via ntg-context
@ 2022-07-06 12:26           ` fv leung via ntg-context
  2022-07-06 12:36           ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 10+ messages in thread
From: fv leung via ntg-context @ 2022-07-06 12:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: fv leung


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

I've used something like the following before.


\starttext

\startMPcode

  label("normal label", (0, 0));

  label("{\switchtobodyfont[3pt] tiny label}", (0, 18));

  label("{\switchtobodyfont[72pt] giant label}", (0, -72));

\stopMPcode

\stoptext

Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl> 於 2022年7月6日 週三
晚上7:36寫道:

> Am 06.07.22 um 12:45 schrieb Hans Hagen via ntg-context:
> > On 7/6/2022 12:19 PM, fv leung via ntg-context wrote:
> >> My stupid way to get labels of different sizes:
> >>
> >> \starttext
> >>
> >> \startMPcode
> >>
> >>    label("normal label", (0, 0));
> >>
> >>    label("\setsmallbodyfont small label", (0, 18));
> >>
> >>    label("\setbigbodyfont big label", (0, -18));
> >>
> >> \stopMPcode
> >>
> >> \stoptext
> > nothing stupid about that ... it's how i would do it
>
> Okay. So there’s really no possibility to adapt whatever defines the
> label font size except defaultfontsize inbetween? Strange.
>
> My solution so far was to split the picture and re-combine it afterwards.
>
> 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
>
> ___________________________________________________________________________________
>

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

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

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

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

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

* Re: MetaPost label font size
  2022-07-06 11:36         ` Henning Hraban Ramm via ntg-context
  2022-07-06 12:26           ` fv leung via ntg-context
@ 2022-07-06 12:36           ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen via ntg-context @ 2022-07-06 12:36 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 7/6/2022 1:36 PM, Henning Hraban Ramm via ntg-context wrote:
> Am 06.07.22 um 12:45 schrieb Hans Hagen via ntg-context:
>> On 7/6/2022 12:19 PM, fv leung via ntg-context wrote:
>>> My stupid way to get labels of different sizes:
>>>
>>> \starttext
>>>
>>> \startMPcode
>>>
>>>    label("normal label", (0, 0));
>>>
>>>    label("\setsmallbodyfont small label", (0, 18));
>>>
>>>    label("\setbigbodyfont big label", (0, -18));
>>>
>>> \stopMPcode
>>>
>>> \stoptext
>> nothing stupid about that ... it's how i would do it
> 
> Okay. So there’s really no possibility to adapt whatever defines the 
> label font size except defaultfontsize inbetween? Strange.
> 
> My solution so far was to split the picture and re-combine it afterwards.
well, if there would be another way you would find it strange there if 
that would interfere with whatever else goes into a label text because 
we support arbitrary tex ... no way to figure out what struts, line 
distances, spacing, either of not adapt to current situation, delayed vs 
immediate inclusion, etc ... you can't have both worlds

if course you can make some macro (or define a highlight) and use that 
in the labels

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

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

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

* Re: MetaPost label font size
  2022-07-05 23:00 MetaPost label font size Henning Hraban Ramm via ntg-context
  2022-07-06  5:17 ` Aditya Mahajan via ntg-context
@ 2022-07-06 13:24 ` Fabrice L via ntg-context
  2022-07-06 15:21   ` Henning Hraban Ramm via ntg-context
  1 sibling, 1 reply; 10+ messages in thread
From: Fabrice L via ntg-context @ 2022-07-06 13:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Fabrice L



> Le 5 juill. 2022 à 19:00, Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl> a écrit :
> 
> How can I change the font size of labels within one picture?
> 
> Hraban
> 
> \startMPpage
> defaultfont := "\truefontname{Sans}";
> defaultfontsize := \the\bodyfontsize;
> 
> label.top(defaultfontsize, (0,0));
> 
> defaultfontsize := 4bp;
> 
> label.top(defaultfontsize, (50,0));
> % shows that the variable changed,
> % but font size is the same
> 
> \stopMPpage

Here are slightly different syntax that could be useful perhaps ? In the second one, the scaled parameter can be replaced easily with a variable, so you can decide and change the size of the label during the course of a picture.

\starttext

\startMPpage
defaultfont := "\truefontname{Sans}";
defaultfontsize := \the\bodyfontsize;

defaultscale := 0.5;
label.top("small label", (-10,0));

defaultscale := 1.0;
label.top("normal label", (50,5));
label.top("another normal label", (50,-5));

defaultscale := 2.0;
label.top("Huge label", (10,-25));

\stopMPpage

\startMPpage

 draw textext.top("small label") scaled 0.5 
 	shifted (-10,0) ;
 draw textext.top("normal label") scaled 1 
 	shifted (50,5) ;
 draw textext.top("second normal label") scaled 1 
 	shifted (50,-5) ;
 draw textext.top("Huge label") scaled 2 
 	shifted (10,-25) ;
 	
\stopMPpage

\stoptext

Fabrice.


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

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

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

* Re: MetaPost label font size
  2022-07-06 13:24 ` Fabrice L via ntg-context
@ 2022-07-06 15:21   ` Henning Hraban Ramm via ntg-context
  0 siblings, 0 replies; 10+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2022-07-06 15:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm

Am 06.07.22 um 15:24 schrieb Fabrice L:
> Here are slightly different syntax that could be useful perhaps ? In the second one, the scaled parameter can be replaced easily with a variable, so you can decide and change the size of the label during the course of a picture.

Thank you (all), I resolved to using the usual \tfx or \definedfont.

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
___________________________________________________________________________________

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

end of thread, other threads:[~2022-07-06 15:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 23:00 MetaPost label font size Henning Hraban Ramm via ntg-context
2022-07-06  5:17 ` Aditya Mahajan via ntg-context
2022-07-06  9:23   ` Henning Hraban Ramm via ntg-context
2022-07-06 10:19     ` fv leung via ntg-context
2022-07-06 10:45       ` Hans Hagen via ntg-context
2022-07-06 11:36         ` Henning Hraban Ramm via ntg-context
2022-07-06 12:26           ` fv leung via ntg-context
2022-07-06 12:36           ` Hans Hagen via ntg-context
2022-07-06 13:24 ` Fabrice L via ntg-context
2022-07-06 15:21   ` Henning Hraban Ramm via ntg-context

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).