summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/blob-ini.mkxl
blob: 2e27ab20eddf9c4b7616c8509df72936cb1bccd8 (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
%D \module
%D   [       file=blob-ini,
%D        version=2010.04.06,
%D          title=\CONTEXT\ \LUA\ Typesetting,
%D       subtitle=Initialization,
%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 Lua Typesetting / Initialization}

%D This is a prelude to typesetting at the \LUA\ end. The code
%D is already quite old but will only get nice when we are further
%D down the road (close to version 1.00 of \LUATEX). Typesetting in
%D pure \LUA\ sometimes makes sense.

\registerctxluafile{node-typ}{autosuffix} % experimental
\registerctxluafile{blob-ini}{autosuffix}

\unprotect

% \widthofstring          % defined in lua
% \heightofstring         % defined in lua
% \depthofstring          % defined in lua
% \heightanddepthofstring % defined in lua

\permanent\def\wdofstring#1{\dimexpr\widthofstring {#1}\relax} % assured an dimen
\permanent\def\htofstring#1{\dimexpr\heightofstring{#1}\relax} % assured an dimen
\permanent\def\dpofstring#1{\dimexpr\depthofstring {#1}\relax} % assured an dimen
\permanent\def\hdofstring#1{\dimexpr\totalofstring {#1}\relax} % assured an dimen

\aliased\let\heightanddepthofstring\totalofstring
\aliased\let\htdpofstring          \hdofstring

% \let\hd\htdp % if yes then move this

% This one takes anything that can be typeset

\permanent\protected\def\setwidthof#1\to#2{\edef#2{\widthofstring{#1}}}

\protect \endinput

% \starttext
%
% \startluacode
%     local b = blobs.new()
%     blobs.append(b,"Hello    world.\n Here we are.\n\n And Again!")
%     blobs.pack(b)
%     blobs.write(b)
% \stopluacode
%
% \stoptext