ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Multiple layers question
@ 2012-06-04 12:06 Marcin Borkowski
  2012-06-04 12:33 ` Wolfgang Schuster
  2012-06-04 12:36 ` Marco
  0 siblings, 2 replies; 6+ messages in thread
From: Marcin Borkowski @ 2012-06-04 12:06 UTC (permalink / raw)
  To: ConTeXt mailing list

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


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple layers question
  2012-06-04 12:06 Multiple layers question Marcin Borkowski
@ 2012-06-04 12:33 ` Wolfgang Schuster
  2012-06-04 12:39   ` Marcin Borkowski
  2012-06-04 12:36 ` Marco
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2012-06-04 12:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple layers question
  2012-06-04 12:06 Multiple layers question Marcin Borkowski
  2012-06-04 12:33 ` Wolfgang Schuster
@ 2012-06-04 12:36 ` Marco
  1 sibling, 0 replies; 6+ messages in thread
From: Marco @ 2012-06-04 12:36 UTC (permalink / raw)
  To: ntg-context

On 2012-06-04 Marcin Borkowski <mbork@wmi.amu.edu.pl> wrote:

> 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


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple layers question
  2012-06-04 12:33 ` Wolfgang Schuster
@ 2012-06-04 12:39   ` Marcin Borkowski
  2012-06-04 13:41     ` Marco
  0 siblings, 1 reply; 6+ messages in thread
From: Marcin Borkowski @ 2012-06-04 12:39 UTC (permalink / raw)
  To: ntg-context

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

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple layers question
  2012-06-04 12:39   ` Marcin Borkowski
@ 2012-06-04 13:41     ` Marco
  2012-06-04 15:54       ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Marco @ 2012-06-04 13:41 UTC (permalink / raw)
  To: ntg-context

On 2012-06-04 Marcin Borkowski <mbork@wmi.amu.edu.pl> 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.


Marco


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Multiple layers question
  2012-06-04 13:41     ` Marco
@ 2012-06-04 15:54       ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2012-06-04 15:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco

On 4-6-2012 15:41, Marco wrote:
> On 2012-06-04 Marcin Borkowski<mbork@wmi.amu.edu.pl>  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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-06-04 15:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-04 12:06 Multiple layers question Marcin Borkowski
2012-06-04 12:33 ` Wolfgang Schuster
2012-06-04 12:39   ` Marcin Borkowski
2012-06-04 13:41     ` Marco
2012-06-04 15:54       ` Hans Hagen
2012-06-04 12:36 ` Marco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).