summaryrefslogtreecommitdiff
path: root/tex.cc
blob: ae9dc1b5f3064bb2e9d7d6fc239a046394b4030c (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
#include "dimen.hh"
#include "tex.hh"
#include "symbol.hh"
#include "const.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.pos('%');
    if (!p ) return ;
    else p--;
    r = r.left(p) + arg + r.right(r.len() - p -1);
}


String
substitute_args(String source, svec<String> args)    
{
    String retval (source);
    for (int i = 0 ; i < args.sz(); i++)
        substitute_arg(retval, args[i]);
    while (retval.pos('%'))
        substitute_arg(retval, "");
    return retval;
}