* lily/main.cc: reinstate PS as standard output format.
* scm/framework-tex.scm (output-preview-framework): print systems
up to first non title system.
2004-11-08 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/slur.cc: add 'positions to interface
+
+ * lily/main.cc: reinstate PS as standard output format.
+
+ * scm/framework-tex.scm (output-preview-framework): print systems
+ up to first non title system.
+
* lily/grace-engraver.cc (start_translation_timestep): split
scm_cadddr
--- /dev/null
+
+\header {
+
+ texidoc = "Setting @code{positions} overrides the automatic
+positioning of the slur. It selects the slur configuration closest to
+the given pair. "
+
+ }
+\version "2.5.0"
+
+\paper { raggedright = ##T }
+\relative {
+ \override Slur #'positions = #'(-4 . -5)
+ e( f g)
+}
+
#include "box.hh"
#include "lily-proto.hh"
#include "parray.hh"
+#include "lily-guile.hh"
struct Slur_score_parameters
{
Encompass_info get_encompass_info (Grob *col) const;
Array<Extra_collision_info> get_extra_encompass_infos () const;
Real move_away_from_staffline (Real y, Grob *on_staff) const;
+ int get_closest_index (SCM inspect_quants) const;
};
/* Selected output format.
One of tex, ps, scm, as. */
-String output_format_global = "tex";
+String output_format_global = "ps";
/* Current output name. */
String output_name_global;
return;
state.generate_curves ();
- Bezier best (state.get_best_curve());
+ SCM end_ys = me->get_property ("positions");
+ Bezier best;
+
+ if (is_number_pair (end_ys))
+ {
+ best = state.configurations_[state.get_closest_index (end_ys)]->curve_;
+ }
+ else
+ {
+ best = state.get_best_curve();
+ }
SCM controls = SCM_EOL;
for (int i = 4; i--;)
if (to_boolean (slur_->get_layout ()
->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
&& scm_is_pair (inspect_quants))
- {
- Drul_array<Real> ins = ly_scm2interval (inspect_quants);
- Real mindist = 1e6;
- for (int i = 0; i < configurations_.size (); i ++)
- {
- Real d =fabs (configurations_[i]->attachment_[LEFT][Y_AXIS] - ins[LEFT])
- + fabs (configurations_[i]->attachment_[RIGHT][Y_AXIS] - ins[RIGHT]);
- if (d < mindist)
- {
- opt_idx = i;
- mindist= d;
- }
- }
- if (mindist > 1e5)
- programming_error ("Could not find quant.");
- }
+ opt_idx = get_closest_index (inspect_quants);
configurations_[opt_idx]->score_card_ += to_string ("=%.2f", opt);
configurations_[opt_idx]->score_card_ += to_string ("i%d", opt_idx);
// debug quanting
slur_->set_property ("quant-score",
- scm_makfrom0str (configurations_[opt_idx]->score_card_.to_str0 ()));
+ scm_makfrom0str (configurations_[opt_idx]->score_card_.to_str0 ()));
#endif
return configurations_[opt_idx]->curve_;
}
+int
+Slur_score_state::get_closest_index (SCM inspect_quants) const
+{
+ Drul_array<Real> ins = ly_scm2interval (inspect_quants);
+
+ int opt_idx = -1;
+ Real mindist = 1e6;
+ for (int i = 0; i < configurations_.size (); i ++)
+ {
+ Real d =fabs (configurations_[i]->attachment_[LEFT][Y_AXIS] - ins[LEFT])
+ + fabs (configurations_[i]->attachment_[RIGHT][Y_AXIS] - ins[RIGHT]);
+ if (d < mindist)
+ {
+ opt_idx = i;
+ mindist= d;
+ }
+ }
+ if (mindist > 1e5)
+ programming_error ("Could not find quant.");
+ return opt_idx;
+}
+
/*
TODO: should analyse encompasses to determine sensible region, and
should limit slopes available.
ADD_INTERFACE (Slur, "slur-interface",
"A slur",
- "quant-score excentricity encompass-objects control-points dashed slur-details direction height-limit note-columns ratio thickness");
+ "positions quant-score excentricity encompass-objects control-points dashed slur-details direction height-limit note-columns ratio thickness");
(ly:get-option 'resolution))
(string-append (basename name ".tex") ".ps"))))
-
-;;
-;; ugh - double check this. We are leaking
-;; untrusted (user-settable) info to a command-line
-;;
-
-
(define-public (convert-to-ps book name)
(let* ((paper (ly:paper-book-paper book))
(preview? (string-contains name ".preview"))
+
(papersizename (ly:output-def-lookup paper 'papersizename))
(landscape? (eq? #t (ly:output-def-lookup paper 'landscape)))
(base (basename name ".tex"))
" -E "
(string-append
" -t "
+
+ ;; careful: papersizename is user-set.
(sanitize-command-option papersizename)))
(if landscape?