ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \definetype breaks down ---
@ 2006-11-14 18:10 Aditya Mahajan
  2006-11-14 18:37 ` Aditya Mahajan
  2006-11-14 18:44 ` Hans Hagen
  0 siblings, 2 replies; 7+ messages in thread
From: Aditya Mahajan @ 2006-11-14 18:10 UTC (permalink / raw)


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?

Aditya

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

* Re: \definetype breaks down ---
  2006-11-14 18:10 \definetype breaks down --- Aditya Mahajan
@ 2006-11-14 18:37 ` Aditya Mahajan
  2006-11-14 18:44 ` Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Aditya Mahajan @ 2006-11-14 18:37 UTC (permalink / raw)


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

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

* Re: \definetype breaks down ---
  2006-11-14 18:10 \definetype breaks down --- Aditya Mahajan
  2006-11-14 18:37 ` Aditya Mahajan
@ 2006-11-14 18:44 ` Hans Hagen
  2006-11-14 18:47   ` Taco Hoekwater
  2006-11-14 18:54   ` Aditya Mahajan
  1 sibling, 2 replies; 7+ messages in thread
From: Hans Hagen @ 2006-11-14 18:44 UTC (permalink / raw)


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

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

* Re: \definetype breaks down ---
  2006-11-14 18:44 ` Hans Hagen
@ 2006-11-14 18:47   ` Taco Hoekwater
  2006-11-14 18:54   ` Aditya Mahajan
  1 sibling, 0 replies; 7+ messages in thread
From: Taco Hoekwater @ 2006-11-14 18:47 UTC (permalink / raw)
  Cc: mailing list for ConTeXt users

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

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

* Re: \definetype breaks down ---
  2006-11-14 18:44 ` Hans Hagen
  2006-11-14 18:47   ` Taco Hoekwater
@ 2006-11-14 18:54   ` Aditya Mahajan
  2006-11-14 19:08     ` Hans Hagen
  2006-11-14 19:14     ` Hans Hagen
  1 sibling, 2 replies; 7+ messages in thread
From: Aditya Mahajan @ 2006-11-14 18:54 UTC (permalink / raw)
  Cc: Taco Hoekwater

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

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

* Re: \definetype breaks down ---
  2006-11-14 18:54   ` Aditya Mahajan
@ 2006-11-14 19:08     ` Hans Hagen
  2006-11-14 19:14     ` Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2006-11-14 19:08 UTC (permalink / raw)


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

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

* Re: \definetype breaks down ---
  2006-11-14 18:54   ` Aditya Mahajan
  2006-11-14 19:08     ` Hans Hagen
@ 2006-11-14 19:14     ` Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2006-11-14 19:14 UTC (permalink / raw)


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

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


[-- Attachment #2: core-ver.mkii --]
[-- Type: text/plain, Size: 7876 bytes --]

%D \module
%D   [       file=core-ver,
%D        version=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<%
     \@EA\setupalternativetypegrouping
   \else
     \@EA#1%
   \fi}

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

\def\dodotype
  {\ifx\next\bgroup
     \@EA\dodotypeA
   \else\if\next<%
     \doifelse{\typingparameter\c!option}\v!none
       {\@EAEAEA\dodotypeB}{\@EAEAEA\dodotypeC}%
   \else
     \@EAEAEA\dodotypeD
   \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
     \@EA\dodotypeAA
   \or
     \@EA\dodotypeAB
   \or
     \ifnum\catcode`\{=\@@active
       \@EAEAEA\dodotypeAB
     \else
       \@EAEAEA\dodotypeAA
     \fi
   \else
     \@EA\dodotypeAA
   \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 things go wrong in alignments (???)
   \catcode`\}=\@@endgroup]
\egroup

