k-l-lambda's picture
added node-addon-lilypond
f65fe85
%
% 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