summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/typo-lan.mkxl
blob: 7fc2a7b46a8d6a3fd34d9ebd9128e7776e5d59c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
%D \module
%D   [       file=typo-lan,
%D        version=2013.03.22,
%D          title=\CONTEXT\ Typesetting Macros,
%D       subtitle=Language Goodies,
%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 Typography Macros / Languages}

\unprotect

\registerctxluafile{typo-lan}{autosuffix}

%D \macros
%D   {languagecharwidth, averagecharwidth, charwidthlanguage}
%D
%D This is a more \MKIV-ish variant of lang-frq.mkiv. The methods are gone as one
%D doesn't need the tables for them. The main macro is \type {\averagecharwidth}
%D which behaves like a dimension register.
%D
%D I finally decided to reimplement this as I needed it for a manual (which is often
%D a reason for such a rewrite). With some inspiring Porcupine Tree in the
%D background it's not the worst thing to do. The \LMTX\ variant is a bit more
%D flexible as it can also set, not that someone will notice.

\mutable\def\charwidthlanguage{\currentmainlanguage}

% \languagecharwidth{language} is defined at the lua end

\permanent\def\averagecharwidth{\languagecharwidth{\charwidthlanguage}}

\protect \endinput

% \setuplayout[backspace=4cm]
%
% \showframe
%
% \starttext
%
% \startbuffer
%
% \mainlanguage[en] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par
% \mainlanguage[de] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par
% \mainlanguage[nl] \hsize65\averagecharwidth \normalexpanded{\inleft{\the\hsize}} \input ward \par
%
% \languagecharwidth{de}=\languagecharwidth{en}
%
% \stopbuffer
%
% \getbuffer \blank
%
% \switchtobodyfont[pagella]
%
% \getbuffer \blank
%
% \switchtobodyfont[tt,8pt]
%
% \getbuffer
%
% \stoptext