ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Bernhard Rosensteiner <brosensteiner@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: macro beginner question...
Date: Sat, 5 Jun 2010 14:03:34 +0200	[thread overview]
Message-ID: <15E2369A-AB18-461F-8A9E-806F866CAD86@gmail.com> (raw)

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

             reply	other threads:[~2010-06-05 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-05 12:03 Bernhard Rosensteiner [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15E2369A-AB18-461F-8A9E-806F866CAD86@gmail.com \
    --to=brosensteiner@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).