typo-itc.mkvi / last modification: 2020-01-30 14:16
%D \module
%D   [       file=typo-itc,
%D        version=2011.10.08,
%D          title=\CONTEXT\ Typesetting Macros,
%D       subtitle=Italic Correction,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Typesetting Macros / Italics Corrections}

\unprotect

%D The brave might try:
%D
%D \starttyping
%D \definefontfeature[default][default][itlc=yes,textitalics=yes]
%D \setupitaliccorrection[global,always]
%D \stoptyping

\registerctxluafile{typo-itc}{}

\definesystemattribute[italics]    [public]
\definesystemattribute[mathitalics][public]

% \let\/=/
% \let\emphasiscorrection\donothing

\ifdefined \normalitaliccorrection \else
    \let\normalitaliccorrection\italiccorrection
\fi

\unexpanded\def\italiccorrection
  {\ifnum\attribute\italicsattribute<\plusone\normalitaliccorrection\fi}

\let\/\italiccorrection

% 1 = end of word
% 2 = end of word and end of a list

\unexpanded\def\setitaliccorrection[#code]% rather low level (might go away)
  {\clf_setitaliccorrection#code\relax}

\unexpanded\def\resetitaliccorrection% rather low level (might go away)
  {\clf_resetitaliccorrection}

% global : no attributes, just always (faster and less memory)
% text   : only text
% always : text and boxes
% none   : -

\unexpanded\def\setupitaliccorrection[#settings]%
  {\clf_setupitaliccorrection{#settings}}

\appendtoks
    \attribute\italicsattribute\attributeunsetvalue
\to \everymathematics

\protect \endinput