]> git.donarmstrong.com Git - lilypond.git/blob - tex/lilypond-tex-metrics.tex
init timing to #t. Fixes bar checks in
[lilypond.git] / tex / lilypond-tex-metrics.tex
1 %
2 % lilymetrics.tex
3 %
4 \catcode `\@=11\relax
5
6 \newdimen\lily@globalscale
7 \newdimen\lily@localscale
8 \newbox\lily@metricsbox
9 \newwrite\lily@metricsfile
10
11 \def\lilyglobalscale#1{%
12   \lily@globalscale #1pt
13 }
14
15 \def\lilymetricsfile#1{%
16   \immediate\openout\lily@metricsfile #1\relax
17 }
18
19 \begingroup
20   \catcode `P=12
21   \catcode `T=12
22   \lowercase{%
23     \def\x{%
24       \def\lily@rempt##1.##2PT{%
25         ##1\ifnum ##2 > \z@ .##2\fi
26       }%
27     }%
28   }
29 \expandafter\endgroup\x
30
31 \def\lily@strippt{%
32   \expandafter\lily@rempt
33 }
34
35 \long\def\lilygetmetrics#1#2#3#4{%
36   \lily@localscale #3\lily@globalscale
37   % convert pt to 1000*sp (1000/65536)
38   \lily@localscale 0.015259\lily@localscale
39   \font\lily@font = #2 scaled \lily@localscale
40   \setbox\lily@metricsbox\hbox{%
41     \lily@font
42     #4%
43   }%
44   \edef\lily@wd{\the\wd\lily@metricsbox}%
45   \edef\lily@ht{\the\ht\lily@metricsbox}%
46   \edef\lily@dp{\the\dp\lily@metricsbox}%
47   \immediate\write\lily@metricsfile{%
48     ("#1" . (\lily@strippt\lily@wd
49            \space\lily@strippt\lily@ht
50            \space\lily@strippt\lily@dp))%
51   }%
52 }
53
54 \catcode `\@=13\relax
55
56 \endinput