Re: [NTG-context] \definetype breaks down ---

2006-11-14 Thread Aditya Mahajan
On Tue, 14 Nov 2006, Aditya Mahajan wrote:

 Hi Hans,

 I just noticed a bug with the type mechanism. It breaks down the kerning for 
 ---. Minimal example:

 \definetype[typeTEX][option=tex]

 \starttext
 \typeTEX|\example|. this---breaks---down.
 \stoptext

 Any workarounds?

Noticed another things, the \example above is not in verbatim font!! 
(using the latest beta now)

Aditya
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \definetype breaks down ---

2006-11-14 Thread Hans Hagen
Aditya Mahajan wrote:
 Hi Hans,

 I just noticed a bug with the type mechanism. It breaks down the 
 kerning for ---. Minimal example:

 \definetype[typeTEX][option=tex]

 \starttext
 \typeTEX|\example|. this---breaks---down.
 \stoptext

 Any workarounds?

   
taco, is \noligatures global? i.e. how do we turn on ligatures then? 


   
\def\verbatimfont{\redoconvertfont\dosetfontattribute{\currenttypingclass\currenttyping}\c!style\normalnoligatures\font}%


Hans 


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \definetype breaks down ---

2006-11-14 Thread Aditya Mahajan
On Tue, 14 Nov 2006, Hans Hagen wrote:

 Aditya Mahajan wrote:
 Hi Hans,

 I just noticed a bug with the type mechanism. It breaks down the
 kerning for ---. Minimal example:

 \definetype[typeTEX][option=tex]

 \starttext
 \typeTEX|\example|. this---breaks---down.
 \stoptext

 Any workarounds?


 taco, is \noligatures global? i.e. how do we turn on ligatures then?


   
 \def\verbatimfont{\redoconvertfont\dosetfontattribute{\currenttypingclass\currenttyping}\c!style\normalnoligatures\font}%

Adding \verbatimfont to mktype seems to do the trick.