\bgroup
\catcode`\<=\@@active
\catcode`\>=\@@active
\gdef\setupalternativetypegrouping
  {\catcode`\<=\@@active
   \catcode`\>=\@@active
   \def\doless
     {\ifx<\next
        \def\next
          {\bgroup\switchslantedtype
           \let\next=}%
      \else
        \let\next\lesscharacter
      \fi
      \next}%
   \def\domore
     {\ifx>\next
        \def\next
          {\egroup
           \let\next=}%
      \else
        \let\next\morecharacter
      \fi
      \next}%
   \def<{\futurelet\next\doless}%
   \def>{\futurelet\next\domore}}
\egroup

\def\setupnotypegrouping
  {\catcode`\<=\@@begingroup
   \catcode`\>=\@@endgroup}

\def\doenterdoublelesstype
  {\ifx\next\egroup
      \lesscharacter\null\lesscharacter
   \else
     \bgroup\switchslantedtype
     \let\doenterdoublemoretype\egroup
   \fi}

\def\doenterdoublemoretype
  {\def\doenterdoubletype
     {\ifx\next\egroup
        \morecharacter\null\morecharacter
      \fi}}

\bgroup
\catcode`\<=\@@active
\catcode`\>=\@@active
\gdef\setupgroupedtype
  {\catcode`\<=\@@active
   \catcode`\>=\@@active
   \def\doless
     {\ifx<\next
        \def\next
          {\def\enterdoubletype{\futurelet\next\doenterdoublelesstype}%
           \afterassignment\enterdoubletype
           \let\next=}%
      \else
        \let\next\lesscharacter
      \fi
      \next}%
   \def\domore
     {\ifx>\next
        \def\next
          {\def\enterdoubletype{\futurelet\next\doenterdoublemoretype}%
           \afterassignment\enterdoubletype
           \let\next=}%
      \else
        \let\next\morecharacter
      \fi
      \next}%
   \def<{\futurelet\next\doless}%
   \def>{\futurelet\next\domore}}
\egroup

\def\mksetupcommandsintype% can also be \string\
  {\setupgroupedtype
   \edef\\{\typingparameter\c!escape}%
   \letvalue{\\}=\\% for instance \/=/
   \@EA\catcode\@EA`\\=\@@escape
   \def\BTEX##1\ETEX##2% ##2 gobbles active space
     {\naturaltextext##1\unskip\relax}}

\def\mksetupslantedtype
  {\setupgroupedtype}

\let\protectedfirsttype\string % \relax for special cases

% The next one is safe for: \def\xx#1{\type{#1}} \xx{\ifx}

\bgroup
\catcode`\<=\active
\catcode`\>=\active
\gdef\doprotectfirsttype
  {\normalifx\next<%
     \endrobusttest \let\next\relax
   \normalelse\normalifx\next\bgroup
     \endrobusttest \let\next\relax
   \normalelse\normalifx\next\egroup % takes care of \type{}
     \endrobusttest \let\next\relax
   \normalelse\normalifx\next\activeleftargument
     \endrobusttest \let\next\relax
   \normalelse
     \endrobusttest \let\next\protectedfirsttype
   \normalfi\normalfi\normalfi\normalfi
   \next}
\egroup

\def\protectfirsttype
  {\beginrobusttest
   \futurelet\next\doprotectfirsttype}

% typing:

\def\mktypeblockverbatim#1#2%
  {\processdisplayverbatim{#2}} % needs to be fixed

% typefile:

\def\mktypefileverbatim     {\processfileverbatim     \readfilename} % #1
\def\mktypefilelinesverbatim{\processfilelinesverbatim\readfilename} % #1 / #2#3

\protect \endinput


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

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

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

end of thread, other threads:[~2006-11-14 19:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14 18:10 \definetype breaks down --- Aditya Mahajan
2006-11-14 18:37 ` Aditya Mahajan
2006-11-14 18:44 ` Hans Hagen
2006-11-14 18:47   ` Taco Hoekwater
2006-11-14 18:54   ` Aditya Mahajan
2006-11-14 19:08     ` Hans Hagen
2006-11-14 19:14     ` Hans Hagen

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