1%D \module 2%D [ file=typo-lan, 3%D version=2013.03.22, 4%D title=\CONTEXT\ Typesetting Macros, 5%D subtitle=Language Goodies, 6%D author=Hans Hagen, 7%D date=\currentdate, 8%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] 9%C 10%C This module is part of the \CONTEXT\ macro||package and is 11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for 12%C details. 13 14\writestatus{loading}{ConTeXt Typography Macros / Languages} 15 16\unprotect 17 18\registerctxluafile{typo-lan}{autosuffix} 19 20%D \macros 21%D {languagecharwidth, averagecharwidth, charwidthlanguage} 22%D 23%D This is a more \MKIV-ish variant of lang-frq.mkiv. The methods are gone as one 24%D doesn't need the tables for them. The main macro is \type {\averagecharwidth} 25%D which behaves like a dimension register. 26%D 27%D I finally decided to reimplement this as I needed it for a manual (which is often 28%D a reason for such a rewrite). With some inspiring Porcupine Tree in the 29%D background it's not the worst thing to do. The \LMTX\ variant is a bit more 30%D flexible as it can also set, not that someone will notice. 31 32\mutable\def\charwidthlanguage{\currentmainlanguage} 33 34% \languagecharwidth{language} is defined at the lua end 35 36\permanent\def\averagecharwidth{\languagecharwidth{\charwidthlanguage}} 37 38\protect \endinput 39 40% \setuplayout[backspace=4cm] 41% 42% \showframe 43% 44% \starttext 45% 46% \startbuffer 47% 48% \mainlanguage[en] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par 49% \mainlanguage[de] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par 50% \mainlanguage[nl] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par 51% 52% \languagecharwidth{de}=\languagecharwidth{en} 53% 54% \stopbuffer 55% 56% \getbuffer \blank 57% 58% \switchtobodyfont[pagella] 59% 60% \getbuffer \blank 61% 62% \switchtobodyfont[tt,8pt] 63% 64% \getbuffer 65% 66% \stoptext 67 |