[NTG-context] beta/problem with layers

Hans Hagen pragma at wxs.nl
Wed Feb 2 18:13:14 CET 2011


On 2-2-2011 5:46, Aditya Mahajan wrote:
> On Wed, 2 Feb 2011, Hans Hagen wrote:
>
>> On 2-2-2011 4:07, Aditya Mahajan wrote:
>>
>>> There is no point in not loading the fonts in the begining if one would
>>> then have to come up with clever ways to force loading of a font. I hope
>>> that there is a more robust solution so that
>>
>> well, it depends ... how many use lm for documents?
>
> Don't know, but I am pretty sure that layers are used all over the
> place. In most of my documents, I set the layers in an evironment file,
> which is often loaded before \starttext.
>
>> as Wolfgang mentioned, setting a layer will use the current font which
>> might not be the same as one sets later;
>
> Oh, that is a bigger problem. That means that the first thing in a style
> should be font loading... if nothing else then just \setupbodyfont[11pt].
>
> Perhaps \setlayer (or even \hbox!!) should issue a warning if the fonts
> have not been loaded yet.

How about:

\unprotect

\def\dozerostagepreloadfonts
   {\definedfont[\s!file:lmmono10-regular sa 1]}

\def\zerostagepreloadfonts
   {\writestatus\m!fonts{beware: no fonts are loaded yet so content will 
not show up}%
    \glet\zerostagepreloadfonts\dozerostagepreloadfonts
    \zerostagepreloadfonts}

\everyhbox{\zerostagepreloadfonts}
\everyvbox{\zerostagepreloadfonts}

\def\resetpreloadfonts
   {\global\let\zerostagepreloadfonts  \relax
    \global\let\firststagepreloadfonts \relax
    \global\let\secondstagepreloadfonts\relax
    \global\let\thirdstagepreloadfonts \relax
    \global\let\fourthstagepreloadfonts\relax
    \global\everyhbox\emptytoks
    \global\everyvbox\emptytoks
    \resetnullfont}

\protect

\setbox0\hbox{xxx}


\starttext

     test \box0

\stoptext




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


More information about the ntg-context mailing list