Hi, I'd like to put a few things, placed absolutely on the page. I thought that layers are a good tool, but I can't make them do what I want. Assume that I want to have "Some text" near the top of the page and a huge "X" centered. I did this: \setuppagenumbering[state=stop] \setupbackgrounds[page][background=bkg] \definelayer[bkg][x=0mm,y=0mm,width=\paperwidth,height=\paperheight] \setlayer[bkg] {\framed[frame=off,width=\paperwidth,height=50mm] {\switchtobodyfont[10mm]\tt Some text}} \setlayer[bkg] {\framed[frame=off,width=\paperwidth,height=\paperheight] {\switchtobodyfont[240mm]\tt X}} \starttext \null \stoptext but only one layer appears (the "Some text" one). What am I doing wrong? Is there a better way to do it? TIA -- Marcin Borkowski http://mbork.pl
Am 04.06.2012 um 14:06 schrieb Marcin Borkowski:
Hi,
I'd like to put a few things, placed absolutely on the page. I thought that layers are a good tool, but I can't make them do what I want. Assume that I want to have "Some text" near the top of the page and a huge "X" centered. I did this:
\setuppagenumbering[state=stop]
\setupbackgrounds[page][background=bkg]
\definelayer[bkg][x=0mm,y=0mm,width=\paperwidth,height=\paperheight] \setlayer[bkg] {\framed[frame=off,width=\paperwidth,height=50mm] {\switchtobodyfont[10mm]\tt Some text}} \setlayer[bkg] {\framed[frame=off,width=\paperwidth,height=\paperheight] {\switchtobodyfont[240mm]\tt X}}
\starttext
\null
\stoptext
but only one layer appears (the "Some text" one). What am I doing wrong? Is there a better way to do it?
Load a font or move the \setlayer commands after \starttext. \setupbackgrounds[page][background=bkg] \definelayer[bkg][x=0mm,y=0mm,width=\paperwidth,height=\paperheight] \setupbodyfont[modern] \setlayerframed[bkg][frame=off,width=\paperwidth,height=50mm]{\definedfont[Mono at 10mm]Some text} \setlayerframed[bkg][frame=off,width=\paperwidth,height=\paperheight]{\definedfont[Mono at 240mm]X} \starttext \page[empty] \stoptext Wolfgang
Dnia 2012-06-04, pon o godzinie 14:33 +0200, Wolfgang Schuster pisze:
Load a font or move the \setlayer commands after \starttext.
Thanks a lot! But why is that so?
Wolfgang
-- Marcin Borkowski http://mbork.pl
On 2012-06-04 Marcin Borkowski
Dnia 2012-06-04, pon o godzinie 14:33 +0200, Wolfgang Schuster pisze:
Load a font or move the \setlayer commands after \starttext.
Thanks a lot!
But why is that so?
Until some years ago the latin modern font was always automatically loaded, regardless of the users choice of font. Font loading takes a considerable amount of time (check the stats at the end of a context run). This led to the question: “Why start loading a big, complex font like latin modern before we know which font the user actually wants to use and waste several seconds on it, just to start loading the users choice afterwards?” The answer was: ”We delay loading the font until we know which font the user wants to use. If the user doesn't tell us, then we fall back to latin modern.” The body font is set up in the setup area (the part above \starttext). That, in turn, means that when having reached \starttext, the users choice of font is known and can be loaded. It is more efficient if a font other then latin modern is used. One drawback is that typeset text in the setup area has no font setup and will fall back to latin modern mono. Usually you don't typeset text in the setup area. However, layers are an exception and you need to set up the body font beforehand. Marco
On 4-6-2012 15:41, Marco wrote:
On 2012-06-04 Marcin Borkowski
wrote: Cześć Marcin,
Dnia 2012-06-04, pon o godzinie 14:33 +0200, Wolfgang Schuster pisze:
Load a font or move the \setlayer commands after \starttext.
Thanks a lot!
But why is that so?
Until some years ago the latin modern font was always automatically loaded, regardless of the users choice of font. Font loading takes a considerable amount of time (check the stats at the end of a context run). This led to the question:
“Why start loading a big, complex font like latin modern before we know which font the user actually wants to use and waste several seconds on it, just to start loading the users choice afterwards?”
The answer was:
”We delay loading the font until we know which font the user wants to use. If the user doesn't tell us, then we fall back to latin modern.”
The body font is set up in the setup area (the part above \starttext). That, in turn, means that when having reached \starttext, the users choice of font is known and can be loaded. It is more efficient if a font other then latin modern is used.
One drawback is that typeset text in the setup area has no font setup and will fall back to latin modern mono. Usually you don't typeset text in the setup area. However, layers are an exception and you need to set up the body font beforehand.
a good text for the wiki (and also for the font manual) 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 -----------------------------------------------------------------
On 2012-06-04 Marcin Borkowski
I'd like to put a few things, placed absolutely on the page. I thought that layers are a good tool,
They are :)
Assume that I want to have "Some text" near the top of the page and a huge "X" centered.
\setupbodyfont [lmodern] \setuppagenumbering [state=stop] \definefont [bkgfont] [Mono at 240mm] \setupbackgrounds [page] [background=bkg] \definelayer [bkg] \setlayerframed [bkg] [frame=off, height=50mm, width=\paperwidth, foregroundstyle=\ttx] {Some text} \setlayerframed [bkg] [frame=off, width=\paperwidth, foregroundstyle=\bkgfont] {X} \starttext\null \stoptext Since font loading is delayed until \starttext, you need to load a font when you set up your layers. Marco
participants (4)
-
Hans Hagen
-
Marcin Borkowski
-
Marco
-
Wolfgang Schuster