9 char direction_char(int y_sign
)
29 Lookup::half_slur_middlepart(Real
&dx
, int dir
)
31 if (dx
>= 400 PT
) {// todo
32 WARN
<<"halfslur too large" <<print_dimen(dx
)<< "shrinking (ugh)\n";
35 int widx
= int(floor(dx
/ 4.0));
39 WARN
<< "slur too narrow\n";
44 s
.dim
.y
= Interval(min(0,0), max(0,0)); // todo
45 s
.dim
.x
= Interval(0,dx
);
47 String f
= String("\\hslurchar");
48 f
+= direction_char(0);
55 f
+=String( "{" ) + String( idx
) + "}";
58 a
.translate(Offset(dx
/2,0));
59 s
.tex
= a
.TeXstring();
64 Lookup::half_slur(int dy
, Real
&dx
, int dir
, int xpart
)
68 return half_slur_middlepart(dx
, dir
);
73 WARN
<< "Slur half too wide." << print_dimen(orig_dx
) << " shrinking (ugh)\n";
77 widx
= int(rint(dx
/12.0));
82 WARN
<< "slur too narrow " << print_dimen(orig_dx
)<<"\n";
86 s
.dim
.x
= Interval(0,dx
);
87 s
.dim
.y
= Interval(min(0,dy
), max(0,dy
));
90 String f
= String("\\hslurchar");
92 f
+= direction_char(dir
);
101 idx
= widx
* 16 + hidx
;
105 f
+=String( "{" ) + String( idx
) + "}";
114 Lookup::slur (int dy
, Real
&dx
, int dir
)
116 assert(dx
>=0 && abs(dir
) <= 1);
117 int y_sign
= sign(dy
);
119 bool large
= dy
> 16;
122 large
|= dx
>= 4*16 PT
;
124 large
|= dx
>= 4*54 PT
;
127 return big_slur(dy
, dx
, dir
);
130 int widx
= int(floor(dx
/4.0)); // slurs better too small..
135 WARN
<< "slur too narrow: " << print_dimen(orig_dx
) << "\n";
143 WARN
<<"slur to steep: " << dy
<< " shrinking (ugh)\n";
147 s
.dim
.x
= Interval(0,dx
);
148 s
.dim
.y
= Interval(min(0,dy
), max(0,dy
));
150 String f
= String("\\slurchar") + String( direction_char(y_sign
) );
154 idx
= hidx
* 16 + widx
;
159 WARN
<< "slur too wide: " << print_dimen(dx
) <<
160 " shrinking (ugh)\n";
168 f
+=String( "{" ) + String( idx
) + "}";
172 a
.translate(Offset(dx
/2,0));
174 s
.tex
= a
.TeXstring();
179 Lookup::big_slur(int dy
, Real
&dx
, int dir
)
182 Real slur_extra
=abs(dy
) /2.0 + 2;
183 int l_dy
= int(Real (dy
)/2 + slur_extra
*dir
);
184 int r_dy
= dy
- l_dy
;
186 Real left_wid
= dx
/4.0;
187 Real right_wid
= left_wid
;
189 Atom l
= half_slur(l_dy
, left_wid
, dir
, -1);
190 Atom r
= half_slur(r_dy
, right_wid
, dir
, 1);
191 Real mid_wid
= dx
- left_wid
- right_wid
;
193 Atom m
= half_slur(0, mid_wid
, dir
, 0);
198 a
.translate(Offset(0,slur_extra
* internote()));
201 mol
.translate(Offset(0, l_dy
* internote()));
203 s
.tex
= mol
.TeXstring();
204 s
.dim
= mol
.extent();