File size: 1,845 Bytes
f65fe85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
%
% lilymetrics.tex
%
% This file is part of LilyPond, the GNU music typesetter.
%
% Copyright (C) 2004 Han-Wen Nienhuys <[email protected]>
%
% LilyPond is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LilyPond is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
%
\catcode `\@=11\relax

\newdimen\lily@globalscale
\newdimen\lily@localscale
\newbox\lily@metricsbox
\newwrite\lily@metricsfile

\def\lilyglobalscale#1{%
  \lily@globalscale #1pt
}

\def\lilymetricsfile#1{%
  \immediate\openout\lily@metricsfile #1\relax
}

\begingroup
  \catcode `P=12
  \catcode `T=12
  \lowercase{%
    \def\x{%
      \def\lily@rempt##1.##2PT{%
        ##1\ifnum ##2 > \z@ .##2\fi
      }%
    }%
  }
\expandafter\endgroup\x

\def\lily@strippt{%
  \expandafter\lily@rempt
}

\long\def\lilygetmetrics#1#2#3#4{%
  \lily@localscale #3\lily@globalscale
  % convert pt to 1000*sp (1000/65536)
  \lily@localscale 0.015259\lily@localscale
  \font\lily@font = #2 scaled \lily@localscale
  \setbox\lily@metricsbox\hbox{%
    \lily@font
    #4%
  }%
  \edef\lily@wd{\the\wd\lily@metricsbox}%
  \edef\lily@ht{\the\ht\lily@metricsbox}%
  \edef\lily@dp{\the\dp\lily@metricsbox}%
  \immediate\write\lily@metricsfile{%
    ("#1" . (\lily@strippt\lily@wd
           \space\lily@strippt\lily@ht
           \space\lily@strippt\lily@dp))%
  }%
}

\catcode `\@=13\relax

\endinput