typo-dig.mkiv / last modification: 2020-01-30 14:16
%D \module
%D   [       file=typo-dig,
%D        version=2010.01.18,
%D          title=\CONTEXT\ Typesetting Macros,
%D       subtitle=Digits,
%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 / Digits}

\unprotect

\registerctxluafile{typo-dig}{}

\definesystemattribute[digits][public]

%D This could as well be a dynamic font feature but why bother.
%D
%D \macros
%D   {\equaldigits}
%D
%D \startbuffer
%D test test \ruledhbox{123}               test test\par
%D test test \ruledhbox{\equaldigits{123}} test test\par
%D test test            \equaldigits{123}  test test\par
%D \stopbuffer
%D
%D \typebuffer
%D
%D This calls result in:
%D
%D \startlines
%D \getbuffer
%D \stoplines

\unexpanded\def\setdigitsmanipulation[#1]%
  {\clf_setdigitsmanipulation{#1}}

\unexpanded\def\resetdigitsmanipulation
  {\attribute\digitsattribute\attributeunsetvalue}

\appendtoks
    \resetdigitsmanipulation
\to \everyresettypesetting

\unexpanded\def\equaldigits{\groupedcommand{\setdigitsmanipulation[\number\plusone]}{}}
\unexpanded\def\dummydigit {\hphantom      {\setdigitsmanipulation[\number\plusone]0}}

\appendtoks
    \resetdigitsmanipulation
\to \everyinitializeverbatim

\protect \endinput