lilypond-0.1.57
[lilypond.git] / lily / tex.cc
blob19285561c1296280fa5923ae3c44d8e416e6a8a6
1 /*
2 tex.cc -- implement TeX related misc functions
4 source file of the GNU LilyPond music typesetter
6 (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "dimen.hh"
10 #include "tex.hh"
11 #include "atom.hh"
12 #include "varray.hh"
14 String
15 vstrut (Real h)
17 return String ("\\vrule height ") + print_dimen (h) + "depth 0pt width 0pt";
21 static void
22 substitute_arg (String& r, String arg)
24 int p = r.index_i ('%');
25 if (p < 0)
26 return ;
28 r = r.left_str (p) + arg + r.right_str (r.length_i() - p -1);
32 String
33 substitute_args (String source, Array<String> args)
35 String retval (source);
36 for (int i = 0 ; i < args.size(); i++)
37 substitute_arg (retval, args[i]);
38 return retval;
41 String
42 substitute_args (String source, Array<Scalar> args)
44 Array<String> sv;
45 for (int i = 0 ; i < args.size(); i++)
46 sv.push (args[i]);
48 return substitute_args (source, sv);