summaryrefslogtreecommitdiff
path: root/lily/tex.cc
blob: 6e5e987f5daa5f9d3a98c42472ba6337c2a66bc4 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
  tex.cc -- implement TeX related misc functions

  source file of the GNU LilyPond music typesetter

  (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/

#include "dimen.hh"
#include "tex.hh"
#include "symbol.hh"
#include "varray.hh"

String
vstrut (Real h)
{
    return String ("\\vrule height ") + print_dimen (h) + "depth 0pt width 0pt";
}


static void
substitute_arg (String& r, String arg)
{
    int p = r.index_i ('%');
    if (p < 0)
	return ;

    r = r.left_str (p) + arg + r.right_str (r.length_i() - p -1);
}


String
substitute_args (String source, Array<String> args)    
{
    String retval (source);
    for (int i = 0 ; i < args.size(); i++)
        substitute_arg (retval, args[i]);
    /*
    while (retval.index_i ('%') >= 0)
        substitute_arg (retval, "");
	*/
    return retval;
}

String
substitute_args (String source, Array<Scalar> args)    
{
    Array<String> sv;
    for (int i = 0 ; i < args.size(); i++)
	sv.push (args[i]);
    
    return substitute_args (source, sv);
}