]> git.donarmstrong.com Git - lilypond.git/blob - lily/tex.cc
release: 0.1.1
[lilypond.git] / lily / tex.cc
1 /*
2   tex.cc -- implement TeX related misc functions
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "dimen.hh"
10 #include "tex.hh"
11 #include "symbol.hh"
12 #include "varray.hh"
13
14 String
15 vstrut(Real h)
16 {
17     return String("\\vrule height ") + print_dimen(h) + "depth 0pt width 0pt";
18 }
19
20
21 static void
22 substitute_arg(String& r, String arg)
23 {
24     int p = r.index_i('%');
25     if (p < 0)
26         return ;
27
28     r = r.left_str(p) + arg + r.right_str(r.length_i() - p -1);
29 }
30
31
32 String
33 substitute_args(String source, Array<String> args)    
34 {
35     String retval (source);
36     for (int i = 0 ; i < args.size(); i++)
37         substitute_arg(retval, args[i]);
38     /*
39     while (retval.index_i('%') >= 0)
40         substitute_arg(retval, "");
41         */
42     return retval;
43 }
44
45 String
46 substitute_args(String source, Array<Scalar> args)    
47 {
48     Array<String> sv;
49     for (int i = 0 ; i < args.size(); i++)
50         sv.push(args[i]);
51     
52     return substitute_args(source, sv);
53 }