From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/94856 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: definebodyfontenvironment Date: Mon, 16 May 2016 22:22:59 +0200 Message-ID: <573A2C23.1040209@gmail.com> References: <46179FCC-3835-4C8A-B154-CB51D5079B44@uva.nl> <573767D9.80406@gmail.com> <25B3B06C-2EB5-48A9-8C8C-1865827277DC@uva.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2530934673373387356==" X-Trace: ger.gmane.org 1463430221 27592 80.91.229.3 (16 May 2016 20:23:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 May 2016 20:23:41 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon May 16 22:23:26 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b2P30-0001uC-8M for gctc-ntg-context-518@m.gmane.org; Mon, 16 May 2016 22:23:26 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 40C5CCC31; Mon, 16 May 2016 22:23:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BtwJbKW_YUxB; Mon, 16 May 2016 22:23:14 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 80803CC38; Mon, 16 May 2016 22:23:14 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 62FFBCC31 for ; Mon, 16 May 2016 22:23:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xAAi7QZ-gu8Z for ; Mon, 16 May 2016 22:23:12 +0200 (CEST) Original-Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id DDEBCCB92 for ; Mon, 16 May 2016 22:23:02 +0200 (CEST) Original-Received: by mail-wm0-f54.google.com with SMTP id n129so115156683wmn.1 for ; Mon, 16 May 2016 13:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=eBiy0+P5wm1XF7lEADL9OHBDLMPB/MW7v76htn9ixTE=; b=OdUzxjEg3CMcor6hR4ylyzXj95uzQH1IYmOExlJSEwF6SZNPQOng2fusB57zcv8TDc M4ZbakmMlVZp2zwQg8J9Oa0/mijnuuV9r5BA/WeI+XVKN8AQJPyR7YibqqCJ4hjuefyl eEr3FkSaOZq8eFWtiK8mKuf6H6d8NPROuDNvnXWDTot+i81D5y5NxHnqjbBrBIppaYn/ VN7E7EPdgv582CEnZ9Vz22VLwIXw8hheg8aey2n1wHlCTXTV2yHPhQ5IduaVlvpsvSHD dIVpc9CWZv7DEFBQNuGWvZ63Lcc5o4GN8llTGSIoxg5leKA69dWfAVjFza+kWOy6s90h rf0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=eBiy0+P5wm1XF7lEADL9OHBDLMPB/MW7v76htn9ixTE=; b=lgmdnztnotoFDnWFPM//9sWo8iDeKXH58a2btoy/cbeu7W60ry1Clf0flHt1r3yvju EAHH6bYp+Ssax6EfwduhlrL3iOwmESwLboErRzLgJREqGRNsqqdckbdiWdOo9cfAQQwu nGHRuhxRon2tkLf53od4+kmY4jf/5SYjif4j0OmlO5QrhbR+X6Zo8ktdIr7bchNAoG2J FBc49kvip7lsIKCm3n9NnqzMUvmbeD+r8B89K9iYIjzRp4m8t9s7rQUXfdF2TqfcD7fI 4eBkeT5npggAO/t4lzB3ITUciyUNwNlGXTLWi4n94f+XRd16La67b7FE+PHRxUDgsI6n V0Tg== X-Gm-Message-State: AOPr4FXOks6HYnnV7I+wNP8p2cKcPwRYhlZqxJU+OZEoAi9Tq10bJtThj3apvUAt9mmDwQ== X-Received: by 10.194.9.233 with SMTP id d9mr35671303wjb.29.1463430182455; Mon, 16 May 2016 13:23:02 -0700 (PDT) Original-Received: from keima.localdomain (x2f22b9a.dyn.telefonica.de. [2.242.43.154]) by smtp.gmail.com with ESMTPSA id lm1sm35452552wjc.25.2016.05.16.13.23.01 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 May 2016 13:23:01 -0700 (PDT) User-Agent: Postbox 4.0.8 (Macintosh/20151105) In-Reply-To: <25B3B06C-2EB5-48A9-8C8C-1865827277DC@uva.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:94856 Archived-At: This is a multi-part message in MIME format. --===============2530934673373387356== Content-Type: multipart/alternative; boundary="------------060106010609070806060107" This is a multi-part message in MIME format. --------------060106010609070806060107 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > Meer, Hans van der > 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 --------------060106010609070806060107 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
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
--------------060106010609070806060107-- --===============2530934673373387356== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============2530934673373387356==--