[NTG-context] beta/problem with layers

Wolfgang Schuster schuster.wolfgang at googlemail.com
Wed Feb 2 11:24:08 CET 2011


Am 01.02.2011 um 13:33 schrieb Andreas Harder:

> Am 01.02.2011 um 12:11 schrieb Wolfgang Schuster:
> 
>> Am 01.02.2011 um 11:43 schrieb Andreas Harder:
>> 
>>> Hi,
>>> 
>>> it seems there go something wrong with layers.
>> 
>> With the last beta context postpones font loading till \starttext.
>> 
>> As there is no font loaded the layer content is not visible,
>> move \starttext at the begin of the file and you can see the
>> layer text.
> 
> Thanks Wolfgang, I forgot about that.

Even though it’s not so obvious because other commands like \setupheadertexts
don’t have this problem, for all the curious people here is a small example
where you can see the problem in another context.

\starttext
\tt\setbox0=\hbox{boxed text}\ss unboxed text \box0
\stoptext

You would now expect both texts are printed sans serif but the first
was saved in a box and use not the font which was active when you
stored it in the box, the same happens with \setlayer because
the commands stores the content too in a \hbox and since there was
no font available when you put it in the box nothing is shown.

Besides moving \setlayer after \starttext you can just load a font
before the \setlayer settings, e.g.

\setupbodyfont[modern]
\definelayer[…]
\setlayer[…]{…}
\starttext
…
\stoptext

or you use \startproduct which is normally always written as first line
and acts \starttext which preloads then the Latin Modern fonts, e.g.

\startproduct

\definelayer[…]
\setlayer[…]{…}

\startbodymatter
…
\stopbodymatter

\stopproduct

The bodymatter enviroment isn’t necessary here because it’s always enabled
when you other sectionblockenvironment is used but it’s useful to have
something which separates the preamble from the text.

Wolfgang



More information about the ntg-context mailing list