3 Code to generate beams for TeX
11 #include "symtable.hh"
17 Lookup::beam_element (int sidx, int widx, Real slope) const
19 Symbol bs=(*symtables_)("beamslopes")->lookup ("slope");
24 bs.tex = substitute_args (bs.tex,args);
27 bs.dim.x() = Interval (0,width);
28 bs.dim.y() = Interval (0,width*slope);
32 // ugh.. hard wired tex-code.
38 WARN << "beam steeper than 0.5 (" << s << ")\n";
42 int i = int (rint (s * 20.0));
52 Lookup::rule_symbol (Real height, Real width) const
54 Symbol bs=(*symtables_)("beamslopes")->lookup ("horizontal");
56 args.push (print_dimen (height));
57 args.push (print_dimen (width));
58 bs.tex = substitute_args (bs.tex,args);
59 bs.dim.x() = Interval (0,width);
60 bs.dim.y() = Interval (0,height);
65 Lookup::beam (Real &slope, Real width) const
67 int sidx = slope_index (slope);
69 return rule_symbol (2 PT, width);
72 WARN<<"Beam too narrow. (" << print_dimen (width) <<")\n";
75 Real elemwidth = 64 PT;
80 while (elemwidth > width)
85 Real overlap = elemwidth/4;
86 Real last_x = width - elemwidth;
88 Atom elem (beam_element (sidx, widx, slope));
94 a.translate (Offset (x-overlap, (x-overlap)*slope));
96 x += elemwidth - overlap;
99 a.translate (Offset (last_x, (last_x) * slope));
103 ret.tex = m.TeX_string();
104 ret.dim.y() = Interval (0,width*slope);
105 ret.dim.x() = Interval (0,width);