2 tex-beam.cc -- implement Lookup::{beam_element, beam, rule_symbol}
4 source file of the GNU LilyPond music typesetter
6 (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 Code to generate beams for TeX
15 #include "molecule.hh"
17 #include "symtable.hh"
22 #include "paper-def.hh"
23 #include "string-convert.hh"
28 Lookup::rule_symbol (Real height, Real width) const
30 Atom bs=(*symtables_p_)("param")->lookup ("rule");
32 args.push (print_dimen (height));
33 args.push (print_dimen (width));
34 bs.tex_ = substitute_args (bs.tex_,args);
35 bs.dim_.x() = Interval (0,width);
36 bs.dim_.y() = Interval (0,height);
41 Lookup::beam(Real &slope, Real width, Real y_thick) const
44 Atom a( ps_beam (slope, width, y_thick));
45 Real slope_y =slope * width;
46 Real min_y = (0 <? slope_y )- y_thick/2;
47 Real max_y = (0 >? slope_y) + y_thick/2;
49 a.dim_[X_AXIS] = Interval(0, width);
50 a.dim_[Y_AXIS] = Interval(min_y, max_y);
55 Lookup::ps_beam (Real slope, Real width, Real y_thickness)const
57 String ps = "\\embeddedps{\n";
58 ps += String (width) + " "+ String (slope) + " " + String (y_thickness)
62 beam parts are rarely wider than 100pt:
63 precision of 4 yields maximum (half beam spanning half a page)
64 error of: 1%% * 3*72pt === 0.2pt = 0.07mm
66 String width_str = String_convert::precision_str (width, 4);
67 String slope_str = String_convert::precision_str (slope, 4);
68 String thick_str = String_convert::precision_str (y_thickness, 3);
69 String name = "feta-beum-" + width_str + "-" + slope_str + "-" + thick_str;
72 while ((i = name.index_i ('.')) != -1)