ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* fontsize drawing in metapost
@ 2013-05-06 15:41 Meer, H. van der
  2013-05-06 16:04 ` Marco Patzer
  0 siblings, 1 reply; 7+ messages in thread
From: Meer, H. van der @ 2013-05-06 15:41 UTC (permalink / raw)
  To: NTG ConTeXt

What is the simplest way to change the size of fonts in labels drawn in MetaPost?
\switchtobodyfont[size] can be done in \startMPenvironment and inside each label.
But is it possible to have:

set-font-to-size1
draw labels
set-font-to-size2
draw more labels

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: fontsize drawing in metapost
  2013-05-06 15:41 fontsize drawing in metapost Meer, H. van der
@ 2013-05-06 16:04 ` Marco Patzer
  2013-05-06 18:57   ` Meer, H. van der
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Patzer @ 2013-05-06 16:04 UTC (permalink / raw)
  To: ntg-context


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

On 2013–05–06 Meer, H. van der wrote:

> What is the simplest way to change the size of fonts in labels drawn in MetaPost?

Probably a font switch directly in the label:

  label("\small foobar", origin);

> \switchtobodyfont[size] can be done in \startMPenvironment and inside each label.

Better use setupMPinstance:

  \setupMPinstance
    [metafun]
    [textstyle=\small]

Marco

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: fontsize drawing in metapost
  2013-05-06 16:04 ` Marco Patzer
@ 2013-05-06 18:57   ` Meer, H. van der
  2013-05-06 19:57     ` Meer, H. van der
  0 siblings, 1 reply; 7+ messages in thread
From: Meer, H. van der @ 2013-05-06 18:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

This is but a partial solution in my case, for two reasons:
1. \textstyle=\small gives few control, I tried textstyle=5pt without result
2. the setup cannot be placed inside \startuseMPgraphic, where I need it most.

I skimmed through meta-ini.mkiv, but did not find a solution.
It is however quite possible things cannot be done other than by putting a fontchange inside each label.

Hans van der Meer



On 6 May 2013, at 6:04 PM, Marco Patzer <homerow@lavabit.com> wrote:

> On 2013–05–06 Meer, H. van der wrote:
> 
>> What is the simplest way to change the size of fonts in labels drawn in MetaPost?
> 
> Probably a font switch directly in the label:
> 
>  label("\small foobar", origin);
> 
>> \switchtobodyfont[size] can be done in \startMPenvironment and inside each label.
> 
> Better use setupMPinstance:
> 
>  \setupMPinstance
>    [metafun]
>    [textstyle=\small]
> 
> Marco
> ______________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: fontsize drawing in metapost
  2013-05-06 18:57   ` Meer, H. van der
@ 2013-05-06 19:57     ` Meer, H. van der
  2013-05-07  6:55       ` Meer, H. van der
  0 siblings, 1 reply; 7+ messages in thread
From: Meer, H. van der @ 2013-05-06 19:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I did some further experimentation, hoping using dimexp calculations would help. But either I am doing somthing wrong or I do not understand the innards of bodyfont switching well enough.
The example program seems to have accessed a 30 pt font (see the log file) but did not typeset in it, the dimexpr does evaluates to 30 pt.
Where am I at fault?

Hans van der Meer

\setuppapersize[A6][A6]
\setupbodyfont[10pt]
\starttext
10pt\ \begingroup\switchtobodyfont[20pt]20pt\endgroup\ 10pt\par
\writestatus{==============}{}
10pt\ \begingroup\switchtobodyfont[\the\dimexpr(3\bodyfontsize)] times 3\endgroup\ 10pt\par
dimexpr=\the\dimexpr(3\bodyfontsize)\par
\stoptext

fonts           > 'fallback modern rm 10pt' is loaded
fonts           > bodyfont '20pt' is defined (can better be done global)
fonts           > bodyfont '24pt' is defined (can better be done global)
fonts           > bodyfont '16pt' is defined (can better be done global)
==============  >
fonts           > bodyfont '30.0pt' is defined (can better be done global)
fonts           > bodyfont '36pt' is defined (can better be done global)
fonts           > bodyfont '24pt' is defined (can better be done global)
fonts           > bodyfont '30.0pt' is defined (can better be done global)
fonts           > bodyfont '30.0pt' is not defined


On 6 May 2013, at 8:57 PM, "Meer, H. van der" <H.vanderMeer@uva.nl<mailto:H.vanderMeer@uva.nl>> wrote:

This is but a partial solution in my case, for two reasons:
1. \textstyle=\small gives few control, I tried textstyle=5pt without result
2. the setup cannot be placed inside \startuseMPgraphic, where I need it most.

I skimmed through meta-ini.mkiv, but did not find a solution.
It is however quite possible things cannot be done other than by putting a fontchange inside each label.

Hans van der Meer



On 6 May 2013, at 6:04 PM, Marco Patzer <homerow@lavabit.com<mailto:homerow@lavabit.com>> wrote:

On 2013–05–06 Meer, H. van der wrote:

What is the simplest way to change the size of fonts in labels drawn in MetaPost?

Probably a font switch directly in the label:

label("\small foobar", origin);

\switchtobodyfont[size] can be done in \startMPenvironment and inside each label.

Better use setupMPinstance:

\setupMPinstance
  [metafun]
  [textstyle=\small]

Marco
_____________________________________________________________________________

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

[-- Attachment #2: dimexpr.pdf --]
[-- Type: application/pdf, Size: 6274 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: fontsize drawing in metapost
  2013-05-06 19:57     ` Meer, H. van der
