]> git.donarmstrong.com Git - lilypond.git/blob - lily/tex.cc
04f3e9cf4ace306ec946927dba1226c5414c32f3
[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--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "dimen.hh"
10 #include "tex.hh"
11 #include "atom.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   return retval;
39 }
40
41 String
42 substitute_args (String source, Array<Scalar> args)    
43 {
44   Array<String> sv;
45   for (int i = 0 ; i < args.size(); i++)
46         sv.push (args[i]);
47   
48   return substitute_args (source, sv);
49 }