1
2
3
4
5
6
7
8
9
10
11
12
13
14if known metafun_loaded_figs : endinput ; fi ;
15
16newinternal boolean metafun_loaded_figs ; metafun_loaded_figs := true ; immutable metafun_loaded_figs ;
17
18
19
20def registerfigure(expr name,width,height) =
21 begingroup ;
22 save s ; string s ; s := cleanstring(name) ;
23 scantokens( s & "_width := " & decimal(width )) ;
24 scantokens( s & "_height := " & decimal(height)) ;
25 endgroup ;
26enddef ;
27
28vardef figuresize(expr name) =
29 save s, p ; string s ; pair p ;
30 s := cleanstring(name) ;
31 scantokens( "p := " & "(" & s & "_width" & "," & s & "_height" & ")" ) ;
32 p
33enddef ;
34
35vardef figurewidth(expr name) =
36 xpart figuresize(name)
37enddef ;
38
39vardef figureheight(expr name) =
40 ypart figuresize(name)
41enddef ;
42
43let figuredimensions = figuresize ;
44
45def naturalfigure(expr name) =
46 externalfigure name xyscaled(figuresize(name))
47enddef ;
48 |