fontsize drawing in metapost
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
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
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
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 ______________________________________________________________________________
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"
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
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
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
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 ___________________________________________________________________________________
participants (2)
-
Marco Patzer
-
Meer, H. van der