ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* beta/problem with layers
@ 2011-02-01 10:43 Andreas Harder
  2011-02-01 11:11 ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Harder @ 2011-02-01 10:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

it seems there go something wrong with layers.


\definelayer[test-layer][width=\paperwidth,height=\paperheight]

\setlayer[test-layer][preset=middle]{why is this text not visible?}

\setlayerframed
  [test-layer] % [preset=topright]
  [width=5cm,height=3cm,background=color,backgroundcolor=red]
  {why is this text not visible?}

\defineoverlay[test-overlay][\framed{test-overlay}]

\setupbackgrounds[page][background={test-layer,test-overlay}]

\starttext
  \page[empty]
\stoptext


Greeting
	Andreas
___________________________________________________________________________________
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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-01 10:43 beta/problem with layers Andreas Harder
@ 2011-02-01 11:11 ` Wolfgang Schuster
  2011-02-01 12:33   ` Andreas Harder
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2011-02-01 11:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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.

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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-01 11:11 ` Wolfgang Schuster
@ 2011-02-01 12:33   ` Andreas Harder
  2011-02-02 10:24     ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Harder @ 2011-02-01 12:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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.

Andreas
___________________________________________________________________________________
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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-01 12:33   ` Andreas Harder
@ 2011-02-02 10:24     ` Wolfgang Schuster
  2011-02-02 15:07       ` Aditya Mahajan
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2011-02-02 10:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

___________________________________________________________________________________
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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-02 10:24     ` Wolfgang Schuster
@ 2011-02-02 15:07       ` Aditya Mahajan
  2011-02-02 15:20         ` Hans Hagen
  2011-02-02 21:19         ` Wolfgang Schuster
  0 siblings, 2 replies; 10+ messages in thread
From: Aditya Mahajan @ 2011-02-02 15:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1040 bytes --]

On Wed, 2 Feb 2011, Wolfgang Schuster wrote:

> Besides moving \setlayer after \starttext you can just load a font
> before the \setlayer settings, e.g.
>
> \setupbodyfont[modern]
> \definelayer[…]
> \setlayer[…]{…}
> \starttext
> …
> \stoptext

Perhaps a redirection like \setlayer[...]{\setups{layersetup}} might also 
work (untested).

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

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

\setuplayer[...]{...}

\starttext
...
\stoptext

just works.

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

One could also use \starttext ... \stoptext here.

Aditya

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-02 15:07       ` Aditya Mahajan
@ 2011-02-02 15:20         ` Hans Hagen
  2011-02-02 16:46           ` Aditya Mahajan
  2011-02-02 21:19         ` Wolfgang Schuster
  1 sibling, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2011-02-02 15:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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?

as Wolfgang mentioned, setting a layer will use the current font which 
might not be the same as one sets later; btw, setting the size of style 
will trigger a load


-----------------------------------------------------------------
                                           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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-02 15:20         ` Hans Hagen
@ 2011-02-02 16:46           ` Aditya Mahajan
  2011-02-02 17:02             ` Hans Hagen
  2011-02-02 17:13             ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Aditya Mahajan @ 2011-02-02 16:46 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

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.

Aditya
___________________________________________________________________________________
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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-02 16:46           ` Aditya Mahajan
@ 2011-02-02 17:02             ` Hans Hagen
  2011-02-02 17:13             ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2011-02-02 17:02 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

On 2-2-2011 5:46, Aditya Mahajan wrote:

> Perhaps \setlayer (or even \hbox!!) should issue a warning if the fonts
> have not been loaded yet.

hm, that should be doable maybe we can hook that into everyhbox / everyvbox

in general, setlayer is not so much preamble as content code .. we could 
think of some extra wrappers, like

\startstyledefinitions

\stopstyledefinitions

\startcontentdefinitions

\stopcontentdefinitions

\starttext

\stoptext

although fonts are not yet loaded, ex and em do work because nullfont 
gets the 12pt lm values

(one can add \setupbodyfont[modern] to a cont-sys.mkiv of course)

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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-02 16:46           ` Aditya Mahajan
  2011-02-02 17:02             ` Hans Hagen
@ 2011-02-02 17:13             ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2011-02-02 17:13 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

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
-----------------------------------------------------------------
___________________________________________________________________________________
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] 10+ messages in thread

* Re: beta/problem with layers
  2011-02-02 15:07       ` Aditya Mahajan
  2011-02-02 15:20         ` Hans Hagen
@ 2011-02-02 21:19         ` Wolfgang Schuster
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2011-02-02 21:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 02.02.2011 um 16:07 schrieb Aditya Mahajan:

>> 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.
> 
> One could also use \starttext ... \stoptext here.

I don’t think \starttext after \startproduct is good style.

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] 10+ messages in thread

end of thread, other threads:[~2011-02-02 21:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 10:43 beta/problem with layers Andreas Harder
2011-02-01 11:11 ` Wolfgang Schuster
2011-02-01 12:33   ` Andreas Harder
2011-02-02 10:24     ` Wolfgang Schuster
2011-02-02 15:07       ` Aditya Mahajan
2011-02-02 15:20         ` Hans Hagen
2011-02-02 16:46           ` Aditya Mahajan
2011-02-02 17:02             ` Hans Hagen
2011-02-02 17:13             ` Hans Hagen
2011-02-02 21:19         ` Wolfgang Schuster

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