summaryrefslogtreecommitdiff
path: root/tex/context/base/typo-lan.mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-03-23 14:11:00 +0100
committerHans Hagen <pragma@wxs.nl>2013-03-23 14:11:00 +0100
commit7c3dc990b7eb267958c5e904577c30cc92956db2 (patch)
treef631c6de220ff946dfe8bb5f4be2453a69f56066 /tex/context/base/typo-lan.mkiv
parent05a22240a1730a9e3bf3fc5e5a87befe7b823d85 (diff)
downloadcontext-7c3dc990b7eb267958c5e904577c30cc92956db2.tar.gz
beta 2013.03.23 14:11
Diffstat (limited to 'tex/context/base/typo-lan.mkiv')
-rw-r--r--tex/context/base/typo-lan.mkiv63
1 files changed, 63 insertions, 0 deletions
diff --git a/tex/context/base/typo-lan.mkiv b/tex/context/base/typo-lan.mkiv
new file mode 100644
index 000000000..bb4ed2042
--- /dev/null
+++ b/tex/context/base/typo-lan.mkiv
@@ -0,0 +1,63 @@
+%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}{1.001}
+
+%D \macros
+%D {averagecharwidth, charwidthlanguage}
+%D
+%D This is a more \MKIV-ish variant of lang-frq.mkiv. The methods are
+%D gone as one doesn't need the tables for them. The main macro is
+%D \type {\averagecharwidth} which behaves like a dimension register.
+%D
+%D I finally decided to reimplement this as I needed it for a manual
+%D (which is often a reason for such a rewrite). With some inspiring
+%D Porcupine Tree in the background it's not the worst thing to do.
+
+\def\charwidthlanguage{\currentmainlanguage}
+
+\def\averagecharwidth{\dimexpr\ctxcommand{averagecharwidth("\charwidthlanguage")}\scaledpoint\relax}
+
+\protect
+
+\continueifinputfile{typo-lan.mkiv}
+
+\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
+
+\stopbuffer
+
+\getbuffer \blank
+
+\switchtobodyfont[pagella]
+
+\getbuffer \blank
+
+\switchtobodyfont[tt,8pt]
+
+\getbuffer
+
+\stoptext