mp-form.mpxl /size: 1044 b    last modification: 2021-10-28 13:50
1
%D \module
2
%D [ file=mp-form.mpiv,
3
%D version=2011.10.14,
4
%D title=\CONTEXT\ \METAPOST\ graphics,
5
%D subtitle=form support,
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 licen-en.pdf for
12
%C details.
13 14
% The graph package will be replaced by our own variant using
15
% MetaPost 2 features and textext.
16 17
if
known
metafun_loaded_form
:
endinput
;
fi
;
18 19
newinternal
boolean
metafun_loaded_form
;
metafun_loaded_form
:
=
true
;
immutable
metafun_loaded_form
;
20 21
% The following function accept a number or string that can be
22
% converted to a number by \LUA. The first argument is a format
23
% where @ can be used instead of %. The number is typeset in math
24
% mode and @3e is converted into @.3e.
25 26
vardef
mfun_format_number
(
expr
fmt
,
i
)
=
27
"
\ctxlua{metapost.formatnumber('
"
&
fmt
&
"
',
"
&
if
string
i
:
i
else
:
decimal
i
fi
&
"
)}
"
28
enddef
;
29