ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* macro beginner question...
@ 2010-06-05 12:03 Bernhard Rosensteiner
  0 siblings, 0 replies; 6+ messages in thread
From: Bernhard Rosensteiner @ 2010-06-05 12:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

Hello all,

in the process of learning macro programming in context i encountered the following problem (minimal example is attached):

when i have \setuphead[section][color={red}] the color key influences in a strange way my „novice macro“ (see the text which should be black but is red). Further more the \ruledhbox in my macro stops at some point the red color (with a normal \hbox all the text in the section is red). 
what i´m doing wrong here?

best regards
Bernhard

[-- Attachment #2: Typescript_Test.tex --]
[-- Type: application/octet-stream, Size: 3089 bytes --]

% Typescript test file
\setuplayout[margin=0pt, height=fit, width=fit, backspace=0cm, header=0cm, footer=\headerheight]
%\showframe
%\showboxes


\setuphead[section][color={red}]% this color key influences my macro why?
\setuphead[subsection][color=black]

\setupbodyfontenvironment[14pt][script=10pt,
								scriptscript=8pt, 
								x=10pt, 
								xx=7pt, 
								big=18pt,
								small=10pt]

\unprotect

\define\Kern{\hskip2pt}

\define\MyTestText{€\Kern \$\Kern \%\Kern \&\Kern ?\Kern @\Kern µ\Kern ∆\Kern ∂\Kern π\Kern ∞\Kern 1\Kern 2\Kern 3\Kern 4\Kern 5\Kern 6\Kern 7\Kern 8\Kern 9\Kern 0\Kern ff\Kern ft\Kern fft}

\def\OpticalsTest{\dosingleempty\doOpticalsTest}


\def\doOpticalsTest[#1]#2{%
	\getparameters[OO][Limitone={.37\textwidth},%text limit for font name (e.g. SerifDisplay-Regular)
					   Limittwo={3cm},%limit for "Example Text" - not that usefull
					   Limittext={.57\textwidth},%limit for text in Textkey
					   Size=\bodyfontsize,%textsize
					   Feature=default,%desired Open Type Font feature
					   Color=black,%text color
					   Text=,#1]%what text should be displayed
	\bgroup
		\def\Mycolor{\color[\OOColor]}
		\def\processitem##1{\OpticalTest[#1]{##1}}%
		\processcommalist[#2]\processitem
	\egroup
}

\def\OpticalTest[#1]#2{%
	\addff{\OOFeature}\definedfont[#2 at \OOSize]\setupinterlinespace%
	\hbox to \textwidth{\clip[width=.39\textwidth, bottomoffset=\strutdepth]{%
		\hbox to .39\textwidth{%
			\hfill\limitatetext{#2}{\OOLimitone}{\textellipsis}%
							  }}%
		\hbox to .61\textwidth{:\hskip.2cm%
			\doifelse{\OOText}{}%
			{{\ruledhbox to 3.6cm{\quotation{\limitatetext{Example\Kern Text}{\OOLimittwo}{\textellipsis}}\hfill}%
			\limitatetext{\MyTestText}{\OOLimittext}{\textellipsis}}}%
			{\limitatetext{\OOText}{\OOLimittext}{\textellipsis}}\hfilll
							  }%
					    }\vskip3pt
}%

\protect

\setupbodyfont[14pt]

\starttext

\section{Section in red}

\OpticalsTest[Text={Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text},Size=40pt]
{SerifCaption-Regular,SerifSmalltext-Regular,SerifRegular-Regular,SerifSubhead-Regular,SerifDisplay-Regular}
\blank
\OpticalsTest{SerifCaption-Bold,SerifSmalltext-Bold,SerifRegular-Bold,SerifSubhead-Bold,SerifDisplay-Bold}
\blank
\OpticalsTest{SerifCaption-Italic,SerifSmalltext-Italic,SerifRegular-Italic,SerifSubhead-Italic,SerifDisplay-Italic}

\subsection{Subsection in black}

\OpticalsTest[Text={Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text},Size=40pt, Feature=stretched]
{SerifCaption-Regular,SerifSmalltext-Regular,SerifRegular-Regular,SerifSubhead-Regular,SerifDisplay-Regular}
\blank
\OpticalsTest{SerifCaption-Bold,SerifSmalltext-Bold,SerifRegular-Bold,SerifSubhead-Bold,SerifDisplay-Bold}
\blank
\OpticalsTest{SerifCaption-Italic,SerifSmalltext-Italic,SerifRegular-Italic,SerifSubhead-Italic,SerifDisplay-Italic}



\stoptext

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





[-- Attachment #4: 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] 6+ messages in thread

* Re: macro beginner question
  2010-06-05 13:04     ` Taco Hoekwater
@ 2010-06-05 13:35       ` Bernhard Rosensteiner
  0 siblings, 0 replies; 6+ messages in thread
From: Bernhard Rosensteiner @ 2010-06-05 13:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

Am 05.06.2010 um 15:04 schrieb Taco Hoekwater:

> Bernhard Rosensteiner wrote:
>> deleting the \def\Mycolor line does not help - same result.
> 
> No, that would definitely not help. Your problem was not the
> definition, but that you never actually called the macro.
> 
> You should put the definition back, and add  \Mycolor to the
> \OpticalTest macro, perhaps like so:
> 
> \def\OpticalTest[#1]#2{%
> 	\addff{\OOFeature}%
>        \definedfont[#2 at \OOSize]%
>         \setupinterlinespace
> 	\hbox to \textwidth{\clip[width=.39\textwidth,
>                                  bottomoffset=\strutdepth]{%
>          \Mycolor
>          ..\hbox to .39\textwidth etc. etc.

i tried what you suggested (please see attachment), but i think there is something fishy with the color black. \definecolor[Myblack][s=0] gives same results as described above but other colors work as they should do.

best regards
Bernhard

[-- Attachment #2: Typescript_Test.tex --]
[-- Type: application/octet-stream, Size: 3209 bytes --]

% Typescript test file
\setuplayout[margin=0pt, height=fit, width=fit, backspace=0cm, header=0cm, footer=\headerheight]
%\showframe
%\showboxes


\setuphead[section][color={red}]% this color key influences my macro why?
\setuphead[subsection][color=black]

\setupbodyfontenvironment[14pt][script=10pt,
								scriptscript=8pt, 
								x=10pt, 
								xx=7pt, 
								big=18pt,
								small=10pt]

\unprotect

\define\Kern{\hskip2pt}

\define\MyTestText{€\Kern \$\Kern \%\Kern \&\Kern ?\Kern @\Kern µ\Kern ∆\Kern ∂\Kern π\Kern ∞\Kern 1\Kern 2\Kern 3\Kern 4\Kern 5\Kern 6\Kern 7\Kern 8\Kern 9\Kern 0\Kern ff\Kern ft\Kern fft}

\def\OpticalsTest{\dosingleempty\doOpticalsTest}

\definecolor[Myblack][s=0]%other values as 0 gives desired result

\def\doOpticalsTest[#1]#2{%
	\getparameters[OO][Limitone={.37\textwidth},%text limit for font name (e.g. SerifDisplay-Regular)
					   Limittwo={3cm},%limit for "Example Text" - not that usefull
					   Limittext={.57\textwidth},%limit for text in Textkey
					   Size=\bodyfontsize,%textsize
					   Color=Myblack,%Color=black gives unexpected results other colors work
					   Feature=default,%desired Open Type Font feature
					   Text=,#1]%what text should be displayed
	\def\Mycolor{\color[\OOColor]}
	\bgroup
		\def\processitem##1{\OpticalTest[#1]{##1}}%
		\processcommalist[#2]\processitem
	\egroup
}

\def\OpticalTest[#1]#2{%
	\addff{\OOFeature}\definedfont[#2 at \OOSize]\setupinterlinespace%
	\hbox to \textwidth{\clip[width=.39\textwidth, bottomoffset=\strutdepth]{%
		\hbox to .39\textwidth{\Mycolor%
			\hfill\limitatetext{#2}{\OOLimitone}{\textellipsis}%
							  }}%
		\hbox to .61\textwidth{:\hskip.2cm%
			\doifelse{\OOText}{}%
			{{\ruledhbox to 3.6cm{\quotation{\limitatetext{Example\Kern Text}{\OOLimittwo}{\textellipsis}}\hfill}%
			\limitatetext{\MyTestText}{\OOLimittext}{\textellipsis}}}%
			{\limitatetext{\OOText}{\OOLimittext}{\textellipsis}}\hfilll
							  }%
					    }\vskip3pt
}%

\protect

\setupbodyfont[14pt]

\starttext

\section{Section in red}

\OpticalsTest[Text={Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text},Size=40pt]
{SerifCaption-Regular,SerifSmalltext-Regular,SerifRegular-Regular,SerifSubhead-Regular,SerifDisplay-Regular}
\blank
\OpticalsTest{SerifCaption-Bold,SerifSmalltext-Bold,SerifRegular-Bold,SerifSubhead-Bold,SerifDisplay-Bold}
\blank
\OpticalsTest{SerifCaption-Italic,SerifSmalltext-Italic,SerifRegular-Italic,SerifSubhead-Italic,SerifDisplay-Italic}

\subsection{Subsection in black}

\OpticalsTest[Text={Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text},Size=40pt, Feature=stretched]
{SerifCaption-Regular,SerifSmalltext-Regular,SerifRegular-Regular,SerifSubhead-Regular,SerifDisplay-Regular}
\blank
\OpticalsTest{SerifCaption-Bold,SerifSmalltext-Bold,SerifRegular-Bold,SerifSubhead-Bold,SerifDisplay-Bold}
\blank
\OpticalsTest{SerifCaption-Italic,SerifSmalltext-Italic,SerifRegular-Italic,SerifSubhead-Italic,SerifDisplay-Italic}



\stoptext

[-- Attachment #3: Type: text/plain, Size: 4 bytes --]






[-- Attachment #4: 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] 6+ messages in thread

* Re: macro beginner question
  2010-06-05 12:50   ` Bernhard Rosensteiner
@ 2010-06-05 13:04     ` Taco Hoekwater
  2010-06-05 13:35       ` Bernhard Rosensteiner
  0 siblings, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2010-06-05 13:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Bernhard Rosensteiner wrote:
> deleting the \def\Mycolor line does not help - same result.

No, that would definitely not help. Your problem was not the
definition, but that you never actually called the macro.

You should put the definition back, and add  \Mycolor to the
\OpticalTest macro, perhaps like so:

\def\OpticalTest[#1]#2{%
	\addff{\OOFeature}%
         \definedfont[#2 at \OOSize]%
          \setupinterlinespace
	\hbox to \textwidth{\clip[width=.39\textwidth,
                                   bottomoffset=\strutdepth]{%
           \Mycolor
           ..\hbox to .39\textwidth etc. etc.


> best regards
> Bernhard
> 
> 
> 
> Am 05.06.2010 um 14:34 schrieb Taco Hoekwater:
> 
>> Bernhard Rosensteiner wrote:
>>> Hello all,
>>> in the process of learning macro programming in context i encountered the following problem (minimal example is attached):
>>> When i have \setuphead[section][color={red}] the color key influences in a strange way my „novice macro“ (see the text which should be black but is red). Further more the \ruledhbox in my macro stops at some point the red color (with a normal \hbox all the text in the section is red). what i´m doing wrong here? I don’t expect such a behaviour
>> Somewhere you should execute \Mycolor, you are only defining it.
>>
>> Best wishes,
>> Taco
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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: macro beginner question
  2010-06-05 12:34 ` Taco Hoekwater
@ 2010-06-05 12:50   ` Bernhard Rosensteiner
  2010-06-05 13:04     ` Taco Hoekwater
  0 siblings, 1 reply; 6+ messages in thread
From: Bernhard Rosensteiner @ 2010-06-05 12:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

deleting the \def\Mycolor line does not help - same result.

best regards
Bernhard



Am 05.06.2010 um 14:34 schrieb Taco Hoekwater:

> Bernhard Rosensteiner wrote:
>> Hello all,
>> in the process of learning macro programming in context i encountered the following problem (minimal example is attached):
>> When i have \setuphead[section][color={red}] the color key influences in a strange way my „novice macro“ (see the text which should be black but is red). Further more the \ruledhbox in my macro stops at some point the red color (with a normal \hbox all the text in the section is red). what i´m doing wrong here? I don’t expect such a behaviour
> 
> Somewhere you should execute \Mycolor, you are only defining it.
> 
> Best wishes,
> Taco
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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: macro beginner question
  2010-06-05 12:06 Bernhard Rosensteiner
@ 2010-06-05 12:34 ` Taco Hoekwater
  2010-06-05 12:50   ` Bernhard Rosensteiner
  0 siblings, 1 reply; 6+ messages in thread
From: Taco Hoekwater @ 2010-06-05 12:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Bernhard Rosensteiner wrote:
> Hello all,
> 
> in the process of learning macro programming in context i encountered the following problem (minimal example is attached):
> 
> When i have \setuphead[section][color={red}] the color key influences in a strange way my „novice macro“ (see the text which should be black but is red). Further more the \ruledhbox in my macro stops at some point the red color (with a normal \hbox all the text in the section is red). 
> what i´m doing wrong here? I don’t expect such a behaviour

Somewhere you should execute \Mycolor, you are only defining it.

Best wishes,
Taco
___________________________________________________________________________________
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

* macro beginner question
@ 2010-06-05 12:06 Bernhard Rosensteiner
  2010-06-05 12:34 ` Taco Hoekwater
  0 siblings, 1 reply; 6+ messages in thread
From: Bernhard Rosensteiner @ 2010-06-05 12:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

Hello all,

in the process of learning macro programming in context i encountered the following problem (minimal example is attached):

When i have \setuphead[section][color={red}] the color key influences in a strange way my „novice macro“ (see the text which should be black but is red). Further more the \ruledhbox in my macro stops at some point the red color (with a normal \hbox all the text in the section is red). 
what i´m doing wrong here? I don’t expect such a behaviour

best regards
Bernhard

[-- Attachment #2: Typescript_Test.tex --]
[-- Type: application/octet-stream, Size: 3089 bytes --]

% Typescript test file
\setuplayout[margin=0pt, height=fit, width=fit, backspace=0cm, header=0cm, footer=\headerheight]
%\showframe
%\showboxes


\setuphead[section][color={red}]% this color key influences my macro why?
\setuphead[subsection][color=black]

\setupbodyfontenvironment[14pt][script=10pt,
								scriptscript=8pt, 
								x=10pt, 
								xx=7pt, 
								big=18pt,
								small=10pt]

\unprotect

\define\Kern{\hskip2pt}

\define\MyTestText{€\Kern \$\Kern \%\Kern \&\Kern ?\Kern @\Kern µ\Kern ∆\Kern ∂\Kern π\Kern ∞\Kern 1\Kern 2\Kern 3\Kern 4\Kern 5\Kern 6\Kern 7\Kern 8\Kern 9\Kern 0\Kern ff\Kern ft\Kern fft}

\def\OpticalsTest{\dosingleempty\doOpticalsTest}


\def\doOpticalsTest[#1]#2{%
	\getparameters[OO][Limitone={.37\textwidth},%text limit for font name (e.g. SerifDisplay-Regular)
					   Limittwo={3cm},%limit for "Example Text" - not that usefull
					   Limittext={.57\textwidth},%limit for text in Textkey
					   Size=\bodyfontsize,%textsize
					   Feature=default,%desired Open Type Font feature
					   Color=black,%text color
					   Text=,#1]%what text should be displayed
	\bgroup
		\def\Mycolor{\color[\OOColor]}
		\def\processitem##1{\OpticalTest[#1]{##1}}%
		\processcommalist[#2]\processitem
	\egroup
}

\def\OpticalTest[#1]#2{%
	\addff{\OOFeature}\definedfont[#2 at \OOSize]\setupinterlinespace%
	\hbox to \textwidth{\clip[width=.39\textwidth, bottomoffset=\strutdepth]{%
		\hbox to .39\textwidth{%
			\hfill\limitatetext{#2}{\OOLimitone}{\textellipsis}%
							  }}%
		\hbox to .61\textwidth{:\hskip.2cm%
			\doifelse{\OOText}{}%
			{{\ruledhbox to 3.6cm{\quotation{\limitatetext{Example\Kern Text}{\OOLimittwo}{\textellipsis}}\hfill}%
			\limitatetext{\MyTestText}{\OOLimittext}{\textellipsis}}}%
			{\limitatetext{\OOText}{\OOLimittext}{\textellipsis}}\hfilll
							  }%
					    }\vskip3pt
}%

\protect

\setupbodyfont[14pt]

\starttext

\section{Section in red}

\OpticalsTest[Text={Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text},Size=40pt]
{SerifCaption-Regular,SerifSmalltext-Regular,SerifRegular-Regular,SerifSubhead-Regular,SerifDisplay-Regular}
\blank
\OpticalsTest{SerifCaption-Bold,SerifSmalltext-Bold,SerifRegular-Bold,SerifSubhead-Bold,SerifDisplay-Bold}
\blank
\OpticalsTest{SerifCaption-Italic,SerifSmalltext-Italic,SerifRegular-Italic,SerifSubhead-Italic,SerifDisplay-Italic}

\subsection{Subsection in black}

\OpticalsTest[Text={Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text, Test text},Size=40pt, Feature=stretched]
{SerifCaption-Regular,SerifSmalltext-Regular,SerifRegular-Regular,SerifSubhead-Regular,SerifDisplay-Regular}
\blank
\OpticalsTest{SerifCaption-Bold,SerifSmalltext-Bold,SerifRegular-Bold,SerifSubhead-Bold,SerifDisplay-Bold}
\blank
\OpticalsTest{SerifCaption-Italic,SerifSmalltext-Italic,SerifRegular-Italic,SerifSubhead-Italic,SerifDisplay-Italic}



\stoptext

[-- Attachment #3: Type: text/plain, Size: 6 bytes --]








[-- Attachment #4: 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] 6+ messages in thread

end of thread, other threads:[~2010-06-05 13:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-05 12:03 macro beginner question Bernhard Rosensteiner
2010-06-05 12:06 Bernhard Rosensteiner
2010-06-05 12:34 ` Taco Hoekwater
2010-06-05 12:50   ` Bernhard Rosensteiner
2010-06-05 13:04     ` Taco Hoekwater
2010-06-05 13:35       ` Bernhard Rosensteiner

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