@ 2013-05-07  6:55       ` Meer, H. van der
  2013-05-07  7:35         ` Marco Patzer
  0 siblings, 1 reply; 7+ messages in thread
From: Meer, H. van der @ 2013-05-07  6:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

The reason behind starting this thread was the fact that I want my \useMPgraphic's arbitrarily (and perfectly) scaled. In Metapost/Metafun that is easily done through a \MPvar{scale} variable, applied to the main dimensions on which all measures in my figures depend. But for the fontsizes this turned out to be not so easy. Understandable, because text is typeset at the TeX-end not inside the Metapost.

Perhaps a better and possibly more elegant way seems the following route. When I turn Metapost figures into external pdf-files, these can be placed with \useexternalfigure and the scaled as a whole, drawing and text alike. My question is: can this be done without resorting to an external pdf? That is, can I pick up the result of \useMPgraphic somewhere, then put this in \useexternalfigure and apply everything possible there to the figure.

Does someone know how to?

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: fontsize drawing in metapost
  2013-05-07  6:55       ` Meer, H. van der
@ 2013-05-07  7:35         ` Marco Patzer
  2013-05-07  8:01           ` Meer, H. van der
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Patzer @ 2013-05-07  7:35 UTC (permalink / raw)
  To: ntg-context


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

On 2013–05–07 Meer, H. van der wrote:

> Perhaps a better and possibly more elegant way seems the following
> route. When I turn Metapost figures into external pdf-files, these
> can be placed with \useexternalfigure and the scaled as a whole,
> drawing and text alike. My question is: can this be done without
> resorting to an external pdf? That is, can I pick up the result of
> \useMPgraphic somewhere, then put this in \useexternalfigure and
> apply everything possible there to the figure.

You could use \scale :

\startuseMPgraphic{foo}
  fill unitcircle scaled 1cm;
  label("Foo", origin);
\stopuseMPgraphic

\starttext
                                \useMPgraphic{foo}
  \scale[width=3cm]            {\useMPgraphic{foo}}
  \scale[width=3cm,height=5cm] {\useMPgraphic{foo}}
  \scale[scale=2500]           {\useMPgraphic{foo}}
\stoptext

Marco

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: fontsize drawing in metapost
  2013-05-07  7:35         ` Marco Patzer
@ 2013-05-07  8:01           ` Meer, H. van der
  0 siblings, 0 replies; 7+ messages in thread
From: Meer, H. van der @ 2013-05-07  8:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thanks. This is exactly what is needed. I feel myself somewhat silly, because I did try \scale, but with the wrong parameter setup; nothing happened then, of course. Now I know to do it right!

Hans van der Meer



On 7 May 2013, at 9:35 AM, Marco Patzer <homerow@lavabit.com>
 wrote:

> On 2013–05–07 Meer, H. van der wrote:
> 
>> Perhaps a better and possibly more elegant way seems the following
>> route. When I turn Metapost figures into external pdf-files, these
>> can be placed with \useexternalfigure and the scaled as a whole,
>> drawing and text alike. My question is: can this be done without
>> resorting to an external pdf? That is, can I pick up the result of
>> \useMPgraphic somewhere, then put this in \useexternalfigure and
>> apply everything possible there to the figure.
> 
> You could use \scale :
> 
> \startuseMPgraphic{foo}
>  fill unitcircle scaled 1cm;
>  label("Foo", origin);
> \stopuseMPgraphic
> 
> \starttext
>                                \useMPgraphic{foo}
>  \scale[width=3cm]            {\useMPgraphic{foo}}
>  \scale[width=3cm,height=5cm] {\useMPgraphic{foo}}
>  \scale[scale=2500]           {\useMPgraphic{foo}}
> \stoptext
> 
> Marco
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________


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

end of thread, other threads:[~2013-05-07  8:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06 15:41 fontsize drawing in metapost Meer, H. van der
2013-05-06 16:04 ` Marco Patzer
2013-05-06 18:57   ` Meer, H. van der
2013-05-06 19:57     ` Meer, H. van der
2013-05-07  6:55       ` Meer, H. van der
2013-05-07  7:35         ` Marco Patzer
2013-05-07  8:01           ` Meer, H. van der

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