From 712730f5a1fceb57551dc23dde6cb885e9cc3159 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:13:55 +0000 Subject: [PATCH] lilypond-1.0.4 --- VERSION | 2 +- init/property.ly | 4 ++++ lily/VERSION | 2 +- lily/include/text-def.hh | 2 ++ lily/lyric-engraver.cc | 5 +++++ lily/parser.yy | 2 +- lily/script-engraver.cc | 5 +++++ lily/text-def.cc | 25 +++++++++++++++++++------ 8 files changed, 38 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index 7453b04628..875f4fb000 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=0 -PATCH_LEVEL=3 +PATCH_LEVEL=4 MY_PATCH_LEVEL= # use the above to send patches, always empty for released version: diff --git a/init/property.ly b/init/property.ly index 75d8f10669..a53eccbf6e 100644 --- a/init/property.ly +++ b/init/property.ly @@ -29,6 +29,10 @@ slurydirection -1 force stem down \slurdown slurydirection 0 stem direction free \slurboth slurydirection 1 force stem up \slurup +textalignment -1 left alignment of text +textalignment 0 center alignment of text +textalignment 1 right alignment of text + [Score?] beamslopedamping 0 no damping \beamslopeproportional beamslopedamping 1 damping1) \beamslopedamped diff --git a/lily/VERSION b/lily/VERSION index 7453b04628..875f4fb000 100644 --- a/lily/VERSION +++ b/lily/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=0 -PATCH_LEVEL=3 +PATCH_LEVEL=4 MY_PATCH_LEVEL= # use the above to send patches, always empty for released version: diff --git a/lily/include/text-def.hh b/lily/include/text-def.hh index 296350de45..e4b42d1233 100644 --- a/lily/include/text-def.hh +++ b/lily/include/text-def.hh @@ -36,6 +36,8 @@ public: Text_def(); virtual void print() const; virtual Interval width (Paper_def*) const; +private: + Real guess_width_f(Atom&) const; }; #endif // TEXT_DEF_HH diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 8ed3989043..ceba7c467e 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -44,6 +44,11 @@ Lyric_engraver::do_process_requests() { td_p->style_str_ = style; } + Scalar alignment = get_property ("textalignment"); + if (alignment.isnum_b()) + { + td_p->align_dir_= (Direction)(int)alignment; + } lyric_item_p_ = new Text_item (td_p); diff --git a/lily/parser.yy b/lily/parser.yy index 4b9ec9fd2f..5df3722a0a 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1112,7 +1112,7 @@ script_req: gen_script_def: text_def { $$ = $1; - ((Text_def*) $$)->align_dir_ = CENTER; /* UGH */ + ((Text_def*) $$)->align_dir_ = LEFT; /* UGH */ } | mudela_script { $$ = $1; diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 435e312729..671ca17e38 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -69,6 +69,11 @@ Script_engraver::do_pre_move_processing() { td_l->style_str_= style; } + Scalar alignment = get_property ("textalignment"); + if (alignment.isnum_b()) + { + td_l->align_dir_= (Direction)(int)alignment; + } } typeset_element (script_p); } diff --git a/lily/text-def.cc b/lily/text-def.cc index b0dbaf5611..6c1664017b 100644 --- a/lily/text-def.cc +++ b/lily/text-def.cc @@ -12,6 +12,7 @@ #include "molecule.hh" #include "text-def.hh" #include "dimension.hh" +#include Direction Text_def::staff_dir () const @@ -21,16 +22,29 @@ Text_def::staff_dir () const return DOWN; } +Real +Text_def::guess_width_f(Atom& a) const +{ + // Count each TeX command as one character, ugh + int index, length=0; + int total_length=text_str_.length_i(); + const char* str=text_str_.ch_C(); + for (index=0;indexlookup_l(0)->text (style_str_, text_str_); - Real guess_width_f = text_str_.length_i() * a.dim_.x ().length (); // ugh - a.translate_axis (-(align_dir_ + 1)* guess_width_f/ 2, X_AXIS); + a.translate_axis (-(align_dir_ + 1)* guess_width_f (a) / 2, X_AXIS); return a; } -- 2.39.5