ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* definebodyfontenvironment
@ 2016-05-14 15:55 Meer, Hans van der
  2016-05-14 18:00 ` definebodyfontenvironment Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Meer, Hans van der @ 2016-05-14 15:55 UTC (permalink / raw)
  To: NTG ConTeXt


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

I like to execute this statement
\definebodyfontenvironment[somevalue]
in order to avoid lots of error messages as such:
fonts > bodyfont '8.0pt' is defined (can better be done global

Is this definebodyfontenvironment macro fully executed each time it is called or does ConTeXt remember and execute it once only?

Hans van der Meer





[-- Attachment #1.2: Type: text/html, Size: 1539 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] 4+ messages in thread

* Re: definebodyfontenvironment
  2016-05-14 15:55 definebodyfontenvironment Meer, Hans van der
@ 2016-05-14 18:00 ` Wolfgang Schuster
  2016-05-14 19:13   ` definebodyfontenvironment Meer, Hans van der
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2016-05-14 18:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

> Meer, Hans van der <mailto:H.vanderMeer@uva.nl>
> 14. Mai 2016 um 17:55
> I like to execute this statement
> \definebodyfontenvironment[somevalue]
> in order to avoid lots of error messages as such:
> fonts > bodyfont '8.0pt' is defined (can better be done global
>
> Is this definebodyfontenvironment macro fully executed each time it is 
> called or does ConTeXt remember and execute it once only?
Just put it at the begin of the document.

\definebodyfontenvironment[18pt]

\starttext

\dorecurse{10}
   {\begingroup
    \switchtobodyfont[18pt]
    \endgroup}

\stoptext

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2450 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] 4+ messages in thread

* Re: definebodyfontenvironment
  2016-05-14 18:00 ` definebodyfontenvironment Wolfgang Schuster
@ 2016-05-14 19:13   ` Meer, Hans van der
  2016-05-16 20:22     ` definebodyfontenvironment Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Meer, Hans van der @ 2016-05-14 19:13 UTC (permalink / raw)
  To: NTG ConTeXt


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

I think I did not state the problem clear enough.
The solution given here supposes that the fontsize is known beforehand.
However, what I am doing is calculating a font size based on the current one and than switch to that size.
It is part of a fontsize changing mechanism inside an xmlsetup. In short what I am doing is:

\scratchdimen=\the\dimexpr\bodyfontsize\relax
\advance\scratchdimen 'somevalue' \relax
% \definebodyfontenvironment[\the\scratchdimen]
\begingroup
% must keep the change local
\switchtobodyfont[\the\scratchdimen]
...
\endgroup

The commented out \definebodyfontenvironment kills a lot of the font messages but I fear that each the time the same work is done as without it. The only benefit being the suppression of the font messages in the log ;-)

It might be impossible to accomplish this efficiently -- that is execute the font calculations once only for the given size. But at least I would like to give it a try.

Hans van der Meer




On 14 May 2016, at 20:00, Wolfgang Schuster <schuster.wolfgang@gmail.com<mailto:schuster.wolfgang@gmail.com>> wrote:

Meer, Hans van der<mailto:H.vanderMeer@uva.nl>
14. Mai 2016 um 17:55
I like to execute this statement
\definebodyfontenvironment[somevalue]
in order to avoid lots of error messages as such:
fonts > bodyfont '8.0pt' is defined (can better be done global

Is this definebodyfontenvironment macro fully executed each time it is called or does ConTeXt remember and execute it once only?
Just put it at the begin of the document.

\definebodyfontenvironment[18pt]

\starttext

\dorecurse{10}
  {\begingroup
   \switchtobodyfont[18pt]
   \endgroup}

\stoptext

Wolfgang
___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 5434 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] 4+ messages in thread

* Re: definebodyfontenvironment
  2016-05-14 19:13   ` definebodyfontenvironment Meer, Hans van der
@ 2016-05-16 20:22     ` Wolfgang Schuster
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2016-05-16 20:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

> Meer, Hans van der <mailto:H.vanderMeer@uva.nl>
> 14. Mai 2016 um 21:13
> I think I did not state the problem clear enough.
> The solution given here supposes that the fontsize is known beforehand.
> However, what I am doing is calculating a font size based on the 
> current one and than switch to that size.
> It is part of a fontsize changing mechanism inside an xmlsetup. In 
> short what I am doing is:
>
> \scratchdimen=\the\dimexpr\bodyfontsize\relax
> \advance\scratchdimen 'somevalue' \relax
> %\definebodyfontenvironment[\the\scratchdimen]
> \begingroup
> % must keep the change local
> \switchtobodyfont[\the\scratchdimen]
> ...
> \endgroup
>
> The commented out \definebodyfontenvironment kills a lot of the font 
> messages but I fear that each the time the same work is done as 
> without it. The only benefit being the suppression of the font 
> messages in the log ;-)
>
> It might be impossible to accomplish this efficiently -- that is 
> execute the font calculations once only for the given size. But at 
> least I would like to give it a try.
>
You can save time with the \definebodyfontenvironment command.

In the following example context has to create a new bodyfont
environment for each iteration (because the values are local
to the group) to calculate the a, b, c etc. sizes which takes time
but in the same loop context only has to load the predefined size.

\starttext

\testfeatureonce{1000}
   {\begingroup
    \switchtobodyfont[18pt]
    \endgroup}

\definebodyfontenvironment[18pt]

\testfeatureonce{1000}
   {\begingroup
    \switchtobodyfont[18pt]
    \endgroup}

\stoptext

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 3959 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] 4+ messages in thread

end of thread, other threads:[~2016-05-16 20:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-14 15:55 definebodyfontenvironment Meer, Hans van der
2016-05-14 18:00 ` definebodyfontenvironment Wolfgang Schuster
2016-05-14 19:13   ` definebodyfontenvironment Meer, Hans van der
2016-05-16 20:22     ` definebodyfontenvironment Wolfgang Schuster

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