Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Wolfgang Schuster

Am 02.06.2012 um 20:13 schrieb Philipp Gesang:

 Dear listmates,
 
 with \switchtobodyfont I get the interface message “fonts:14”
 from mult-mes.lua (“bodyfont %s is defined (can better be done
 global)”) which is kinda hard to grep for :( Example:
 
  \definebodyfont[42pt][rm][default]
  \starttext
  \switchtobodyfont [42pt]
  \setupbodyfont [42pt]
  \stoptext
 
 Which results in:
 
 
 ... /
 fontsbodyfont 42pt is defined (can better be done global)
 fontsbodyfont 50.4pt is defined (can better be done global)
 fontsbodyfont 40.32pt is defined (can better be done global)
 ... /
 
 
 (\setupbodyfont doesn’t cause it.) It seems harmless but (a) I
 have a conditional font change that may repeat hundreds of times
 over the course of a document and it clutters my terminal, and
 (b) it’s a warning after all, so everything is not as it is
 supposed to be.  What’s it telling me, and why?


Add \definebodyfontenvironment:

\definebodyfontenvironment[42pt]
\starttext
\setupbodyfont[42pt]
\stoptext

Wolfgang
___
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
___


Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Philipp Gesang
Hi Wolfgang!

···date: 2012-06-03, Sunday···from: Wolfgang Schuster···

 Am 02.06.2012 um 20:13 schrieb Philipp Gesang:
 
  Dear listmates,
  
  with \switchtobodyfont I get the interface message “fonts:14”
  from mult-mes.lua (“bodyfont %s is defined (can better be done
  global)”) which is kinda hard to grep for :( Example:
  
   \definebodyfont[42pt][rm][default]
   \starttext
   \switchtobodyfont [42pt]
   \setupbodyfont [42pt]
   \stoptext
  
  Which results in:
  
  
  ... /
  fontsbodyfont 42pt is defined (can better be done global)
  fontsbodyfont 50.4pt is defined (can better be done global)
  fontsbodyfont 40.32pt is defined (can better be done global)
  ... /
  
  
  (\setupbodyfont doesn’t cause it.) It seems harmless but (a) I
  have a conditional font change that may repeat hundreds of times
  over the course of a document and it clutters my terminal, and
  (b) it’s a warning after all, so everything is not as it is
  supposed to be.  What’s it telling me, and why?
 
 
 Add \definebodyfontenvironment:
 
 \definebodyfontenvironment[42pt]
 \starttext
 \setupbodyfont[42pt]
 \stoptext

This is getting interesting now. I already do as you say, but a
bit differently: I’m defining font sizes on the fly, however they
are created from dimensions, so my macros actually expand to
something like:


\definebodyfontenvironment[42.0pt] %% a dozen times
\starttext
\switchtobodyfont[42.0pt]  %% hundreds of times
%\switchtobodyfont[42pt]   %% - this works, though
foo
\stoptext


Which then results in this warning:

fontsbodyfont 42.0pt is defined (can better be done global)


Although the size has been „defined“. My problem appears to be
that I’m abusing dimensions as makeshift floats to calculate
relative font sizes, interlinespace etc. via \dimexpr. Hadn’t
thought about \switchtobodyfont expecting integers.

TeX number types can be confusing.

Thanks for the advice. Best regards
Philipp


 
 Wolfgang
 ___
 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
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


pgp6Ig6fndjnJ.pgp
Description: PGP signature
___
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
___

Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Wolfgang Schuster

Am 03.06.2012 um 12:01 schrieb Philipp Gesang:

 Hi Wolfgang!
 
 ···date: 2012-06-03, Sunday···from: Wolfgang Schuster···
 
 Am 02.06.2012 um 20:13 schrieb Philipp Gesang:
 
 Dear listmates,
 
 with \switchtobodyfont I get the interface message “fonts:14”
 from mult-mes.lua (“bodyfont %s is defined (can better be done
 global)”) which is kinda hard to grep for :( Example:
 
 \definebodyfont[42pt][rm][default]
 \starttext
 \switchtobodyfont [42pt]
 \setupbodyfont [42pt]
 \stoptext
 
 Which results in:
 
 
 ... /
 fontsbodyfont 42pt is defined (can better be done global)
 fontsbodyfont 50.4pt is defined (can better be done global)
 fontsbodyfont 40.32pt is defined (can better be done global)
 ... /
 
 
 (\setupbodyfont doesn’t cause it.) It seems harmless but (a) I
 have a conditional font change that may repeat hundreds of times
 over the course of a document and it clutters my terminal, and
 (b) it’s a warning after all, so everything is not as it is
 supposed to be.  What’s it telling me, and why?
 
 
 Add \definebodyfontenvironment:
 
 \definebodyfontenvironment[42pt]
 \starttext
 \setupbodyfont[42pt]
 \stoptext
 
 This is getting interesting now. I already do as you say, but a
 bit differently: I’m defining font sizes on the fly, however they
 are created from dimensions, so my macros actually expand to
 something like:
 
 
 \definebodyfontenvironment[42.0pt] %% a dozen times
 \starttext
 \switchtobodyfont[42.0pt]  %% hundreds of times
 %\switchtobodyfont[42pt]   %% - this works, though
 foo
 \stoptext
 
 
 Which then results in this warning:
 
 fontsbodyfont 42.0pt is defined (can better be done global)
 
 
 Although the size has been „defined“. My problem appears to be
 that I’m abusing dimensions as makeshift floats to calculate
 relative font sizes, interlinespace etc. via \dimexpr.

???

 Hadn’t thought about \switchtobodyfont expecting integers.


Don’t know what’s the problem but the message doesn’t appear
when you use for example 42.1pt.

Wolfgang
___
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
___


Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Philipp Gesang
Hi Wolfgang!

···date: 2012-06-03, Sunday···from: Wolfgang Schuster···
  
  \definebodyfontenvironment[42.0pt] %% a dozen times
  \starttext
  \switchtobodyfont[42.0pt]  %% hundreds of times
  %\switchtobodyfont[42pt]   %% - this works, though
  foo
  \stoptext
  
  
  Which then results in this warning:
  
  fontsbodyfont 42.0pt is defined (can better be done global)
  
  
  Although the size has been „defined“. My problem appears to be
  that I’m abusing dimensions as makeshift floats to calculate
  relative font sizes, interlinespace etc. via \dimexpr.
 
 ???

It’s about decrementing font size and interlinespace until the
content fits a predefined box.
https://bitbucket.org/phg/context-stellen/src/3568dc7470fa/tex/context/third/bstellen/t-bibelstellen.mkiv#cl-158

  Hadn’t thought about \switchtobodyfont expecting integers.
 
 Don’t know what’s the problem but the message doesn’t appear
 when you use for example 42.1pt.

That’s odd. But this way it seems to do the right thing as
performance improves drastically (as much as 30%).

Thanks
Philipp

 
 Wolfgang
 ___
 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
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


pgpG2TJd2MLGh.pgp
Description: PGP signature
___
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
___

Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Wolfgang Schuster

Am 03.06.2012 um 16:27 schrieb Philipp Gesang:

 Hi Wolfgang!
 
 ···date: 2012-06-03, Sunday···from: Wolfgang Schuster···
 
 \definebodyfontenvironment[42.0pt] %% a dozen times
 \starttext
 \switchtobodyfont[42.0pt]  %% hundreds of times
 %\switchtobodyfont[42pt]   %% - this works, though
 foo
 \stoptext
 
 
 Which then results in this warning:
 
 fontsbodyfont 42.0pt is defined (can better be done global)
 
 
 Although the size has been „defined“. My problem appears to be
 that I’m abusing dimensions as makeshift floats to calculate
 relative font sizes, interlinespace etc. via \dimexpr.
 
 ???
 
 It’s about decrementing font size and interlinespace until the
 content fits a predefined box.
 https://bitbucket.org/phg/context-stellen/src/3568dc7470fa/tex/context/third/bstellen/t-bibelstellen.mkiv#cl-158


Look at the definition for \FittingText in supp-fun.mkiv:

\starttext
\ruledvbox{\FittingText{\hsize}{100pt}{Serif}{16pt}{1pt}{1}{\raggedright\input 
knuth\par}}
\stoptext

Wolfgang
___
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
___


Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Hans Hagen

On 3-6-2012 16:27, Philipp Gesang wrote:


That’s odd. But this way it seems to do the right thing as
performance improves drastically (as much as 30%).


a bodyfont is a collection of related fonts / sizes and when such a set 
is defined first inside a group you potentially end up with many 
(redundant) definitions .. this is why a bodyfont environment has to be 
defined at the outer level (as wolfgang pointed out)


\tracefontdefinitions

sometimes gives some insight in efficiency

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Philipp Gesang
Hi Hans!

···date: 2012-06-03, Sunday···from: Hans Hagen···

 On 3-6-2012 16:27, Philipp Gesang wrote:
 
 That’s odd. But this way it seems to do the right thing as
 performance improves drastically (as much as 30%).
 
 a bodyfont is a collection of related fonts / sizes and when such a
 set is defined first inside a group you potentially end up with many
 (redundant) definitions .. this is why a bodyfont environment has to
 be defined at the outer level (as wolfgang pointed out)
 
 \tracefontdefinitions

Nice forensics tool.

With this I can see plainly that, as reported by Wolfgang,
\definebodyfontenvironment[42.0pt] results in the dimension’s
decimal place to be stripped before font definition.

Which makes me wonder whether \switchtobodyfont should do a
\normalizebodyfontsize on the #specification before triggering
the switch? So that 42.0pt be interpreted as 42pt? Now that I’m
aware of it I can as well build that into my macros either ...

Regards
Philipp


 
 sometimes gives some insight in efficiency
 
 Hans
 
 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
  | 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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


pgp5kiJ4slvZN.pgp
Description: PGP signature
___
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
___

Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-03 Thread Philipp Gesang
Hi Wolfgang!

···date: 2012-06-03, Sunday···from: Wolfgang Schuster···

 Am 03.06.2012 um 16:27 schrieb Philipp Gesang:
  It’s about decrementing font size and interlinespace until the
  content fits a predefined box.
  https://bitbucket.org/phg/context-stellen/src/3568dc7470fa/tex/context/third/bstellen/t-bibelstellen.mkiv#cl-158
 
 Look at the definition for \FittingText in supp-fun.mkiv:
 
 \starttext
 \ruledvbox{\FittingText{\hsize}{100pt}{Serif}{16pt}{1pt}{1}{\raggedright\input
  knuth\par}}
 \stoptext

That’s the only thing that bothers me about Context: whenever you
come across a neat problem you think you should go about
implementing, you can be dead sure there’s already a
full-fledged, highly optimized solution in the core somwhere.
(Unless, of course, it’s something related to bibliography ;-) .)

On a more serious note: thanks for the pointer, this is good
reading! All the camel casing makes it look oldish, though.

Philipp



 Wolfgang
 ___
 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
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


pgph5iPTc3ZGg.pgp
Description: PGP signature
___
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
___

Re: [NTG-context] “bodyfont %s is defined (can better be done global)”

2012-06-02 Thread S Barmeier
 
 ... /
 fontsbodyfont 42pt is defined (can better be done global)
 fontsbodyfont 50.4pt is defined (can better be done global)
 fontsbodyfont 40.32pt is defined (can better be done global)
 ... /
 
 
 (\setupbodyfont doesn’t cause it.) It seems harmless but (a) I
 have a conditional font change that may repeat hundreds of times
 over the course of a document and it clutters my terminal, and
 (b) it’s a warning after all, so everything is not as it is
 supposed to be.  What’s it telling me, and why?
 
 Philipp

I'd be interested as well. Maybe my document just grew too large, but I
am having quite major memory issues it seems. Trying to compile my
document takes almost 10min and half-ẁay through Thunderbird is telling
me that its scripts are timing out and asking whether I want to stop
them. (A few pages less and the document compiles in 15 secs.) I have
two 2GHz processors and 1GB ram. The only frequent error I get from
context is that the bodyfont can better be defined globally. Will this
help with memory issues? Is there anything else I should do differently?

Thanks,
Severin

mkiv lua stats   used config file  -
selfautoparent:texmf/web2c/texmfcnf.lua
mkiv lua stats   used cache path   -
/home/user/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606
mkiv lua stats   resource resolver - loadtime 0.320 seconds, 0
scans with scantime 0.000 seconds, 0 shared scans, 26 found files,
scanned paths:
mkiv lua stats   stored bytecode data  - 303 modules, 65 tables,
368 chunks
mkiv lua stats   cleaned up reserved nodes - 58 nodes, 9 lists of 633
mkiv lua stats   node memory usage - 3 glue, 11 penalty, 17
attribute, 398 glue_spec, 4 attribute_list
mkiv lua stats   node list callback tasks  - 6 unique task lists, 30
instances (re)created, 10605 calls
mkiv lua stats   h-node processing time- 0.156 seconds including kernel
mkiv lua stats   attribute processing time - 0.186 seconds front- and
backend
mkiv lua stats   used backend  - pdf (backend for directly
generating pdf output)
mkiv lua stats   loaded tex modules- 1 requested, 1 found
(*-ruby), 0 missing
mkiv lua stats   loaded patterns   - en::2
mkiv lua stats   jobdata time  - 0.074 seconds saving,
0.012 seconds loading
mkiv lua stats   callbacks - 20135 direct, 3123
indirect, 23258 total
mkiv lua stats   randomizer- resumed with value
0.98300544032036
mkiv lua stats   lxml preparation time - 0.000 seconds, 0 nodes, 15
lpath calls, 0 cached calls
mkiv lua stats   interactive elements  - 0 references, 70 destinations
mkiv lua stats   v-node processing time- 1.227 seconds
mkiv lua stats   positions - 691 collected, 687
regulars, 0 regions, 4 unresolved regions
mkiv lua stats   result saved in file  - jfti.pdf
mkiv lua stats   margin data   - 86 entries, 0 pending
mkiv lua stats   loaded fonts  - 11 files:
lmmath-regular.otf genbasb.ttf genbasbi.ttf geni102.ttf genr102.ttf
adobesongstd-light.otf andika-r.ttf ipaexg.ttf ipaexm.ttf
kanjistrokeorders_v2.016.ttf unbatang.ttf
mkiv lua stats   fonts load time   - 13.121 seconds
mkiv lua stats   graphics processing time  - 0.017 seconds including
tex, 1 processed images
mkiv lua stats   luatex banner - this is luatex, version
beta-0.70.1-2011051918 (rev 4277)
mkiv lua stats   control sequences - 35261 of 65536 + 10
mkiv lua stats   current memory usage  - 529 MB (ctx: 542 MB)
mkiv lua stats   runtime   - 168.172 seconds, 59
processed pages, 60 shipped pages, 0.357 pages/second

system  | total runtime: 514.036
___
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
___