\unprotect
\def\mktype#1% was \dotype
   {\bgroup
\verbatimfont%--Added
\resumecoloraftergroup % a problem is that we can still be in color 
mode, tricky hack
\strut % new, enables leading space in \type { abc } at par start
\let\currenttypingclass\??ty
\edef\currenttyping{#1}%
\catcode`\=\@@other
\catcode`\=\@@other
\futurelet\next\dodotype}
\protect

\setuptype[option=TEX]
\definetype[typeTEX][option=tex]

\starttext
\type{\example}. this---breaks---down.

\typeTEX{\example}. this---breaks---down.

\stoptext

Aditya



___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \definetype breaks down ---

2006-11-14 Thread Hans Hagen
Aditya Mahajan wrote:
 On Tue, 14 Nov 2006, Hans Hagen wrote:

   
 Aditya Mahajan wrote:
 
 Hi Hans,

 I just noticed a bug with the type mechanism. It breaks down the
 kerning for ---. Minimal example:

 \definetype[typeTEX][option=tex]

 \starttext
 \typeTEX|\example|. this---breaks---down.
 \stoptext

 Any workarounds?


   
 taco, is \noligatures global? i.e. how do we turn on ligatures then?


   
 \def\verbatimfont{\redoconvertfont\dosetfontattribute{\currenttypingclass\currenttyping}\c!style\normalnoligatures\font}%
 

 Adding \verbatimfont to mktype seems to do the trick.

 \unprotect
 \def\mktype#1% was \dotype
{\bgroup
 \verbatimfont%--Added
 \resumecoloraftergroup % a problem is that we can still be in color 
 mode, tricky hack
 \strut % new, enables leading space in \type { abc } at par start
 \let\currenttypingclass\??ty
 \edef\currenttyping{#1}%
 \catcode`\=\@@other
 \catcode`\=\@@other
 \futurelet\next\dodotype}
 \protect

 \setuptype[option=TEX]
 \definetype[typeTEX][option=tex]

 \starttext
 \type{\example}. this---breaks---down.

 \typeTEX{\example}. this---breaks---down.

 \stoptext

   
ok, i'll fix that (is a side effect of mkiv code split-off)

the fact that the noligatures is global meant that the in this case non 
verbatim font was affected;

Hans


-- 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \definetype breaks down ---

2006-11-14 Thread Hans Hagen
we need to obey the specific setting so verbatimfont is called at 
different places


-
 Hans Hagen | PRAGMA ADE
 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-

%D \module
%D   [   file=core-ver,
%Dversion=2000.05.09,
%D  title=\CONTEXT\ Core Macros,
%D   subtitle=Verbatim,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright={PRAGMA / Hans Hagen \ Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\unprotect

% uses \prettyidentifier and sets \setupprettytype

\def\mksetupprettiesintype
  {\doifundefined{setuppretty\prettyidentifier type}%
 {\startnointerference
\restorecatcodes % also needed when loading during \newpretty
\startreadingfile % restore  and  if needed
\lowercasestring verb-\prettyidentifier.tex\to\filename
\readsysfile\filename\donothing\donothing
\stopreadingfile
  \stopnointerference}%
   \doifdefinedelse{setuppretty\prettyidentifier type}%
 {\let\uncatcodecharacters\uncatcodeallcharacters % ugly, should be switch 
/ todo
  \def\mksetupprettytype{\getvalue{setuppretty\prettyidentifier type}}}
 {\let\mksetupprettytype\relax}}

% not that fast but catches \type{\command} % nothing more after \command
%
% \setupcolors[state=start]
% \setuptype[option=TEX]
% \setupcolors[textcolor=red]
%
% The options \type{before=\startsolutionbackground } and
% \type{after=\stopsolutionbackground} take care of putting a frame,
% which can
%
% {\blue The options \type{before=\startsolutionbackground } and
% \type{after=\stopsolutionbackground} take care of putting a frame,
% which} can

\def\resumecoloraftergroup
  {\localstartcolor[\s!black]%
   \localstartcolor[\maintextcolor]%
   \aftergroup\localstopcolor
   \aftergroup\localstopcolor}

% the rather messy \type command

\def\mktype#1% was \dotype
  {\bgroup
   \resumecoloraftergroup % a problem is that we can still be in color mode, 
tricky hack
   \strut % new, enables leading space in \type { abc } at par start
   \let\currenttypingclass\??ty
   \edef\currenttyping{#1}%
   \catcode`\=\@@other
   \catcode`\=\@@other
   \futurelet\next\dodotype}

\def\dodotypeA
  {\initializetype
   \initializetypegrouping
   \verbatimfont
   \verbatimcolor
   \afterassignment\protectfirsttype\let\next=}

\def\dodotypeB
  {\initializetype
   \setupnotypegrouping
   \verbatimfont
   \verbatimcolor
   \let\next=}

\def\dodotypeC#1%
  {\initializetype
   \verbatimfont
   \verbatimcolor
   \if#1%
 [EMAIL PROTECTED]
   \else
 [EMAIL PROTECTED]
   \fi}

\def\dodotypeD#1%
  {\initializetype
   \verbatimfont
   \verbatimcolor
   \catcode`#1=\@@endgroup}

\def\dodotype
  {\ifx\next\bgroup
 [EMAIL PROTECTED]
   \else\if\next%
 \doifelse{\typingparameter\c!option}\v!none
   [EMAIL PROTECTED]@EAEAEA\dodotypeC}%
   \else
 [EMAIL PROTECTED]
   \fi\fi}

% Verbatim does not work when passed as an argument, so here is a
% workaround. Beware, spaces are introduced after a \type {\csname}.

\chardef\recodeverbatimmode\zerocount % 0=nothing 1=rescan 2=autorescan

% \appendtoks \chardef\recodeverbatimmode\plustwo \to \everytabulate
% \appendtoks \chardef\recodeverbatimmode\plustwo \to \everytable

\def\dodotypeA
  {\initializetype
   \initializetypegrouping
   \verbatimfont
   \verbatimcolor
   \ifcase\recodeverbatimmode
 [EMAIL PROTECTED]
   \or
 [EMAIL PROTECTED]
   \or
 \ifnum\catcode`\{=\@@active
   [EMAIL PROTECTED]
 \else
   [EMAIL PROTECTED]
 \fi
   \else
 [EMAIL PROTECTED]
   \fi}

\def\dodotypeAA
  {\afterassignment\protectfirsttype\let\next=}

\def\dodotypeAB
  {\bgroup
   \catcode`\}=\@@endgroup
   \catcode`\{=\@@begingroup
   \afterassignment\redotypeAB\global\globalscratchtoks}

\def\redotypeAB
  {\egroup
   \expandafter\convertargument\the\globalscratchtoks\to\ascii
   
\ifx\scantokens\undefined\ascii\else\everyeof{\hskip-\spaceskip}\scantokens\expandafter{\ascii}\fi
   \egroup}

\bgroup
\catcode`\[=\@@begingroup
\catcode`\]=\@@endgroup
\catcode`\{=\@@active
\catcode`\}=\@@active
\gdef\initializetypegrouping
  [\ifnum\catcode`\{=\@@active
 \let\normalactivebgroup{%
 \let\normalactiveegroup}%
   \else
 \catcode`\{=\@@active
 \catcode`\}=\@@active
 \let\normalactivebgroup\leftargument
 \let\normalactiveegroup\rightargument
   \fi
   \def\activeleftargument
 [\bgroup
  \catcode`\}=\@@active
  \let}\activerightargument
  \normalactivebgroup]%
   \def\activerightargument
 [\normalactiveegroup
  \egroup]%
   \let{=\activeleftargument
   % not \let}=\egroup, otherwise 

Re: [NTG-context] \definetype breaks down ---

2006-11-14 Thread Taco Hoekwater
Hans Hagen wrote:
 Aditya Mahajan wrote:
 
 Hi Hans,

 I just noticed a bug with the type mechanism. It breaks down the 
 kerning for ---. Minimal example:

 \definetype[typeTEX][option=tex]

 \starttext
 \typeTEX|\example|. this---breaks---down.
 \stoptext

 Any workarounds?

   
 
 taco, is \noligatures global? i.e. how do we turn on ligatures then?
 

You can't, it is destructive. (I have told you it was a hack, yes?)

Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context