lilypond-1.4.1
[lilypond.git] / lily / tex.cc
blob635b281aa6e73f0dfd9f628000be6558455eb376
1 /*
2 tex.cc -- implement TeX related misc functions
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "dimension.hh"
10 #include "tex.hh"
11 #include "atom.hh"
12 #include "array.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);