%D \module %D [ file=spac-chr, %D version=2011.05.24, % code moved from core-spa.mkiv %D title=\CONTEXT\ Spacing Macros, %D subtitle=Characters, %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 Spacing Macros / Characters} \unprotect \registerctxluafile{spac-chr}{autosuffix} \definesystemattribute[characters][public] %D The nobreakspace is special as it needs to keep track of the space being %D flexible. Another option is to use space (glue) nodes and tag them as characters %D instead. No big deal but takes a moment of coding. So, as a prelude we %D tag the nobreakspace only. Interesting is that it also fits better in the %D tagging mechanism. %D %D But we need to do some checking as from then on we no longer can compare %D them in a string. So this needs thinking. Not that we can compare the %D nobreakspace now anyway. \pushoverloadmode %permanent\edef\nobreakspace {\begingroup\setalignstateattribute\tocharacter"00A0\endgroup} % 1 = left \permanent\cdef\nobreakspace {\tocharacter"00A0} % space \permanent\cdef\softhyphen {\tocharacter"00AD} % softhyohen \permanent\cdef\enquad {\tocharacter"2000} % quad/2 \permanent\cdef\emquad {\tocharacter"2001} % quad \permanent\cdef\twoperemspace {\tocharacter"2002} % quad/2 % % "2003 % quad == \quad == \hskip\emwidth \permanent\cdef\threeperemspace {\tocharacter"2004} % quad/3 \permanent\cdef\fourperemspace {\tocharacter"2005} % quad/4 %permanent\cdef\fiveperemspace {\tocharacter"001E} % quad/5 (bonus) \permanent\cdef\sixperemspace {\tocharacter"2006} % quad/6 \permanent\cdef\figurespace {\tocharacter"2007} % width of zero \permanent\cdef\punctuationspace {\tocharacter"2008} % width of period \permanent\cdef\breakablethinspace {\tocharacter"2009} % quad/8 \permanent\cdef\hairspace {\tocharacter"200A} % quad/8 \permanent\cdef\zerowidthspace {\tocharacter"200B} % 0 \permanent\cdef\zerowidthnonjoiner {\tocharacter"200C} % 0 \permanent\cdef\zerowidthjoiner {\tocharacter"200D} % 0 \permanent\cdef\narrownobreakspace {\tocharacter"202F} % quad/8 %permanent\cdef\mediummathspace {\tocharacter"205F} % space/8 (math) %permanent\cdef\zerowidthnobreakspace{\tocharacter"FEFF} %permanent\cdef\fiveperemspace {\tocharacter"001E} \permanent\protected\def\zerowidthnobreakspace{\penalty\plustenthousand\kern\zeropoint} \permanent\protected\def\fiveperemspace {\hskip{\emwidth/5}} \aliased\let\ideographicspace \enquad \aliased\let\ideographichalffillspace \emquad \aliased\let\zwnj \zerowidthnonjoiner \aliased\let\zwj \zerowidthjoiner \aliased\let\nbsp \nobreakspace \popoverloadmode \permanent\chardef\optionalspace "1F % will be space unless before punctuation \permanent\chardef\autoinsertedspace"1E % a more clever \autoinsertspace % Shortcuts: % unexpanded as otherwise we need to intercept / cleanup a lot \pushoverloadmode \permanent\protected\def\digitspace{{\nospaces\plussix\space}} \permanent\protected\def~{\nobreakspace} %permanent\letcharcode\tildeasciicode\nobreakspace \popoverloadmode \protect \endinput