From: Nicolas Sceaux Date: Mon, 1 Jan 2007 11:57:18 +0000 (+0100) Subject: Merge branch 'master' of git://git.sv.gnu.org/lilypond X-Git-Tag: release/2.11.10-1~79^2~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ba3045ce76cd37a4e11fd775fa04ce4b7586ad77;hp=38cb4178d57c3d964f5e4187be34d7372b4a646b;p=lilypond.git Merge branch 'master' of git://git.sv.gnu.org/lilypond --- diff --git a/.gitignore b/.gitignore index 1dcb043399..1f6b89a514 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,39 @@ +*- *-midi.ly *-systems.tex *-systems.texi +*.600pk *.afm *.aux *.eps +*.gcda +*.gcno +*.gcov *.log *.midi *.orig +*.patch +*.pats *.pdf *.ps *.pyc *.rej +*.signature *.svg *.tfm *~ +*~* +.\#* .dotest .gdbinit .htaccess +/*.html +/*.ly +/*.png /.sconf_temp /.sconsign.dblite /GNUmakefile +/local.make /scons.cache /x ?.* @@ -27,6 +41,7 @@ AUTHORS.txt INSTALL.txt TAGS \#* +\#.* a.out aclocal.m4 autom4te.cache @@ -41,7 +56,3 @@ lily-[0-9a-f][0-9a-f][0-9a-f]* out-scons tags test-output-distance -*.gcov -*.gcda -*.gcno -*.600pk diff --git a/Documentation/fr/user/tutorial.itely b/Documentation/fr/user/tutorial.itely index b8869424a5..5f7e7138b7 100644 --- a/Documentation/fr/user/tutorial.itely +++ b/Documentation/fr/user/tutorial.itely @@ -1,5 +1,14 @@ @c -*- coding: utf-8; mode: texinfo; documentlanguage: fr -*- @c This file is part of lilypond.tely +@c +@c Translation of GIT committish: 829be449be664ea765ed43f5d56b50b41e43b397 +@c +@c When revising a translation, copy the HEAD committish of the +@c version that you are working on. Use +@c +@c git-rev-list HEAD | head -1 +@c +@c to discover that. @c TODO: @c * more details about running lilypond; error messages, diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 3a59f03536..df38af90cc 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -66,6 +66,15 @@ which scares away people. @end ignore + +@item Alterations (such as a sharp and flat) may now be arbitrary +fractions. This allows some forms of microtonal music. For example, +Turkish makam music uses 1/9th tone alterations. + +@lilypondfile{makam.ly} + + + @item Tie directions may be set with @code{^~} and @code{_~} @item Tablature now supports harmonics and slides, diff --git a/Documentation/topdocs/README.texi b/Documentation/topdocs/README.texi index 2d6e26b99e..e0e7a16503 100644 --- a/Documentation/topdocs/README.texi +++ b/Documentation/topdocs/README.texi @@ -32,12 +32,12 @@ For compiling and running LilyPond see the installation instructions. These instructions can be found when you unpack lilypond, as @file{lilypond-x.y.z/INSTALL.txt}. They are also available on the web at -@uref{http://lilypond.org/doc/v2.1/Documentation/topdocs/out-www/INSTALL.html}. +@uref{http://lilypond.org/doc/v2.10/Documentation/topdocs/INSTALL.html}. @section Documentation The documentation is available online at -@uref{http://www.lilypond.org/doc/}. +@uref{http://lilypond.org/doc/}. You can also build it locally: follow the instructions under `Building documentation' in the installation instructions. diff --git a/Documentation/user/advanced-notation.itely b/Documentation/user/advanced-notation.itely index ad05abff27..1c19f5c0a7 100644 --- a/Documentation/user/advanced-notation.itely +++ b/Documentation/user/advanced-notation.itely @@ -842,6 +842,20 @@ You may use @code{format-mark-barnumbers}, @code{format-mark-box-barnumbers}, and @code{format-mark-circle-barnumbers} to get bar numbers instead of incremented numbers or letters. +Other styles of rehearsal mark can be specified manually + +@example +\mark "A1" +@end example + +@noindent +@code{Score.markFormatter} does not affect marks specified in this manner. +However, it is possible to apply a @code{\markup} to the string. + +@example +\mark \markup@{ \box A1 @} +@end example + @cindex segno @cindex coda @cindex D.S al Fine @@ -887,6 +901,8 @@ appears at that point in the music. @seealso +This manual: @ref{Text marks}. + Program reference: @internalsref{RehearsalMark}. Init files: @file{scm/@/translation@/-functions@/.scm} contains the diff --git a/Documentation/user/basic-notation.itely b/Documentation/user/basic-notation.itely index 342fe01ae7..aeeb5ed9d4 100644 --- a/Documentation/user/basic-notation.itely +++ b/Documentation/user/basic-notation.itely @@ -1140,6 +1140,10 @@ Similarly, you can merge half note heads with eighth notes, by setting c8 c4. } \\ { c2 c2 } >> @end lilypond +@noindent +@code{merge-differently-headed} and @code{merge-differently-dotted} +only apply to opposing stem directions (ie. Voice 1 & 2). + LilyPond also vertically shifts rests that are opposite of a stem, for example diff --git a/Documentation/user/instrument-notation.itely b/Documentation/user/instrument-notation.itely index e7e1b1aa89..d4da68346b 100644 --- a/Documentation/user/instrument-notation.itely +++ b/Documentation/user/instrument-notation.itely @@ -2526,9 +2526,9 @@ overview over all available note head styles. @cindex accidentals -Use the @code{style} property of grob @internalsref{Accidental} to -select ancient accidentals. Supported styles are -@code{mensural}, @code{vaticana}, @code{hufnagel}, and @code{medicaea}. +Use the @code{glyph-name-alist} property of grob +@internalsref{Accidental} and @internalsref{KeySignature} to select +ancient accidentals. @lilypond[quote,ragged-right,staffsize=26] \score { @@ -2575,7 +2575,7 @@ different style, as demonstrated in @inputfileref{input/@/test,ancient@/-accidentals@/.ly}. Similarly to local accidentals, the style of the key signature can be -controlled by the @code{style} property of the +controlled by the @code{glyph-name-alist} property of the @internalsref{KeySignature} grob. @seealso diff --git a/Documentation/user/introduction.itely b/Documentation/user/introduction.itely index 016b606603..ce38bab3a5 100644 --- a/Documentation/user/introduction.itely +++ b/Documentation/user/introduction.itely @@ -792,7 +792,7 @@ is a handy reference of the most common LilyPond commands. @item The -@emph{@ref{Command index}} +@emph{@ref{LilyPond command index}} is an index of all LilyPond @code{\commands}. @item diff --git a/Documentation/user/lilypond-book.itely b/Documentation/user/lilypond-book.itely index 587df0ee40..571bdbc199 100644 --- a/Documentation/user/lilypond-book.itely +++ b/Documentation/user/lilypond-book.itely @@ -35,11 +35,12 @@ This procedure may be applied to La@TeX{}, HTML, Texinfo or DocBook documents. * Integrating LaTeX and music:: * Integrating Texinfo and music:: * Integrating HTML and music:: -* Integrating DocBook and music:: +* Integrating DocBook and music:: * Music fragment options:: * Invoking lilypond-book:: * Filename extensions:: * Many quotes of a large score:: +* Inserting LilyPond output into OpenOffice.org:: * Inserting LilyPond output into other programs:: @end menu @@ -775,6 +776,17 @@ cd out ... @end example +@itemx --padding=@var{amount} +Pad EPS boxes by this much. @var{amount} is measured in milimeters, +and is 3.0 by default. This option should be used if the lines of +music stick out of the right margin. + +The width of a tightly clipped systems can vary, due to notation +elements that stick into the left margin, such as bar numbers and +instrument names. This option will shorten each line and move each +line to the right by the same amount. + + @item -P @var{process} @itemx --process=@var{command} Process LilyPond snippets using @var{command}. The default command is @@ -837,16 +849,13 @@ If you need to quote many fragments of a large score, you can also use the clip systems feature, see @ref{Extracting fragments of notation}. -@ignore -@n ode Inserting LilyPond output into OpenOffice.org -@s ection Inserting LilyPond output into OpenOffice.org +@node Inserting LilyPond output into OpenOffice.org +@section Inserting LilyPond output into OpenOffice.org -@c index OpenOffice.org +@cindex OpenOffice.org LilyPond notation can be added to OpenOffice.org with -@u ref{http://@/ooolilypond@/.sourceforge@/.net@/,OOoLilyPond} - -@end ignore +@uref{http://@/ooolilypond@/.sourceforge@/.net@/,OOoLilyPond} @node Inserting LilyPond output into other programs diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index f5a3d076b5..33e147d432 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -1,5 +1,14 @@ @c -*- coding: utf-8; mode: texinfo; -*- @c This file is part of lilypond.tely +@c +@c Translation of GIT committish: +@c +@c When revising a translation, copy the HEAD committish of the +@c version that you are working on. Use +@c +@c git-rev-list HEAD | head -1 +@c +@c to discover that. @c TODO: @c * more details about running lilypond; error messages, @@ -86,7 +95,11 @@ c' d' e' f' g' a' b' c'' @end lilypond @emph{Warning:} Every piece of LilyPond input needs to have -@{curly braces@} placed around the input. Don't forget them! +@{curly braces@} placed around the input. The braces should be +also be surrounded by a space unless +they are at the beginning or end of a line to avoid ambiguities. These +may be omitted in examples in this manual, but don't forget them in +your own music! @cindex Case sensitive In addition, LilyPond input is case sensitive. @code{ @{ c d e @} } is @@ -180,8 +193,10 @@ available package for viewing and printing PDF and PostScript files.} @section Second steps @emph{Remember:} Every piece of LilyPond input needs to -have @{curly braces@} placed -around the input. For the rest of this manual, most examples will +have @{curly braces@} placed around the input. +The braces should be surrounded by a space unless +they are at the beginning or end of a line to avoid ambiguities. +For the rest of this manual, most examples will omit these braces, but don't forget them in your own music! @c will be removed once the tutorial either explains \relative or diff --git a/GNUmakefile.in b/GNUmakefile.in index 2815b0c756..7fa0e1e7cc 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -212,7 +212,7 @@ test-clean: test: ## no aa-scaling, no PDF $(MAKE) -C input/regression/ out=test LILYPOND_BOOK_LILYPOND_FLAGS="--backend=eps --formats=ps,png $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=1" LILYPOND_BOOK_VERBOSE= out-test/collated-files.html - @find input ly -name '*.ly' |grep -v 'out.*/' | xargs grep '\\version' -L | sed 's/^/**** Missing version: /g' + @find input ly -name '*.ly' -print |grep -v 'out.*/' | xargs grep '\\version' -L | grep -v "standard input" |sed 's/^/**** Missing version: /g' diff --git a/THANKS b/THANKS index 0f0504bc43..d74eb3abd7 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -Release 2.10 +Release 2.11 ************ @@ -26,6 +26,7 @@ Bertalan Fodor Benjamin Drung Cameron Horsburgh Carl Sorensen +Christian Hitz David Bobroff Eduardo Vieira Jay Anderson diff --git a/VERSION b/VERSION index 745aac957e..1a4814ec83 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=11 -PATCH_LEVEL=6 +PATCH_LEVEL=7 MY_PATCH_LEVEL= diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py index e8984600ae..c94d402e79 100644 --- a/buildscripts/mf-to-table.py +++ b/buildscripts/mf-to-table.py @@ -256,4 +256,5 @@ for filenm in files: if depfile_nm: write_deps (open (depfile_nm, 'wb'), deps, [base + '.log', base + '.dvi', base + '.pfa', - base + '.pfb', texfile_nm]) + depfile_nm, + base + '.pfb', texfile_nm]) diff --git a/flower/include/rational.hh b/flower/include/rational.hh index ac1a6d12fc..511b8c2460 100644 --- a/flower/include/rational.hh +++ b/flower/include/rational.hh @@ -11,8 +11,6 @@ #include "std-string.hh" -#include "std-string.hh" - /** Rational numbers. Included is support for + and - infinity. */ diff --git a/flower/include/yaffut-parameters.hh b/flower/include/yaffut-parameters.hh new file mode 100644 index 0000000000..9a569f903c --- /dev/null +++ b/flower/include/yaffut-parameters.hh @@ -0,0 +1,30 @@ +#ifndef __YAFFUT_PARAMETERS_H__ +#define __YAFFUT_PARAMETERS_H__ + +#include "yaffut.hh" + +namespace yaffut { +template +struct TestOne: public ITest, public Suite +{ + ParameterOne const parameter_one_; + //static Registrator s_Registrator; + TestOne(ParameterOne p) + : Suite(p) + , parameter_one_ (p) + { + Registrator* r = &Test::s_Registrator; + r = 0; + } +}; + +#define TEST_STRING(Suite, Case, String)\ + namespace { \ + struct Case: public yaffut::TestOne{ Case(); }; \ + } \ + template struct yaffut::TestOne; Case::Case() \ + : yaffut::TestOne (String) + +} + +#endif // __YAFFUT_PARAMETERS_H__ diff --git a/flower/include/yaffut.hh b/flower/include/yaffut.hh new file mode 100644 index 0000000000..91a3521493 --- /dev/null +++ b/flower/include/yaffut.hh @@ -0,0 +1,359 @@ +// Copyright 2006 Rutger E.W. van Beusekom. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef __YAFFUT_H__ +#define __YAFFUT_H__ + +#include + +#include +#include +#include +#include +#include +#include + +#define YAFFUT_STRINGIZE(x) YAFFUT_STRINGIZE_(x) +#define YAFFUT_STRINGIZE_(x) #x + +#define __YAFFUT_AT__ __FILE__ ":" YAFFUT_STRINGIZE(__LINE__)": " +#ifndef __AT__ +#define __AT__ __YAFFUT_AT__ +#endif + +#define YAFFUT_EQUAL(e,a) \ + yaffut::equal (e ,a , __YAFFUT_AT__, "EQUAL(" #e " == " #a ") failed ") +#ifndef EQUAL +#define EQUAL YAFFUT_EQUAL +#endif + +#define YAFFUT_UNEQUAL(e,a) \ + yaffut::unequal (e, a, __YAFFUT_AT__, "UNEQUAL(" #e " != " #a ") failed ") +#ifndef UNEQUAL +#define UNEQUAL YAFFUT_UNEQUAL +#endif + +#define YAFFUT_CHECK(e) \ + yaffut::check (e, __YAFFUT_AT__, "CHECK(" #e ") failed ") +#ifndef CHECK +#define CHECK YAFFUT_CHECK +#endif + +#define YAFFUT_FAIL(s) yaffut::fail (s, __YAFFUT_AT__); +#ifndef FAIL +#define FAIL YAFFUT_FAIL +#endif + +#define YAFFUT_ASSERT_THROW(s, e) \ + try \ + { \ + s; \ + throw yaffut::failure (__YAFFUT_AT__, #s " failed to throw"); \ + } \ + catch(const e&){} +#ifndef ASSERT_THROW +#define ASSERT_THROW YAFFUT_ASSERT_THROW +#endif + +namespace yaffut { + +template +std::string demangle() +{ + size_t sz; + int status; + char* ptr = abi::__cxa_demangle(typeid(T).name(), 0, &sz, &status); + std::string name(ptr ? ptr : "", ptr ? strlen(ptr) : 0); + if(ptr){ free(ptr); } + std::string::size_type pos = name.rfind("::"); + if(pos != std::string::npos) + { + name = name.substr(pos + 2); + } + return name; +} + +struct ITest +{ + virtual ~ITest(){} +}; + +class Factory +{ +public: + typedef ITest* (*Create_t) (); +private: + typedef std::map Tests_t; + Tests_t m_Tests; + size_t m_fail; + size_t m_pass; +private: + Factory(){} + ~Factory(){} + static bool EqualsSuiteName (std::string const &name, std::string const& s) + { + return name.find (':') >= name.length () - 2 + && s.substr (0, name.length ()) == name; + } +public: + static Factory& Instance() + { + static Factory instance; + return instance; + } + void Register(const std::string& name, Create_t create) + { + m_Tests[name] = create; + } + size_t Fail () { return m_fail; } + void List(const std::string& name) + { + for(Tests_t::const_iterator it = m_Tests.begin(); it != m_Tests.end(); ++it) + { + if(name.empty () || it->first == name + || EqualsSuiteName (name, it->first)) + std::cout << it->first << std::endl; + } + } + void Run(const std::string& name) + { + for(Tests_t::const_iterator it = m_Tests.begin(); it != m_Tests.end(); ++it) + { + if("All" == name || it->first == name + || EqualsSuiteName (name, it->first)) + { + try + { + std::cout << std::endl << it->first << ' ' << std::flush; + { + std::auto_ptr test(it->second()); + } + std::cout << "[OK]" << std::flush; + ++m_pass; + } + catch(const std::exception& e) + { + std::cout << "[FAIL]\n" << e.what() << std::flush; + ++m_fail; + } + catch(...) + { + std::cout << "[FAIL]\nunknown exception" << std::flush; + ++m_fail; + } + } + } + } + void Report () + { + const size_t size = m_Tests.size(); + std::cout << std::endl; + std::cout << "[TOTAL](" << m_pass + m_fail << '/' << size << ")" << std::endl; + std::cout << "[OK](" << m_pass << '/' << size << ")" << std::endl; + if (m_fail) + std::cout << "[FAIL](" << m_fail << '/' << size << ")" << std::endl; + } + int Main (int argc, const char* argv[]) + { + if(argc > 1 + && (std::string(argv[1]) == "-h" || std::string(argv[1]) == "--help")) + { + std::cout << "Yaffut - Yet Another Framework For Unit Testing.\n\n" + "Usage: yaffut [OPTION] [Suite:|Suite::Test]...\n\n" + "Options:\n" + " -h, --help show this help\n" + " -l, --list list test cases" << std::endl; + return 0; + } + if(argc > 1 + && (std::string(argv[1]) == "-l" || std::string(argv[1]) == "--list")) + { + Factory::Instance().List(argc > 2 ? argv[2] : ""); + return 0; + } + + const char* all[] = {"All"}; + const char** test = all; + int num = 1; + if(1 < argc) + { + test = argv; + num = argc; + } + + for(int i = 0; i < num; ++i) + { + try + { + Factory::Instance().Run(test[i]); + } + catch(const std::exception& e) + { + std::clog << e.what() << std::endl; + } + } + + Factory::Instance().Report (); + return Factory::Instance().Fail (); + } +}; + +class failure: public std::exception +{ + std::string failure_; +public: + template + failure(const Expected& e, Actual& a, const char* at = "", const char* expr = "") + { + std::ostringstream os; + os << at << expr << "\nexpected: " + << "(" << demangle() << ") " << e + << " != actual: " << "(" << demangle() << ") " << a; + failure_ = os.str(); + } + failure(const char* at = "", const char* expr = "") + { + std::ostringstream os; + os << at << expr; + failure_ = os.str(); + } + virtual ~failure() throw() {} + virtual const char* what() const throw() { return failure_.c_str(); } +}; + +template +struct Registrator +{ + Registrator() + { + Factory::Instance().Register(TestName(), Create); + } + const std::string& TestName() + { + static const std::string name(demangle() + "::" + demangle()); + return name; + } + static ITest* Create() + { + return new Case; + } +}; + +template +struct Test: public ITest, public Suite +{ + static Registrator s_Registrator; + Test() + : Suite() + { + Registrator* r = &s_Registrator; + r = 0; + } + template + void assert_throw(void(T::*mf)(), const char* at) + { + try + { + (dynamic_cast (this)->*mf)(); + throw yaffut::failure (at, "statement failed to throw"); + } + catch(const E&){} + } +}; + +template +Registrator Test::s_Registrator; + +template +void equal(const Expected& e, const Actual& a, const char* at = "", const char* expr = "") +{ + if(e != a) + { + throw failure(e, a, at, expr); + } +} +inline void equal(double e, double a, const char* at = "", const char* expr = "") +{ + double max = std::abs(std::max(e, a)); + max = max < 1.0 ? 1.0 : max; + if(std::abs(e - a) > std::numeric_limits::epsilon() * max) + { + throw failure(e, a, at, expr); + } +} +inline void check(bool b, const char* at = "", const char* expr = "") +{ + if(!b) + { + throw failure(at, expr); + } +} + +template +void unequal(const Expected& e, const Actual& a, const char* at = "", const char* expr = "") +{ + if(e == a) + { + throw failure(e, a, at, expr); + } +} +inline void unequal(double e, double a, const char* at = "", const char* expr = "") +{ + double max = std::abs(std::max(e, a)); + max = max < 1.0 ? 1.0 : max; + if(std::abs(e - a) <= std::numeric_limits::epsilon() * max) + { + throw failure(e, a, at, expr); + } +} + +template +void fail(const T& expr, const char* at = "") +{ + std::ostringstream os; + os << expr; + throw failure(at, os.str().c_str()); +} + +template +void assert_throw(void(*pf)(), const char* at = "") +{ + try + { + (*pf)(); + throw failure (at, " statement failed to throw"); + } + catch(const E&){} +} + +//define catch-all suite +struct Suite {}; + +} + +//and for those who prefer macro obscurity over more typing +#define TEST(Suite, Case)\ + namespace { struct Case: public yaffut::Test{ Case(); }; } \ + template struct yaffut::Test; Case::Case() + +#define FUNC(Case)\ + namespace { struct Case: public yaffut::Test{ Case(); }; } \ + template struct yaffut::Test; Case::Case() + +#ifdef YAFFUT_MAIN + +#include + +int main(int argc, const char* argv[]) +{ + std::cout << "pid(" << getpid() << ")" << std::endl; + return yaffut::Factory::Instance().Main (argc, argv); +}; + +#endif /* YAFFUT_MAIN */ + +#define yaffut_main(argc, argv) yaffut::Factory::Instance().Main (argc, argv) + +#endif diff --git a/flower/test-file-name.cc b/flower/test-file-name.cc new file mode 100644 index 0000000000..0bd427bda8 --- /dev/null +++ b/flower/test-file-name.cc @@ -0,0 +1,31 @@ +#include "file-name.hh" + +#include "yaffut-parameters.hh" + +using namespace std; + +string slashify (string file_name); + +TEST_STRING (File_name, Mingw_slashify, "foe.ly") +{ + string s = slashify (to_string ()); + EQUAL (parameter_one_, s); +} + +TEST_STRING (File_name, Mingw_slashify_2, "/tmp/x.ly") +{ + string s = slashify (to_string ()); + EQUAL (parameter_one_, s); +} + +TEST_STRING (File_name, Mingw_slashify_3, "c:/tmp/x.ly") +{ + string s = slashify (to_string ()); + EQUAL (parameter_one_, s); +} + +TEST_STRING (File_name, Mingw_slashify_4, "\\tmp\\x.ly") +{ + string s = slashify (to_string ()); + EQUAL ("/tmp/x.ly", s); +} diff --git a/flower/test-file-path.cc b/flower/test-file-path.cc new file mode 100644 index 0000000000..053d237b66 --- /dev/null +++ b/flower/test-file-path.cc @@ -0,0 +1,19 @@ +#include "file-path.hh" + +#include "yaffut.hh" +#include "config.hh" + +TEST (File_path, Find) +{ + char const *extensions[] = {"ly", "", 0}; + string file = "init"; + char cwd[PATH_MAX]; + getcwd (cwd, PATH_MAX); + string ly_dir = string (getenv ("top-src-dir")) + "/ly"; + parse_path (string (1, PATHSEP) + ly_dir); + string file_name = find (file, extensions); + EQUAL (file_name.substr (file_name.rfind ('/')), "/init.ly"); + file = "init.ly"; + file_name = find (file, extensions); + EQUAL (file_name, ly_dir + "/init.ly"); +} diff --git a/flower/test-file.cc b/flower/test-file.cc deleted file mode 100644 index 177676f791..0000000000 --- a/flower/test-file.cc +++ /dev/null @@ -1,61 +0,0 @@ -#define HAVE_BOOST_LAMBDA 1 -#include "std-vector.hh" - -#include -#include - -#include -#include - -using namespace std; -using boost::unit_test::test_suite; - -#include "file-name.hh" -string slashify (string file_name); - -// FIXME -//BOOST_AUTO_UNIT_TEST (mingw_slashify) -void mingw_slashify () -{ - File_name f = string ("foe.ly"); - string s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "foe.ly"); - f = string ("/tmp/x.ly"); - s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); - f = string ("c:/tmp/x.ly"); - s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "c:/tmp/x.ly"); - f = string ("\\tmp\\x.ly"); - s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); -} - -#include "config.hh" -#include "file-path.hh" - -// FIXME -//BOOST_AUTO_UNIT_TEST (mingw_slashify) -void file_find () -{ - char const *extensions[] = {"ly", "", 0}; - string file = "init"; - File_path path; - char cwd[PATH_MAX]; - getcwd (cwd, PATH_MAX); - string ly_dir = string (getenv ("top-src-dir")) + "/ly"; - cout << ly_dir << endl; - path.parse_path (string (1, PATHSEP) + ly_dir); - string file_name = path.find (file, extensions); - cout << file_name << endl; - BOOST_CHECK_EQUAL (file_name.substr (file_name.rfind ('/')), "/init.ly"); - file = "init.ly"; - file_name = path.find (file, extensions); - cout << file_name << endl; - BOOST_CHECK_EQUAL (file_name, ly_dir + "/init.ly"); - -} diff --git a/flower/test-std.cc b/flower/test-std.cc index ed317f7f63..1c1a71fa3a 100644 --- a/flower/test-std.cc +++ b/flower/test-std.cc @@ -9,16 +9,14 @@ #include -#include -#include +#define YAFFUT_MAIN +#include "yaffut.hh" #if !STD_VECTOR #define vector flower_vector #endif using namespace std; -using boost::unit_test::test_suite; -using namespace boost::unit_test; template void @@ -40,24 +38,24 @@ print (Link_array v) } #endif -BOOST_AUTO_UNIT_TEST (vector_erase) +FUNC (vector_erase) { vector v; v.push_back (0); v.push_back (1); - BOOST_CHECK_EQUAL (v.size (), vsize (2)); + EQUAL (v.size (), vsize (2)); v.erase (v.begin () + 1); - BOOST_CHECK_EQUAL (v.size (), vsize (1)); - BOOST_CHECK_EQUAL (v.back (), 0); + EQUAL (v.size (), vsize (1)); + EQUAL (v.back (), 0); v.push_back (1); - BOOST_CHECK_EQUAL (v.size (), vsize (2)); + EQUAL (v.size (), vsize (2)); v.erase (v.begin () + 0); - BOOST_CHECK_EQUAL (v.size (), vsize (1)); - BOOST_CHECK_EQUAL (v.back (), 1); + EQUAL (v.size (), vsize (1)); + EQUAL (v.back (), 1); } -BOOST_AUTO_UNIT_TEST (vector_slice) +FUNC (vector_slice) { vector v; v.push_back (0); @@ -65,18 +63,18 @@ BOOST_AUTO_UNIT_TEST (vector_slice) v.push_back (2); v.push_back (3); #if VECTOR_SLICE - BOOST_CHECK_EQUAL (v.slice (0, 0).size (), vsize (0)); - BOOST_CHECK_EQUAL (v.slice (0, v.size ()).size (), v.size ()); - BOOST_CHECK_EQUAL (v.slice (1, 2).size (), vsize (1)); + EQUAL (v.slice (0, 0).size (), vsize (0)); + EQUAL (v.slice (0, v.size ()).size (), v.size ()); + EQUAL (v.slice (1, 2).size (), vsize (1)); #else - BOOST_CHECK_EQUAL (vector (v.begin (), v.begin ()).size (), vsize (0)); - BOOST_CHECK_EQUAL (vector (v.begin (), v.end ()).size (), v.size ()); - BOOST_CHECK_EQUAL (vector (v.begin () + 1, v.begin () + 2).size (), + EQUAL (vector (v.begin (), v.begin ()).size (), vsize (0)); + EQUAL (vector (v.begin (), v.end ()).size (), v.size ()); + EQUAL (vector (v.begin () + 1, v.begin () + 2).size (), vsize (1)); #endif } -BOOST_AUTO_UNIT_TEST (vector_sorting) +FUNC (vector_sorting) { vector v; v.push_back (2); @@ -88,12 +86,12 @@ BOOST_AUTO_UNIT_TEST (vector_sorting) //sort (v.begin (), v.end ()); vector_sort (v, less ()); #endif - BOOST_CHECK_EQUAL (v[0], 0); - BOOST_CHECK_EQUAL (v[1], 1); - BOOST_CHECK_EQUAL (v[2], 2); + EQUAL (v[0], 0); + EQUAL (v[1], 1); + EQUAL (v[2], 2); } -BOOST_AUTO_UNIT_TEST (vector_insert) +FUNC (vector_insert) { vector v; v.push_back (0); @@ -102,23 +100,23 @@ BOOST_AUTO_UNIT_TEST (vector_insert) #else v.insert (v.begin (), 1); #endif - BOOST_CHECK_EQUAL (v[0], 1); + EQUAL (v[0], 1); #if VECTOR_INSERT v.insert (2, v.size ()); #else v.insert (v.end (), 2); #endif - BOOST_CHECK_EQUAL (v.back (), 2); + EQUAL (v.back (), 2); vector u; u.insert (u.begin (), v.begin (), v.end ()); - BOOST_CHECK_EQUAL (u.size (), v.size ()); + EQUAL (u.size (), v.size ()); u.clear (); u.insert (u.end (), v.begin (), v.end ()); - BOOST_CHECK_EQUAL (u.size (), v.size ()); + EQUAL (u.size (), v.size ()); u.clear (); } -BOOST_AUTO_UNIT_TEST (parray_concat) +FUNC (parray_concat) { #if !STD_VECTOR Link_array u, v; @@ -132,14 +130,14 @@ BOOST_AUTO_UNIT_TEST (parray_concat) v.push_back (&a[3]); v.push_back (&a[4]); concat (u, v); - BOOST_CHECK_EQUAL (u[0], &a[0]); - BOOST_CHECK_EQUAL (u[1], &a[1]); - BOOST_CHECK_EQUAL (u[2], &a[2]); - BOOST_CHECK_EQUAL (u[3], &a[3]); - BOOST_CHECK_EQUAL (u[4], &a[4]); - BOOST_CHECK_EQUAL (u.size (), vsize (5)); + EQUAL (u[0], &a[0]); + EQUAL (u[1], &a[1]); + EQUAL (u[2], &a[2]); + EQUAL (u[3], &a[3]); + EQUAL (u[4], &a[4]); + EQUAL (u.size (), vsize (5)); concat (u, v); - BOOST_CHECK_EQUAL (u.size (), vsize (7)); + EQUAL (u.size (), vsize (7)); u.clear (); v.clear (); @@ -149,15 +147,15 @@ BOOST_AUTO_UNIT_TEST (parray_concat) v.push_back (&a[3]); v.push_back (&a[4]); concat (u, v); - BOOST_CHECK_EQUAL (u[0], &a[0]); - BOOST_CHECK_EQUAL (u[1], &a[1]); - BOOST_CHECK_EQUAL (u[2], &a[2]); - BOOST_CHECK_EQUAL (u[3], &a[3]); - BOOST_CHECK_EQUAL (u[4], &a[4]); - BOOST_CHECK_EQUAL (u.size (), vsize (5)); + EQUAL (u[0], &a[0]); + EQUAL (u[1], &a[1]); + EQUAL (u[2], &a[2]); + EQUAL (u[3], &a[3]); + EQUAL (u[4], &a[4]); + EQUAL (u.size (), vsize (5)); } -BOOST_AUTO_UNIT_TEST (parray_uniq) +FUNC (parray_uniq) { vector v; v.push_back (0); @@ -165,76 +163,15 @@ BOOST_AUTO_UNIT_TEST (parray_uniq) v.push_back (0); vector_sort (v, less ()); uniq (v); - BOOST_CHECK_EQUAL (v.size (), vsize (2)); + EQUAL (v.size (), vsize (2)); } -BOOST_AUTO_UNIT_TEST (vector_search) +FUNC (vector_search) { vector v; v.push_back (0); v.push_back (1); v.push_back (2); vsize i = binary_search (v, 1, less ()); - BOOST_CHECK_EQUAL (i, vsize (1)); -} - -#if 0 -#include "file-name.hh" -string slashify (string file_name); - -BOOST_AUTO_UNIT_TEST (mingw_slashify) -{ - File_name f = string ("foe.ly"); - string s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "foe.ly"); - f = string ("/tmp/x.ly"); - s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); - f = string ("c:/tmp/x.ly"); - s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "c:/tmp/x.ly"); - f = string ("\\tmp\\x.ly"); - s = slashify (f.to_string ()); - cout << s << endl; - BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); -} -#endif - -void mingw_slashify (); -void file_find (); - -#include -#include -#include - -test_suite* -init_unit_test_suite (int, char**) -{ - vsize i = 0; - vsize j = 0; - vector v; - binary_search (v, 1, less (), i, j); - //binary_search_bounds (v, 1, &default_compare, 0, 0); - - //Link_array w; - vector w; - binary_search (w, (char*)1, less (), i, j); - - test_suite *test = BOOST_TEST_SUITE("Flower"); - - - test->add (BOOST_TEST_CASE (vector_erase)); - test->add (BOOST_TEST_CASE (vector_slice)); - test->add (BOOST_TEST_CASE (vector_sorting)); - test->add (BOOST_TEST_CASE (vector_insert)); - test->add (BOOST_TEST_CASE (parray_concat)); - test->add (BOOST_TEST_CASE (parray_uniq)); - test->add (BOOST_TEST_CASE (vector_search)); - test->add (BOOST_TEST_CASE (mingw_slashify)); - test->add (BOOST_TEST_CASE (file_find)); - - return test; + EQUAL (i, vsize (1)); } diff --git a/input/regression/accidental-ancient.ly b/input/regression/accidental-ancient.ly new file mode 100644 index 0000000000..879f81c2b6 --- /dev/null +++ b/input/regression/accidental-ancient.ly @@ -0,0 +1,26 @@ + +\header { +texidoc = "@cindex Ancient Accidentals +Accidentals are available in different ancient styles, which all +are collected here. +" +} + +\version "2.11.6" + +\relative c'' { + \time 3/4 + cis^\markup { \typewriter default } c ces + + \override Staff.Accidental #'glyph-name-alist = #alteration-hufnagel-glyph-name-alist + cis^\markup { \typewriter hufnagel } c ces + + \override Staff.Accidental #'glyph-name-alist = #alteration-medicaea-glyph-name-alist + cis^\markup { \typewriter medicaea } c ces + + \override Staff.Accidental #'glyph-name-alist = #alteration-vaticana-glyph-name-alist + cis^\markup { \typewriter vaticana } c ces + + \override Staff.Accidental #'glyph-name-alist = #alteration-mensural-glyph-name-alist + cis^\markup { \typewriter mensural } c ces +} diff --git a/input/regression/key-clefs.ly b/input/regression/key-clefs.ly index 000f090827..8d68529ea1 100644 --- a/input/regression/key-clefs.ly +++ b/input/regression/key-clefs.ly @@ -11,13 +11,13 @@ \clef violin \key cis \major cis1 \key ces \major ces \clef soprano - \key cis \major cis \key ces \major ces + \key cis \major cis \key ces \major ces \break \clef mezzosoprano \key cis \major cis \key ces \major ces \clef alto - \key cis \major cis \key ces \major ces + \key cis \major cis \break \key ces \major ces \clef tenor - \key cis \major cis \key ces \major ces + \key cis \major cis \key ces \major ces \break \clef baritone \key cis \major cis \key ces \major ces \clef bass diff --git a/input/regression/markup-scheme.ly b/input/regression/markup-scheme.ly index e82b4b0ba3..af1b4f9121 100644 --- a/input/regression/markup-scheme.ly +++ b/input/regression/markup-scheme.ly @@ -25,7 +25,7 @@ For maintenance reasons, we don't excercise the entire markup command set. -\version "2.10.0" +\version "2.11.5" { \fatText @@ -39,7 +39,7 @@ For maintenance reasons, we don't excercise the entire markup command set. \override #'(font-encoding . fetaMusic) { \lookup #"noteheads-0" } - \musicglyph #"accidentals.-1" + \musicglyph #"accidentals.mirroredflat" \combine "X" "+" \combine "o" "/" \box \column { \line { "string 1" } \line { "string 2" } } @@ -62,7 +62,7 @@ For maintenance reasons, we don't excercise the entire markup command set. #:hspace 2.0 #:override '(font-encoding . fetaMusic) #:line (#:lookup "noteheads-0" ) - #:musicglyph "accidentals.-1" + #:musicglyph "accidentals.mirroredflat" #:combine "X" "+" #:combine "o" "/" #:box #:column ("string 1" "string 2") diff --git a/input/regression/spacing-folded-clef-cross-staff.ly b/input/regression/spacing-folded-clef-cross-staff.ly new file mode 100644 index 0000000000..8616fd811d --- /dev/null +++ b/input/regression/spacing-folded-clef-cross-staff.ly @@ -0,0 +1,22 @@ +\version "2.10.7" +\header { + texidoc = "Clefs are also folded under cross staff constructs." +} + +\layout { ragged-right = ##t} + +\context PianoStaff << + \new Staff = "up" + \relative c'' << + { + \stemDown + f16[ \change Staff = down \stemUp + \clef treble g,] + + } \\ + >> + \new Staff = "down" { + \time 3/8 \clef bass s8 + } +>> + diff --git a/input/regression/spacing-loose-grace-linebreak.ly b/input/regression/spacing-loose-grace-linebreak.ly new file mode 100644 index 0000000000..e9fab41136 --- /dev/null +++ b/input/regression/spacing-loose-grace-linebreak.ly @@ -0,0 +1,39 @@ +\header{ + texidoc = "If a floating grace spacing section attaches to a note +across a line break, it gets attached to the end of line." +} + + +\version "2.10.7" + +\new Score \with { + \override SpacingSpanner #'strict-grace-spacing = ##t + \override PaperColumn #'used = ##t +} << + + \new Staff << + + \new Voice { + \time 6/4 s2 + s2 \bar "" \break + s2 + } + + \new Voice { + b'4 + \afterGrace c''4 {b'16} + s4 + s4 + c''4 + } + \new Voice { + c'4 + c'8. + r16 + c'4 + c'4 + c'4 + } + >> +>> + diff --git a/input/test/ancient-accidentals.ly b/input/test/ancient-accidentals.ly deleted file mode 100644 index 10c5ab79be..0000000000 --- a/input/test/ancient-accidentals.ly +++ /dev/null @@ -1,23 +0,0 @@ - -\header { -texidoc = "@cindex Ancient Accidentals -Accidentals are available in different ancient styles, which all -are collected here. -" -} - -\version "2.10.0" - -\relative c'' { - \time 5/4 - \override Staff.Accidental #'style = #'default - cisis^\markup { \typewriter default } cis c ces ceses - \override Staff.Accidental #'style = #'hufnagel - cisis^\markup { \typewriter hufnagel } cis c ces ceses - \override Staff.Accidental #'style = #'medicaea - cisis^\markup { \typewriter medicaea } cis c ces ceses - \override Staff.Accidental #'style = #'vaticana - cisis^\markup { \typewriter vaticana } cis c ces ceses - \override Staff.Accidental #'style = #'mensural - cisis^\markup { \typewriter mensural } cis c ces ceses -} diff --git a/input/test/ancient-font.ly b/input/test/ancient-font.ly index baaf9eb93c..6ac4481693 100644 --- a/input/test/ancient-font.ly +++ b/input/test/ancient-font.ly @@ -1,4 +1,4 @@ -\version "2.10.0" +\version "2.11.6" % TODO: split ancient-font into seperate files; possibly in % different locations. \header { @@ -17,8 +17,8 @@ upperStaff = \new GregorianStaff = "upperStaff" << \override Staff.StaffSymbol #'line-count = #4 \transpose c c { - \override Staff.KeySignature #'style = #'vaticana - \override Staff.Accidental #'style = #'vaticana + \override Staff.KeySignature #'glyph-name-alist = #alteration-vaticana-glyph-name-alist + \override Staff.Accidental #'glyph-name-alist = #alteration-vaticana-glyph-name-alist \override NoteHead #'style = #'vaticana.punctum \key es \major \clef "vaticana-fa2" @@ -58,8 +58,8 @@ upperStaff = \new GregorianStaff = "upperStaff" << \override NoteHead #'style = #'vaticana.cephalicus es f - \override Staff.KeySignature #'style = #'medicaea - \override Staff.Accidental #'style = #'medicaea + \override Staff.KeySignature #'glyph-name-alist = #alteration-medicaea-glyph-name-alist + \override Staff.Accidental #'glyph-name-alist = #alteration-medicaea-glyph-name-alist \override Staff.Custos #'style = #'medicaea \override NoteHead #'style = #'medicaea.punctum \clef "medicaea-fa2" @@ -81,8 +81,8 @@ upperStaff = \new GregorianStaff = "upperStaff" << \override NoteHead #'style = #'medicaea.rvirga e! des! ces! - \override Staff.KeySignature #'style = #'hufnagel - \override Staff.Accidental #'style = #'hufnagel + \override Staff.KeySignature #'glyph-name-alist = #alteration-hufnagel-glyph-name-alist + \override Staff.Accidental #'glyph-name-alist = #alteration-hufnagel-glyph-name-alist \override Staff.Custos #'style = #'hufnagel \override NoteHead #'style = #'hufnagel.punctum \clef "hufnagel-fa2" @@ -258,8 +258,8 @@ lowerStaff = \new MensuralStaff = "lowerStaff" << \accepts MensuralVoice \consists Custos_engraver \override TimeSignature #'style = #'mensural - \override KeySignature #'style = #'mensural - \override Accidental #'style = #'mensural + \override KeySignature #'glyph-name-alist = #alteration-mensural-glyph-name-alist + \override Accidental #'glyph-name-alist = #alteration-mensural-glyph-name-alist \override Custos #'style = #'mensural \override Custos #'neutral-position = #3 \override Custos #'neutral-direction = #down @@ -276,8 +276,8 @@ lowerStaff = \new MensuralStaff = "lowerStaff" << \remove Time_signature_engraver \override StaffSymbol #'thickness = #2.0 \override StaffSymbol #'line-count = #4 - \override KeySignature #'style = #'vaticana - \override Accidental #'style = #'vaticana + \override KeySignature #'glyph-name-alist = #alteration-vaticana-glyph-name-alist + \override Accidental #'glyph-name-alist = #alteration-vaticana-glyph-name-alist \override Custos #'style = #'vaticana \override Custos #'neutral-position = #4 \override Custos #'neutral-direction = #down diff --git a/input/test/makam.ly b/input/test/makam.ly new file mode 100644 index 0000000000..53dd69cc1a --- /dev/null +++ b/input/test/makam.ly @@ -0,0 +1,153 @@ +\header { + + texidoc = "Makam is Turkish type of melody that uses 1/9 tone + microtonal alterations." + +} + + +\version "2.11.6" + +%{ + +Define 1/9 alterations. + +%} + + +#(define-public KOMA 1/9) +#(define-public BAKIYE 4/9) +#(define-public KUCUK 5/9) +#(define-public BUYUKMUCENNEB 8/9) + +%{ + +Define pitch names + +%} + +makamPitchNames = #`( + (c . ,(ly:make-pitch -1 0 NATURAL)) + (d . ,(ly:make-pitch -1 1 NATURAL)) + (e . ,(ly:make-pitch -1 2 NATURAL)) + (f . ,(ly:make-pitch -1 3 NATURAL)) + (g . ,(ly:make-pitch -1 4 NATURAL)) + (a . ,(ly:make-pitch -1 5 NATURAL)) + (b . ,(ly:make-pitch -1 6 NATURAL)) + + (cc . ,(ly:make-pitch -1 0 KOMA)) + (dc . ,(ly:make-pitch -1 1 KOMA)) + (ec . ,(ly:make-pitch -1 2 KOMA)) + (fc . ,(ly:make-pitch -1 3 KOMA)) + (gc . ,(ly:make-pitch -1 4 KOMA)) + (ac . ,(ly:make-pitch -1 5 KOMA)) + (bc . ,(ly:make-pitch -1 6 KOMA)) + + (cb . ,(ly:make-pitch -1 0 BAKIYE)) + (db . ,(ly:make-pitch -1 1 BAKIYE)) + (eb . ,(ly:make-pitch -1 2 BAKIYE)) + (fb . ,(ly:make-pitch -1 3 BAKIYE)) + (gb . ,(ly:make-pitch -1 4 BAKIYE)) + (ab . ,(ly:make-pitch -1 5 BAKIYE)) + (bb . ,(ly:make-pitch -1 6 BAKIYE)) + + (ck . ,(ly:make-pitch -1 0 KUCUK)) + (dk . ,(ly:make-pitch -1 1 KUCUK)) + (ek . ,(ly:make-pitch -1 2 KUCUK)) + (fk . ,(ly:make-pitch -1 3 KUCUK)) + (gk . ,(ly:make-pitch -1 4 KUCUK)) + (ak . ,(ly:make-pitch -1 5 KUCUK)) + (bk . ,(ly:make-pitch -1 6 KUCUK)) + + (cbm . ,(ly:make-pitch -1 0 BUYUKMUCENNEB)) + (dbm . ,(ly:make-pitch -1 1 BUYUKMUCENNEB)) + (ebm . ,(ly:make-pitch -1 2 BUYUKMUCENNEB)) + (fbm . ,(ly:make-pitch -1 3 BUYUKMUCENNEB)) + (gbm . ,(ly:make-pitch -1 4 BUYUKMUCENNEB)) + (abm . ,(ly:make-pitch -1 5 BUYUKMUCENNEB)) + (bbm . ,(ly:make-pitch -1 6 BUYUKMUCENNEB)) + + ;; f for flat. + (cfc . ,(ly:make-pitch -1 0 (- KOMA))) + (dfc . ,(ly:make-pitch -1 1 (- KOMA))) + (efc . ,(ly:make-pitch -1 2 (- KOMA))) + (ffc . ,(ly:make-pitch -1 3 (- KOMA))) + (gfc . ,(ly:make-pitch -1 4 (- KOMA))) + (afc . ,(ly:make-pitch -1 5 (- KOMA))) + (bfc . ,(ly:make-pitch -1 6 (- KOMA))) + + (cfb . ,(ly:make-pitch -1 0 (- BAKIYE))) + (dfb . ,(ly:make-pitch -1 1 (- BAKIYE))) + (efb . ,(ly:make-pitch -1 2 (- BAKIYE))) + (ffb . ,(ly:make-pitch -1 3 (- BAKIYE))) + (gfb . ,(ly:make-pitch -1 4 (- BAKIYE))) + (afb . ,(ly:make-pitch -1 5 (- BAKIYE))) + (bfb . ,(ly:make-pitch -1 6 (- BAKIYE))) + + (cfk . ,(ly:make-pitch -1 0 (- KUCUK))) + (dfk . ,(ly:make-pitch -1 1 (- KUCUK))) + (efk . ,(ly:make-pitch -1 2 (- KUCUK))) + (ffk . ,(ly:make-pitch -1 3 (- KUCUK))) + (gfk . ,(ly:make-pitch -1 4 (- KUCUK))) + (afk . ,(ly:make-pitch -1 5 (- KUCUK))) + (bfk . ,(ly:make-pitch -1 6 (- KUCUK))) + + (cfbm . ,(ly:make-pitch -1 0 (- BUYUKMUCENNEB))) + (dfbm . ,(ly:make-pitch -1 1 (- BUYUKMUCENNEB))) + (efbm . ,(ly:make-pitch -1 2 (- BUYUKMUCENNEB))) + (ffbm . ,(ly:make-pitch -1 3 (- BUYUKMUCENNEB))) + (gfbm . ,(ly:make-pitch -1 4 (- BUYUKMUCENNEB))) + (afbm . ,(ly:make-pitch -1 5 (- BUYUKMUCENNEB))) + (bfbm . ,(ly:make-pitch -1 6 (- BUYUKMUCENNEB))) + +) + + +%% set pitch names. +pitchnames = \makamPitchNames +#(ly:parser-set-note-names parser makamPitchNames) + +\paper +{ + ragged-right = ##t +} + +\relative { + + %{ define alteration <-> symbol mapping. The following glyphs are available. + + accidentals.sharp + accidentals.sharp.slashslash.stem + accidentals.sharp.slashslashslash.stemstem + accidentals.sharp.slashslashslash.stem + accidentals.sharp.slashslash.stemstemstem + accidentals.natural + accidentals.flat + accidentals.flat.slash + accidentals.flat.slashslash + accidentals.mirroredflat.flat + accidentals.mirroredflat + accidentals.flatflat + accidentals.flatflat.slash + accidentals.doublesharp + + %} + + + \override Accidental #'glyph-name-alist = #'((1 . "accidentals.doublesharp") + (8/9 . "accidentals.sharp.slashslashslash.stemstem") + (5/9 . "accidentals.sharp.slashslashslash.stem") + (4/9 . "accidentals.sharp") + (1/9 . "accidentals.sharp.slashslash.stem") + (0 . "accidentals.natural") + (-1/9 . "accidentals.mirroredflat") + (-4/9 . "accidentals.flat.slash") + (-5/9 . "accidentals.flat") + (-8/9 . "accidentals.flat.slashslash") + (-1 . "accidentals.flatflat") + ) + + + + c cc db fk gbm gfc gfb efk dfbm +} diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 502aeaea9f..bbb217d73c 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -368,8 +368,6 @@ Accidental_engraver::create_accidental (Accidental_entry *entry, { Stream_event *note = entry->melodic_; Grob *support = entry->head_; - Pitch *pitch = unsmob_pitch (note->get_property ("pitch")); - bool as_suggestion = to_boolean (entry->origin_->get_property ("suggestAccidentals")); Grob *a = 0; if (as_suggestion) @@ -383,7 +381,6 @@ Accidental_engraver::create_accidental (Accidental_entry *entry, a->set_property ("restore-first", SCM_BOOL_T); } - a->set_property ("alteration", scm_from_int (pitch->get_alteration () * Rational (4))); entry->accidental_ = a; } @@ -596,8 +593,8 @@ ADD_TRANSLATOR (Accidental_engraver, /* grobs */ "Accidental " - "AccidentalCautionary" - "AccidentalSuggestion", + "AccidentalCautionary " + "AccidentalSuggestion ", /* props */ "autoAccidentals " diff --git a/lily/accidental.cc b/lily/accidental.cc index f6672e815b..a54a87efbc 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -65,53 +65,48 @@ Accidental_interface::accurate_boxes (Grob *me, Grob **common) && !to_boolean (me->get_property ("restore-first")) && !parens) { - int acc = scm_to_int (me->get_property ("alteration")); - switch (acc) + Rational alteration = ly_scm2rational (me->get_property ("alteration")); + if (alteration == FLAT_ALTERATION) { - case FLAT: - { - Box stem = b; - Box bulb = b; + Box stem = b; + Box bulb = b; - /* - we could make the stem thinner, but that places the flats - really close. - */ - stem[X_AXIS][RIGHT] *= .5; - - /* - To prevent vertical alignment for 6ths - */ - stem[Y_AXIS] *= 1.1; - bulb[Y_AXIS][UP] *= .35; - - boxes.push_back (bulb); - boxes.push_back (stem); - } - break; - case NATURAL: - { - Box lstem = b; - Box rstem = b; - Box belly = b; - - lstem[Y_AXIS] *= 1.1; - rstem[Y_AXIS] *= 1.1; + /* + we could make the stem thinner, but that places the flats + really close. + */ + stem[X_AXIS][RIGHT] *= .5; - belly[Y_AXIS] *= 0.75; - lstem[X_AXIS][RIGHT] *= .33; - rstem[X_AXIS][LEFT] = rstem[X_AXIS].linear_combination (1.0 / 3.0); - lstem[Y_AXIS][DOWN] = belly[Y_AXIS][DOWN]; - rstem[Y_AXIS][UP] = belly[Y_AXIS][UP]; - boxes.push_back (belly); - boxes.push_back (lstem); - boxes.push_back (rstem); - } - break; /* - TODO: add support for, double flat. + To prevent vertical alignment for 6ths */ + stem[Y_AXIS] *= 1.1; + bulb[Y_AXIS][UP] *= .35; + + boxes.push_back (bulb); + boxes.push_back (stem); + } + else if (alteration == NATURAL_ALTERATION) + { + Box lstem = b; + Box rstem = b; + Box belly = b; + + lstem[Y_AXIS] *= 1.1; + rstem[Y_AXIS] *= 1.1; + + belly[Y_AXIS] *= 0.75; + lstem[X_AXIS][RIGHT] *= .33; + rstem[X_AXIS][LEFT] = rstem[X_AXIS].linear_combination (1.0 / 3.0); + lstem[Y_AXIS][DOWN] = belly[Y_AXIS][DOWN]; + rstem[Y_AXIS][UP] = belly[Y_AXIS][UP]; + boxes.push_back (belly); + boxes.push_back (lstem); + boxes.push_back (rstem); } + /* + TODO: add support for, double flat. + */ } if (!boxes.size ()) @@ -126,131 +121,45 @@ Accidental_interface::accurate_boxes (Grob *me, Grob **common) return boxes; } -/* - * Some styles do not provide all flavours of accidentals, e.g. there - * is currently no sharp accidental in vaticana style. In these cases - * this function falls back to one of the other styles. - */ - -/* - todo: this sort of stuff in Scheme. --hwn. -*/ -string -Accidental_interface::get_fontcharname (string style, int alteration) -{ - if (alteration == DOUBLE_FLAT - || alteration == DOUBLE_SHARP) - return to_string (alteration); - - if (style == "hufnagel") - switch (alteration) - { - case FLAT: return "hufnagel-1"; - case 0: return "vaticana0"; - case SHARP: return "mensural1"; - } - if (style == "medicaea") - switch (alteration) - { - case FLAT: return "medicaea-1"; - case 0: return "vaticana0"; - case SHARP: return "mensural1"; - } - if (style == "vaticana") - switch (alteration) - { - case FLAT: return "vaticana-1"; - case 0: return "vaticana0"; - case SHARP: return "mensural1"; - } - if (style == "mensural") - switch (alteration) - { - case FLAT: return "mensural-1"; - case 0: return "vaticana0"; - case SHARP: return "mensural1"; - } - - if (style == "neomensural") - style = ""; // currently same as default - if (style == "default") - style = ""; - - return style + to_string (alteration); -} - MAKE_SCHEME_CALLBACK (Accidental_interface, print, 1); SCM Accidental_interface::print (SCM smob) { Grob *me = unsmob_grob (smob); - bool parens = to_boolean (me->get_property ("parenthesized")); - - SCM scm_style = me->get_property ("style"); - string style; - if (scm_is_symbol (scm_style)) - style = ly_symbol2string (scm_style); - else - /* - preferably no name for the default style. - */ - style = ""; Font_metric *fm = Font_interface::get_default_font (me); - SCM stencils = me->get_property ("stencils"); - if (!scm_is_pair (stencils) - || !unsmob_stencil (scm_car (stencils))) - return SCM_EOL; + SCM alist = me->get_property ("glyph-name-alist"); + SCM alt = me->get_property ("alteration"); + SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F); + + if (!scm_is_string (glyph_name)) + { + me->warning (_f ("Could not find glyph-name for alteration %s", + ly_scm2rational (alt).to_string ().c_str ())); + return SCM_EOL; + } - Stencil mol (*unsmob_stencil (scm_car (stencils))); + Stencil mol (fm->find_by_name (scm_i_string_chars (glyph_name))); if (to_boolean (me->get_property ("restore-first"))) { - string font_char = get_fontcharname (style, 0); - Stencil acc (fm->find_by_name ("accidentals." + font_char)); + /* + this isn't correct for ancient accidentals, but they don't + use double flats/sharps anyway. + */ + Stencil acc (fm->find_by_name ("accidentals.natural")); if (acc.is_empty ()) - me->warning (_f ("accidental `%s' not found", font_char)); + me->warning (_ ("natural alteration glyph not found")); else mol.add_at_edge (X_AXIS, LEFT, acc, 0.1, 0); } - if (parens) + if (to_boolean (me->get_property ("parenthesized"))) mol = parenthesize (me, mol); return mol.smobbed_copy (); } - -MAKE_SCHEME_CALLBACK (Accidental_interface, calc_stencils, 1); -SCM -Accidental_interface::calc_stencils (SCM smob) -{ - Grob *me = unsmob_grob (smob); - - SCM scm_style = me->get_property ("style"); - string style; - if (scm_is_symbol (scm_style)) - style = ly_symbol2string (scm_style); - else - /* - preferably no name for the default style. - */ - style = ""; - - - Font_metric *fm = Font_interface::get_default_font (me); - SCM acc = me->get_property ("alteration"); - if (scm_is_number (acc)) - { - string font_char = get_fontcharname (style, scm_to_int (acc)); - - Stencil acc_stencil (fm->find_by_name ("accidentals." + font_char)); - - return scm_list_1 (acc_stencil.smobbed_copy ()); - } - else - return SCM_EOL; -} ADD_INTERFACE (Accidental_interface, @@ -260,8 +169,8 @@ ADD_INTERFACE (Accidental_interface, "alteration " "avoid-slur " "forced " - "style " "parenthesized " "restore-first " + "glyph-name-alist " "tie " ); diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index ab2897f16d..8606e4c9c1 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -158,7 +158,7 @@ Ambitus_engraver::finalize () } else { - accidentals_[d]->set_property ("alteration", scm_from_int (int (Real (Rational (4) * p.get_alteration ())))); + accidentals_[d]->set_property ("alteration", ly_rational2scm (p.get_alteration ())); } } while (flip (&d) != DOWN); diff --git a/lily/enclosing-bracket.cc b/lily/enclosing-bracket.cc index 60e98f0944..e647fcae86 100644 --- a/lily/enclosing-bracket.cc +++ b/lily/enclosing-bracket.cc @@ -85,7 +85,11 @@ Enclosing_bracket::print (SCM grob) Grob *common_x = common_refpoint_of_array (elements, me, X_AXIS); Interval xext = Axis_group_interface::relative_group_extent (elements, common_x, X_AXIS); - + if (xext.is_empty ()) + { + me->programming_error ("elements have no X extent."); + xext = Interval (0, 0); + } Stencil left_br = Horizontal_bracket::make_enclosing_bracket (me, me, elements, Y_AXIS, LEFT); diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index 1cb51a10ff..5e161474dc 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -135,12 +135,12 @@ LY_DEFINE (ly_assoc_get, "ly:assoc-get", "(or #f if not specified).") { SCM handle = scm_assoc (key, alist); - + if (scm_is_pair (handle)) + return scm_cdr (handle); + if (default_value == SCM_UNDEFINED) default_value = SCM_BOOL_F; - if (scm_is_pair (handle)) - return scm_cdr (handle); return default_value; } diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index d2b016b496..99cdd8a5e7 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -72,19 +72,25 @@ Horizontal_bracket::make_enclosing_bracket (Grob *me, Grob *refpoint, Grob *common = common_refpoint_of_array (grobs, refpoint, a); Interval ext = Axis_group_interface::relative_group_extent (grobs, common, a); - Stencil b = make_bracket (me, ext.length(), a, dir); - b.translate_axis (ext[LEFT] - refpoint->relative_coordinate (common, a), a); + if (ext.is_empty ()) + { + me->programming_error ("Can't enclose empty extents with bracket"); + return Stencil (); + } + else + { + Stencil b = make_bracket (me, ext.length(), a, dir); + b.translate_axis (ext[LEFT] - refpoint->relative_coordinate (common, a), a); - return b; + return b; + } } - /* TODO: Support texts on the brackets? */ - MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1); SCM Horizontal_bracket::print (SCM smob) diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 8bd0d1305f..b3e9d4bd98 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -53,23 +53,6 @@ Key_engraver::Key_engraver () } -SCM -make_qt_key (SCM rat_key) -{ - SCM qt_key = SCM_EOL; - SCM *tail = &qt_key; - - for (SCM s = rat_key; scm_is_pair (s); s = scm_cdr (s)) - { - *tail = scm_cons (scm_cons (scm_caar (s), - scm_from_int (Rational (4)* ly_scm2rational (scm_cdar (s)))), - SCM_EOL); - tail = SCM_CDRLOC (*tail); - } - - return qt_key; -} - void Key_engraver::create_key (bool is_default) { @@ -110,14 +93,13 @@ Key_engraver::create_key (bool is_default) key_event_ ? key_event_->self_scm () : SCM_EOL); - cancellation_->set_property ("alteration-alist", make_qt_key (restore)); + cancellation_->set_property ("alteration-alist", restore); cancellation_->set_property ("c0-position", get_property ("middleCPosition")); } } - - item_->set_property ("alteration-alist", make_qt_key (key)); + item_->set_property ("alteration-alist", key); } if (!is_default) diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index d6513efd84..bea2aafbc7 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -15,72 +15,14 @@ #include "lookup.hh" #include "output-def.hh" #include "staff-symbol-referencer.hh" +#include "rational.hh" struct Key_signature_interface { DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_GROB_INTERFACE(); }; -/* - FIXME: too much hardcoding here. -*/ -const int FLAT_TOP_PITCH = 2; /* fes, ges, as and bes typeset in lower octave */ -const int SHARP_TOP_PITCH = 4; /* ais and bis typeset in lower octave */ - -/* - TODO: look this up. I'm not sure where the naturals ought to go. - - COMMENT: Current implementation does not use the NATURAL_TOP_PITCH for anything, - always typesets naturals in the same place as the thing they cancel. -rz -*/ -const int NATURAL_TOP_PITCH = 4; - -/* - FIXME: key-item should just get a list of (position, acc), and leave - the thinking to other parties. - - - TODO: put this in Scheme - - TODO: can we do without c0pos? it's partly musical. -*/ -int -alteration_pos (SCM what, int alter, int c0p) -{ - if (scm_is_pair (what)) - return scm_to_int (scm_car (what)) * 7 + scm_to_int (scm_cdr (what)) + c0p; - - int p = scm_to_int (what); - - // Find the c in the range -4 through 2 - int from_bottom_pos = c0p + 4; - from_bottom_pos = from_bottom_pos % 7; - from_bottom_pos = (from_bottom_pos + 7) % 7; // Precaution to get positive. - int c0 = from_bottom_pos - 4; - - if ((alter < 0 && ((p > FLAT_TOP_PITCH) || (p + c0 > 4)) && (p + c0 > 1)) - || (alter > 0 && ((p > SHARP_TOP_PITCH) || (p + c0 > 5)) && (p + c0 > 2)) - || (alter == 0 && ((p > NATURAL_TOP_PITCH) || (p + c0 > 5)) && (p + c0 > 2))) - { - p -= 7; /* Typeset below c_position */ - } - - /* Provide for the four cases in which there's a glitch - it's a hack, but probably not worth - the effort of finding a nicer solution. - --dl. */ - if (c0 == 2 && alter > 0 && p == 3) - p -= 7; - if (c0==-3 && alter > 0 && p ==-1) - p += 7; - if (c0==-4 && alter < 0 && p ==-1) - p += 7; - if (c0==-2 && alter < 0 && p ==-3) - p += 7; - - return p + c0; -} /* TODO @@ -101,13 +43,9 @@ Key_signature_interface::print (SCM smob) else style = ""; - SCM newas = me->get_property ("alteration-alist"); Stencil mol; SCM c0s = me->get_property ("c0-position"); - int c0p = 0; - if (scm_is_number (c0s)) - c0p = scm_to_int (c0s); bool is_cancellation = me->internal_has_interface (ly_symbol2scm ("key-cancellation-interface")); @@ -119,22 +57,33 @@ Key_signature_interface::print (SCM smob) int last_pos = -1000; Font_metric *fm = Font_interface::get_default_font (me); - for (SCM s = newas; scm_is_pair (s); s = scm_cdr (s)) + SCM alist = me->get_property ("glyph-name-alist"); + + for (SCM s = me->get_property ("alteration-alist"); scm_is_pair (s); s = scm_cdr (s)) { - int alteration = scm_to_int (scm_cdar (s)); - string font_char - = Accidental_interface::get_fontcharname (style, - is_cancellation - ? 0 - : alteration); - Stencil acc (fm->find_by_name ("accidentals." + font_char)); + SCM alt = is_cancellation + ? scm_from_int (0) + : scm_cdar (s); + + SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F); + if (!scm_is_string (glyph_name)) + { + me->warning (_f ("No glyph found for alteration: %s", + ly_scm2rational (alt).to_string ().c_str ())); + continue; + } + + Stencil acc (fm->find_by_name (ly_scm2string (glyph_name))); if (acc.is_empty ()) - me->warning (_f ("accidental `%s' not found", font_char)); + me->warning (_ ("alteration not found")); else { SCM what = scm_caar (s); - int pos = alteration_pos (what, alteration, c0p); + + SCM proc = ly_lily_module_constant ("key-signature-interface::alteration-position"); + + int pos = scm_to_int (scm_call_3 (proc, what, scm_cdar (s), c0s)); acc.translate_axis (pos * inter, Y_AXIS); /* @@ -161,7 +110,8 @@ Key_signature_interface::print (SCM smob) ADD_INTERFACE (Key_signature_interface, "A group of accidentals, to be printed as signature sign.", + "alteration-alist " "c0-position " + "glyph-name-alist " "style " - "alteration-alist " ); diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index 37dbc7a896..305359c3f5 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -8,12 +8,13 @@ #include +#include "lily-parser.hh" + #include "file-name-map.hh" #include "file-name.hh" #include "file-path.hh" #include "international.hh" #include "lily-lexer.hh" -#include "lily-parser.hh" #include "ly-module.hh" #include "main.hh" #include "program-option.hh" @@ -165,7 +166,7 @@ LY_DEFINE (ly_parse_string, "ly:parse-string", LY_DEFINE (ly_parser_lexer, "ly:parser-lexer", 1, 0, 0, (SCM parser_smob), - "Return the lexer for PARSER_SMOB.") + "Return the lexer for @var{parser-smob}.") { Lily_parser *parser = unsmob_lily_parser (parser_smob); return parser->lexer_->self_scm (); @@ -173,7 +174,7 @@ LY_DEFINE (ly_parser_lexer, "ly:parser-lexer", LY_DEFINE (ly_parser_clone, "ly:parser-clone", 1, 0, 0, (SCM parser_smob), - "Return a clone of PARSER_SMOB.") + "Return a clone of @var{parser-smob}.") { Lily_parser *parser = unsmob_lily_parser (parser_smob); Lily_parser *clone = new Lily_parser (*parser); @@ -183,7 +184,7 @@ LY_DEFINE (ly_parser_clone, "ly:parser-clone", LY_DEFINE (ly_parser_define, "ly:parser-define!", 3, 0, 0, (SCM parser_smob, SCM symbol, SCM val), - "Bind SYMBOL to VAL in PARSER_SMOB's module.") + "Bind @var{symbol} to @var{val} in @var{parser-smob}'s module.") { Lily_parser *parser = unsmob_lily_parser (parser_smob); SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol"); @@ -195,7 +196,7 @@ LY_DEFINE (ly_parser_define, "ly:parser-define!", LY_DEFINE (ly_parser_lookup, "ly:parser-lookup", 2, 0, 0, (SCM parser_smob, SCM symbol), - "Lookup @var{symbol} in @var{parser_smob}'s module. " + "Lookup @var{symbol} in @var{parser-smob}'s module. " "Undefined is '().") { Lily_parser *parser = unsmob_lily_parser (parser_smob); @@ -212,7 +213,7 @@ LY_DEFINE (ly_parser_lookup, "ly:parser-lookup", LY_DEFINE (ly_parser_parse_string, "ly:parser-parse-string", 2, 0, 0, (SCM parser_smob, SCM ly_code), - "Parse the string LY_CODE with PARSER_SMOB." + "Parse the string @code{ly-code} with @code{parser-smob}." "Upon failure, throw @code{ly-file-failed} key.") { Lily_parser *parser = unsmob_lily_parser (parser_smob); diff --git a/lily/note-column.cc b/lily/note-column.cc index ca85f08e12..fbb838523e 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -191,7 +191,6 @@ ADD_INTERFACE (Note_column, "Stem and noteheads combined", /* properties */ - "accidentals " "arpeggio " "force-hshift " "horizontal-shift " diff --git a/lily/note-spacing-engraver.cc b/lily/note-spacing-engraver.cc index 33c459cb13..7b5f2ad7bd 100644 --- a/lily/note-spacing-engraver.cc +++ b/lily/note-spacing-engraver.cc @@ -9,6 +9,7 @@ #include "engraver.hh" +#include "context.hh" #include "item.hh" #include "pointer-group-interface.hh" @@ -17,20 +18,31 @@ class Note_spacing_engraver : public Engraver { Grob *last_spacing_; + Context *last_spacing_parent_context_; + Grob *spacing_; void add_spacing_item (Grob *); - TRANSLATOR_DECLARATIONS (Note_spacing_engraver); protected: DECLARE_ACKNOWLEDGER (rhythmic_grob); DECLARE_ACKNOWLEDGER (note_column); void stop_translation_timestep (); + virtual void finalize (); + virtual void derived_mark () const; }; +void +Note_spacing_engraver::derived_mark () const +{ + if (last_spacing_parent_context_) + scm_gc_mark (last_spacing_parent_context_->self_scm ()); +} + Note_spacing_engraver::Note_spacing_engraver () { + last_spacing_parent_context_ = 0; last_spacing_ = 0; spacing_ = 0; } @@ -43,7 +55,6 @@ Note_spacing_engraver::add_spacing_item (Grob *g) spacing_ = make_item ("NoteSpacing", g->self_scm ()); } - if (spacing_) { Pointer_group_interface::add_grob (spacing_, @@ -51,11 +62,9 @@ Note_spacing_engraver::add_spacing_item (Grob *g) g); if (last_spacing_) - { - Pointer_group_interface::add_grob (last_spacing_, - ly_symbol2scm ("right-items"), - g); - } + Pointer_group_interface::add_grob (last_spacing_, + ly_symbol2scm ("right-items"), + g); } } @@ -72,14 +81,43 @@ Note_spacing_engraver::acknowledge_rhythmic_grob (Grob_info gi) add_spacing_item (gi.grob ()); } +void +Note_spacing_engraver::finalize () +{ + if (last_spacing_ + && last_spacing_parent_context_ + && last_spacing_parent_context_ == context ()->get_parent_context ()) + { + SCM ccol = get_property ("currentCommandColumn"); + Grob *column = unsmob_grob (ccol); + + Pointer_group_interface::add_grob (last_spacing_, + ly_symbol2scm ("right-items"), + column); + } +} + void Note_spacing_engraver::stop_translation_timestep () { + if (last_spacing_ + && last_spacing_parent_context_ + && last_spacing_parent_context_ == context ()->get_parent_context ()) + { + Grob *sep = unsmob_grob (get_property ("breakableSeparationItem")); + if (sep) + Pointer_group_interface::add_grob (last_spacing_, + ly_symbol2scm ("right-items"), + sep); + } + if (spacing_) { last_spacing_ = spacing_; + last_spacing_parent_context_ = context ()->get_parent_context (); spacing_ = 0; } + } ADD_ACKNOWLEDGER (Note_spacing_engraver, note_column); diff --git a/lily/parser.yy b/lily/parser.yy index ebb322d773..7ea90f93da 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -350,6 +350,7 @@ If we give names, Bison complains. %type absolute_pitch %type assignment_id %type bare_number +%type unsigned_number %type bass_figure %type figured_bass_modification %type br_bass_figure @@ -854,9 +855,9 @@ alternative_music: repeated_music: - REPEAT simple_string bare_unsigned music alternative_music + REPEAT simple_string unsigned_number music alternative_music { - $$ = MAKE_SYNTAX ("repeat", @$, $2, scm_int2num ($3), $4, $5); + $$ = MAKE_SYNTAX ("repeat", @$, $2, $3, $4, $5); } ; @@ -975,7 +976,7 @@ prefix_composite_music: generic_prefix_music_scm { $$ = run_music_function (PARSER, $1); } - | CONTEXT simple_string optional_id optional_context_mod music { + | CONTEXT simple_string optional_id optional_context_mod music { $$ = MAKE_SYNTAX ("context-specification", @$, $2, $3, $5, $4, SCM_BOOL_F); } | NEWCONTEXT simple_string optional_id optional_context_mod music { @@ -1609,7 +1610,7 @@ direction_reqd_event: octave_check: /**/ { $$ = SCM_EOL; } | '=' { $$ = scm_from_int (0); } - | '=' sub_quotes { $$ = scm_from_int ($2); } + | '=' sub_quotes { $$ = scm_from_int (-$2); } | '=' sup_quotes { $$ = scm_from_int ($2); } ; @@ -2134,6 +2135,14 @@ bare_unsigned: } ; +unsigned_number: + bare_unsigned { $$ = scm_from_int ($1); } + | NUMBER_IDENTIFIER { + $$ = $1; + } + ; + + exclamations: { $$ = 0; } | exclamations '!' { $$ ++; } diff --git a/lily/pitch.cc b/lily/pitch.cc index 880dc79edf..da3a8a01dd 100644 --- a/lily/pitch.cc +++ b/lily/pitch.cc @@ -168,10 +168,10 @@ Pitch::to_string () const { int n = (notename_ + 2) % scale_->step_tones_.size (); string s = ::to_string (char (n + 'a')); - Rational qtones = alteration_ * Rational (4,1); - int qt = int (rint (Real (qtones))); + Rational qtones = alteration_ * Rational (4,1); + int qt = int (rint (Real (qtones))); - s += string (accname[qt + 4]); + s += string (accname[qt + 4]); if (octave_ >= 0) { int o = octave_ + 1; @@ -302,7 +302,9 @@ Pitch::transposed (Pitch d) const return p; } +Rational NATURAL_ALTERATION (0); Rational FLAT_ALTERATION (-1, 2); +Rational DOUBLE_FLAT_ALTERATION (-1); Rational SHARP_ALTERATION (1, 2); Pitch diff --git a/lily/pitched-trill-engraver.cc b/lily/pitched-trill-engraver.cc index 811decb67d..2816aa655e 100644 --- a/lily/pitched-trill-engraver.cc +++ b/lily/pitched-trill-engraver.cc @@ -110,8 +110,7 @@ Pitched_trill_engraver::make_trill (Stream_event *ev) trill_accidental_ = make_item ("TrillPitchAccidental", ev->self_scm ()); // fixme: naming -> alterations - trill_accidental_->set_property ("alteration", scm_from_int (Rational (4) - * p->get_alteration ())); + trill_accidental_->set_property ("alteration", ly_rational2scm (p->get_alteration ())); Side_position_interface::add_support (trill_accidental_, trill_head_); trill_head_->set_object ("accidental-grob", trill_accidental_->self_scm ()); diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index b2aeb9b2ab..d98221e648 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -93,13 +93,6 @@ Separating_line_group_engraver::finalize () sep_span_->set_bound (RIGHT, unsmob_grob (ccol)); sep_span_ = 0; - for (vsize i = 0; i < last_spacings_.note_spacings_.size (); i++) - { - Pointer_group_interface::add_grob (last_spacings_.note_spacings_[i], - ly_symbol2scm ("right-items"), - column); - } - if (last_spacings_.staff_spacing_ && last_spacings_.staff_spacing_->get_column () == column) last_spacings_.staff_spacing_->suicide (); @@ -146,14 +139,8 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i) Pointer_group_interface::add_grob (it, ly_symbol2scm ("left-items"), break_item_); - if (int i = last_spacings_.note_spacings_.size ()) - { - for (; i--;) - Pointer_group_interface::add_grob (last_spacings_.note_spacings_[i], - ly_symbol2scm ("right-items"), - break_item_); - } - else if (last_spacings_.staff_spacing_) + if (!last_spacings_.note_spacings_.size () + && last_spacings_.staff_spacing_) { SCM ri = last_spacings_.staff_spacing_->get_object ("right-items"); Grob_array *ga = unsmob_grob_array (ri); diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 8752d704a0..bccee086c5 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -784,26 +784,20 @@ Slur_score_state::get_extra_encompass_infos () const { penalty = parameters_.accidental_collision_; - SCM alt = g->get_property ("alteration"); + Rational alt = ly_scm2rational (g->get_property ("alteration")); SCM scm_style = g->get_property ("style"); if (!scm_is_symbol (scm_style) && !to_boolean (g->get_property ("parenthesized")) && !to_boolean (g->get_property ("restore-first"))) { /* End copy accidental.cc */ - switch (scm_to_int (alt)) - { - case FLAT: - case DOUBLE_FLAT: - xp = LEFT; - break; - case SHARP: - xp = 0.5 * dir_; - break; - case NATURAL: - xp = -dir_; - break; - } + if (alt == FLAT_ALTERATION + || alt == DOUBLE_FLAT_ALTERATION) + xp = LEFT; + else if (alt == SHARP_ALTERATION) + xp = 0.5 * dir_; + else if (alt == NATURAL_ALTERATION) + xp = -dir_; } } diff --git a/lily/spaceable-grob.cc b/lily/spaceable-grob.cc index 679c2bcb19..7d86ebf919 100644 --- a/lily/spaceable-grob.cc +++ b/lily/spaceable-grob.cc @@ -132,5 +132,7 @@ ADD_INTERFACE (Spaceable_grob, "measure-length " "minimum-distances " "right-neighbors " - "spacing-wishes"); + "spacing-wishes " + + ); diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index 8f6355b26e..052e0d766b 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -39,7 +39,7 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) if ((options->float_nonmusical_columns_ - ||options->float_grace_columns_) + || options->float_grace_columns_) && Paper_column::when_mom (col).grace_part_) { return true; @@ -104,9 +104,6 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) return false; /* - A rather hairy check, but we really only want to move around - clefs. (anything else?) - in any case, we don't want to move bar lines. */ extract_grob_set (col, "elements", elts); @@ -120,9 +117,6 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) { Grob *h = gelts[j]; - /* - ugh. -- fix staff-bar name? - */ if (h && h->get_property ("break-align-symbol") == ly_symbol2scm ("staff-bar")) return false; } @@ -234,8 +228,20 @@ Spacing_spanner::prune_loose_columns (Grob *me, vector *cols, } else { + Grob *min_item = 0; + int min_rank = INT_MAX; + for (vsize j = 0; j < right_items.size (); j ++) + { + int rank = dynamic_cast (right_items[j])->get_column ()->get_rank (); + if (rank < min_rank) + { + min_item = right_items[j]; + min_rank = rank; + } + } + c->set_object ("between-cols", scm_cons (lns, - right_items[0]->self_scm ())); + min_item->self_scm ())); /* Set distance constraints for loose columns @@ -264,7 +270,7 @@ Spacing_spanner::set_explicit_neighbor_columns (vector const &cols) { SCM right_neighbors = Grob_array::make_array (); Grob_array *rn_arr = unsmob_grob_array (right_neighbors); - int min_rank = 100000; // inf. + int min_rank = INT_MAX; extract_grob_set (cols[i], "spacing-wishes", wishes); for (vsize k = wishes.size (); k--;) @@ -338,8 +344,6 @@ Spacing_spanner::set_implicit_neighbor_columns (vector const &cols) if (!Paper_column::is_breakable (it) && !Paper_column::is_musical (it)) continue; - // it->breakable || it->musical - /* sloppy with typing left/right-neighbors should take list, but paper-column found instead. */ diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc index 94bc552e6f..069ff0e231 100644 --- a/lily/spacing-loose-columns.cc +++ b/lily/spacing-loose-columns.cc @@ -66,9 +66,20 @@ set_loose_columns (System *which, Column_x_positions const *posns) loose = right = re->get_column (); } - if (!right->get_system ()) + if (right->get_system ()) + ; /* do nothing */ + else if (right->find_prebroken_piece (LEFT) + && right->find_prebroken_piece (LEFT)->get_system () == which) right = right->find_prebroken_piece (LEFT); - + else if (Paper_column::get_rank (which->get_bound (RIGHT)) < Paper_column::get_rank (right)) + + right = which->get_bound (RIGHT); + else + { + clique.back ()->programming_error ("Loose column does not have right side to attach to."); + right = which->get_bound (RIGHT); + } + Grob *common = right->common_refpoint (left, X_AXIS); clique.push_back (right); diff --git a/lily/stem.cc b/lily/stem.cc index fc21f2d6b9..77185b3bdc 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -154,7 +154,7 @@ Stem::last_head (Grob *me) Drul_array Stem::extremal_heads (Grob *me) { - const int inf = 1000000; + const int inf = INT_MAX; Drul_array extpos; extpos[DOWN] = inf; extpos[UP] = -inf; diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index fc0b867e82..063b9b44f9 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -782,7 +782,7 @@ AncientRemoveEmptyStaffContext = \context { %% Select vaticana style font. \override KeySignature #'style = #'vaticana - \override Accidental #'style = #'vaticana + \override Accidental #'glyph-name-alist = #alteration-vaticana-glyph-name-alist \override Custos #'style = #'vaticana \override Custos #'neutral-position = #3 \override Custos #'neutral-direction = #DOWN @@ -793,7 +793,7 @@ AncientRemoveEmptyStaffContext = \context { \Voice \name "GregorianTranscriptionVoice" \alias "Voice" - + %% Removing ligature bracket engraver without replacing it by some %% other ligature engraver would cause a "Junking event: `LigatureEvent'" %% warning for every "\[" and "\]". Therefore, we make the grob @@ -885,7 +885,7 @@ AncientRemoveEmptyStaffContext = \context { %% Select mensural style font. \override TimeSignature #'style = #'mensural \override KeySignature #'style = #'mensural - \override Accidental #'style = #'mensural + \override Accidental #'glyph-name-alist = #alteration-mensural-glyph-name-alist \override Custos #'style = #'mensural \override Custos #'neutral-position = #3 \override Custos #'neutral-direction = #DOWN diff --git a/make/doclang-targets.make b/make/doclang-targets.make index 6d46749eef..b0cb5d4305 100644 --- a/make/doclang-targets.make +++ b/make/doclang-targets.make @@ -29,8 +29,10 @@ png-ln: mkdir -p $(outdir)/lilypond # makeinfo is broken, it MUST have PNGs in output dir # symlinking PNGs... - $(foreach i, $(shell find $(depth)/Documentation/user/$(outdir) -maxdepth 1 -name '*.png'), ln -sf ../$(i) $(i:$(depth)/Documentation/user/$(outdir)/%.png=$(outdir)/%.png) &&) true - $(foreach i, $(shell find $(depth)/Documentation/user/$(outdir)/lilypond -name '*.png'), ln -sf ../../$(i) $(i:$(depth)/Documentation/user/$(outdir)/%.png=$(outdir)/%.png) &&) true + +## cmd too long FIXME / JUNKME. +## $(foreach i, $(shell find $(depth)/Documentation/user/$(outdir) -maxdepth 1 -name '*.png'), ln -sf ../$(i) $(i:$(depth)/Documentation/user/$(outdir)/%.png=$(outdir)/%.png) &&) true +## $(foreach i, $(shell find $(depth)/Documentation/user/$(outdir)/lilypond -name '*.png'), ln -sf ../../$(i) $(i:$(depth)/Documentation/user/$(outdir)/%.png=$(outdir)/%.png) &&) true # Links referred to by Documentation index # BROKEN: the following makes broken symlinks diff --git a/make/lilypond-vars.make b/make/lilypond-vars.make index 1e60313993..6c15832981 100644 --- a/make/lilypond-vars.make +++ b/make/lilypond-vars.make @@ -22,14 +22,14 @@ the-script-dir=$(wildcard $(script-dir)) ABC2LY = $(script-dir)/abc2ly.py CONVERT_LY = $(script-dir)/convert-ly.py LILYPOND_BOOK = $(script-dir)/lilypond-book.py -LILYPOND_BOOK_INCLUDES = -I $(src-dir)/ -I $(outdir) -I $(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/manual/ -I $(input-dir)/tutorial/ -I $(top-build-dir)/mf/$(outconfbase)/ -I $(top-build-dir)/mf/out/ +LILYPOND_BOOK_INCLUDES = -I $(src-dir)/ -I $(outdir) -I $(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/manual/ -I $(input-dir)/tutorial/ -I $(top-build-dir)/mf/$(outconfbase)/ -I $(top-build-dir)/mf/out/ -I $(input-dir)/test/ ## override from cmd line to speed up. ANTI_ALIAS_FACTOR=2 LILYPOND_JOBS=$(if $(CPU_COUNT),-djob-count=$(CPU_COUNT),) LILYPOND_BOOK_LILYPOND_FLAGS=--backend=eps --formats=ps,png,pdf $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=$(ANTI_ALIAS_FACTOR) LILYPOND_BOOK_VERBOSE = --verbose -LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) $(LILYPOND_BOOK_LILYPOND_FLAGS)" $(LILYPOND_BOOK_VERBOSE) +LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) $(LILYPOND_BOOK_LILYPOND_FLAGS)" $(LILYPOND_BOOK_VERBOSE) TEXINPUTS=$(top-src-dir)/tex/:: export TEXINPUTS diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 866bfbbad9..1492d1790b 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -6,10 +6,9 @@ LOCALSTEPMAKE_TEMPLATES=lilypond include $(depth)/make/stepmake.make -# hangs on feta23 MFTRACE_FLAGS= --simplify -EXTRA_DIST_FILES += README feta.tex +EXTRA_DIST_FILES += README # We don't use $(MF_FILES), because there's more .mf cruft here FETA_MF_FILES = $(call src-wildcard,feta[0-9]*.mf)\ @@ -36,11 +35,8 @@ NCSB_INSTALL_DIR=$(local_lilypond_datadir)/fonts/otf LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log) LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp) -TEXTABLES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tex) -ENC_FILES = $(TEXTABLES:.tex=.enc) -TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)\ - $(SAUTER_FONTS:%=$(outdir)/%.tfm) - +ENC_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.enc) +TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm) ENCODING_FILE=$(findstring $( % +% +% also show in other configuration wrt staff lines. +% +def draw_shifted_too = +if test > 0: + fet_beginchar ("shifted too", ""); + set_char_box (0, 0,0,0); + currentpicture := remember_pic; + + draw_staff (-2, 2, 0.5); + fet_endchar; +fi; +enddef; + + + % % Accidentals from various sources, notably % @@ -15,12 +29,27 @@ % +% +% Naming for microtonal +% +% BASES SLASHES STEMS +% +% mirroredflat.flat.slashslash +% + +% standard sharp: +% sharp.slashslash.stemstem +% sharp.slashslash.stem + + fet_begingroup ("accidentals"); save remember_pic; picture remember_pic; +save sharp_beamheight; +sharp_beamheight# := 0.3 staff_space# + stafflinethickness#; % % The beams of most sharps have horizontal endings (as if drawn with @@ -29,28 +58,27 @@ picture remember_pic; % def draw_meta_sharp (expr width, offset) = - save beamheight, beamwidth, beamslope; + save beamwidth, beamslope; save ne, nw_dist; pair ne, nw_dist; beamwidth := width; - beamheight# := 0.3 staff_space# + stafflinethickness#; - define_whole_vertical_blacker_pixels (beamheight); + define_whole_vertical_blacker_pixels (sharp_beamheight); clearxy; - beamslope = beamheight / beamwidth; + beamslope = sharp_beamheight / beamwidth; pickup pencircle scaled 2 blot_diameter; rt x2 - lft x1 = beamwidth; - y2 - y1 = beamheight; + y2 - y1 = sharp_beamheight; .5 [z1, z3] = (.5 w, offset); x3 = x2; - top y2 - bot y3 = beamheight; + top y2 - bot y3 = sharp_beamheight; x4 = x1; - top y1 - bot y4 = beamheight; + top y1 - bot y4 = sharp_beamheight; ne = unitvector (z2 - z1); nw_dist = (ne rotated 90) * blot_diameter; @@ -69,7 +97,7 @@ def draw_meta_sharp (expr width, offset) = enddef; -fet_beginchar ("Sharp", "2"); +fet_beginchar ("Sharp", "sharp"); save stem, stemx, stemwidth; save outer_space, interbeam; @@ -110,21 +138,9 @@ fet_beginchar ("Sharp", "2"); draw_staff (-2, 2, 0); fet_endchar; +draw_shifted_too; -if test > 0: - fet_beginchar ("Sharp", "2"); - - set_char_box (0, 1.1 staff_space#, - 1.5 staff_space#, 1.5 staff_space#); - - currentpicture := remember_pic; - - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; - - -fet_beginchar ("1/2 Sharp", "1"); +fet_beginchar ("1/2 Sharp", "sharp.slashslash.stem"); save stem, stemwidth; save outer_space, interbeam; @@ -160,21 +176,100 @@ fet_beginchar ("1/2 Sharp", "1"); draw_staff (-2, 2, 0); fet_endchar; +draw_shifted_too; -if test > 0: - fet_beginchar ("1/2 Sharp", "1"); +fet_beginchar ("Sharp (3 beams)", "sharp.slashslashslash.stemstem"); + save stem, stemx, stemwidth; + save outer_space, interbeam; + save sharp_beamheight; - set_char_box (0, 0.7 staff_space#, - 1.5 staff_space#, 1.5 staff_space#); + sharp_beamheight# := 0.22 staff_space# + stafflinethickness#; - currentpicture := remember_pic; - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; + stemwidth# := stafflinethickness# + .05 staff_space#; + define_whole_blacker_pixels (stemwidth); + interbeam := 1.2 staff_space_rounded; + + set_char_box (0, 1.1 staff_space#, + 1.5 staff_space#, 1.5 staff_space#); -fet_beginchar ("3/4 Sharp", "3"); + stem := 7 / 16 * w; + stemx := hround stem; + outer_space := hround ((w - stemx - stemwidth) / 2); + + w := 2 outer_space + stemx + stemwidth; + d := d - feta_space_shift; + + draw_meta_sharp (.88 w, -.5 interbeam); + draw_meta_sharp (w, 0); + draw_meta_sharp (.88 w, -.5 interbeam + vround interbeam); + + pickup pencircle scaled stemwidth; + + lft x5 = lft x6 = outer_space; + lft x7 = lft x8 = outer_space + stemx; + bot y5 = -d; + top y6 = vround (1.5 staff_space - stem * beamslope); + bot y7 = -top y6 + feta_space_shift; + top y8 = h; + + labels (5, 6, 7, 8); + + draw_gridline (z5, z6, stemwidth); + draw_gridline (z7, z8, stemwidth); + + remember_pic := currentpicture; + + draw_staff (-2, 2, 0); +fet_endchar; + +draw_shifted_too; + +fet_beginchar ("1/2 Sharp (3 beams)", "sharp.slashslashslash.stem"); + save stem, stemx, stemwidth; + save outer_space, interbeam; + save sharp_beamheight; + + sharp_beamheight# := 0.22 staff_space# + stafflinethickness#; + + stemwidth# := stafflinethickness# + .05 staff_space#; + define_whole_blacker_pixels (stemwidth); + + interbeam := 1.2 staff_space_rounded; + + set_char_box (0, 0.95 staff_space#, + 1.3 staff_space#, 1.3 staff_space#); + + stem := 7 / 16 * w; + outer_space := hround ((w - stemwidth) / 2); + w := 2 outer_space + stemwidth; + d := d - feta_space_shift; + + draw_meta_sharp (.8 w, -.5 interbeam); + draw_meta_sharp (w, 0); + draw_meta_sharp (.8 w, -.5 interbeam + vround interbeam); + + pickup pencircle scaled stemwidth; + + lft x5 = lft x6 = outer_space; + top y6 = vround (1.5 staff_space - .5 stem); + bot y5 = -top y6 + feta_space_shift; + labels (5, 6); + + + draw_gridline (z5, z6, stemwidth); + + + remember_pic := currentpicture; + + draw_staff (-2, 2, 0); +fet_endchar; + +draw_shifted_too; + + +fet_beginchar ("3/4 Sharp", "sharp.slashslash.stemstemstem"); save stem, stemx, stemwidth; save outer_space, interbeam; @@ -219,25 +314,15 @@ fet_beginchar ("3/4 Sharp", "3"); draw_staff (-2, 2, 0); fet_endchar; +draw_shifted_too; -if test > 0: - fet_beginchar ("3/4 Sharp", "3"); - - set_char_box (0, 1.6 staff_space#, - 1.5 staff_space#, 1.5 staff_space#); - - currentpicture := remember_pic; - - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; % % The stems of the natural are brushed (at least, in Barenreiter SCS) % -fet_beginchar ("Natural", "0"); +fet_beginchar ("Natural", "natural"); save stemwidth, top_stem_thick; save ne, pat_top, pat_bottom; pair ne; @@ -324,17 +409,7 @@ fet_beginchar ("Natural", "0"); draw_staff (-2, 2, 0); fet_endchar; - -if test > 0: - fet_beginchar ("Natural", "0"); - set_char_box (0, 2/3 staff_space#, - 1.5 staff_space#, 1.5 staff_space#); - - currentpicture := remember_pic; - - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; +draw_shifted_too; % @@ -455,7 +530,7 @@ enddef; % unfortunately, 600dpi is not enough to show the brush of the stem. % -fet_beginchar ("Flat", "-2"); +fet_beginchar ("Flat", "flat"); set_char_box (1.2 stafflinethickness#, .8 staff_space#, 0.6 staff_space#, 1.9 staff_space#); @@ -467,20 +542,74 @@ fet_beginchar ("Flat", "-2"); draw_staff (-2, 2, 0); fet_endchar; +draw_shifted_too; -if test > 0: - fet_beginchar ("Flat", "-2"); - set_char_box (1.2 stafflinethickness#, .8 staff_space#, - 0.6 staff_space#, 1.9 staff_space#); +fet_beginchar ("Flat (slashed)", "flat.slash"); + set_char_box (1.2 stafflinethickness#, .8 staff_space#, + 0.6 staff_space#, 1.9 staff_space#); - currentpicture := remember_pic; + draw_meta_flat (0, w, 0.31 staff_space); + clearxy; + save slope, slash_width; + slope = 0.5; + slash_width = w; + z1 = (0, h / 2); + z2 = z1 - (slash_width, slash_width * slope)/2; + z3 = z1 + (slash_width, slash_width * slope)/2; + + pickup pencircle scaled 1.5 stafflinethickness; + draw z2 .. z3; + labels (1, 2, 3); + remember_pic := currentpicture; - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; + draw_staff (-2, 2, 0); +fet_endchar; + +fet_beginchar ("Flat (slashed twice)", "flat.slashslash"); + set_char_box (1.2 stafflinethickness#, .8 staff_space#, + 0.6 staff_space#, 1.9 staff_space#); + + draw_meta_flat (0, w, 0.31 staff_space); + clearxy; + save slope, slash_width; + + slope = 0.5; + slash_width = w; + pickup pencircle scaled 1.5 stafflinethickness; + + z1 = (0, 5/12 h); + z2 = (0, 2/3 h); + draw z1 - (slash_width, slash_width * slope)/2 + .. z1 + (slash_width, slash_width * slope)/2; + draw z2 - (slash_width, slash_width * slope)/2 + .. z2 + (slash_width, slash_width * slope)/2; + labels (1, 2); + remember_pic := currentpicture; + + draw_staff (-2, 2, 0); +fet_endchar; + +fet_beginchar ("Flatflat (mirrored)", "mirroredflat.flat"); + set_char_box (0, 1.6 staff_space#, + 0.6 staff_space#, 1.9 staff_space#); + draw_meta_flat (0, w/2, 0.31 staff_space); + currentpicture := currentpicture xscaled -1; + draw_meta_flat (0, w/2, 0.31 staff_space); + + currentpicture := currentpicture shifted (w/2,0); + penlabels (range 0 thru 11); -fet_beginchar ("Semi flat", "-1"); + remember_pic := currentpicture; + + draw_staff (-2, 2, 0); +fet_endchar; + +draw_shifted_too; + + + +fet_beginchar ("Semi flat", "mirroredflat"); set_char_box (1.2 stafflinethickness#, .8 staff_space#, 0.6 staff_space#, 1.9 staff_space#); @@ -489,7 +618,7 @@ fet_beginchar ("Semi flat", "-1"); fet_endchar; -fet_beginchar ("Double Flat", "-4"); +fet_beginchar ("Double Flat", "flatflat"); save left_wid, overlap, right_wid; left_wid = .7; @@ -505,7 +634,7 @@ fet_beginchar ("Double Flat", "-4"); fet_endchar; -fet_beginchar ("3/4 Flat", "-3"); +fet_beginchar ("3/4 Flat", "flatflat.slash"); save left_wid, overlap, right_wid; left_wid = .7; @@ -549,27 +678,9 @@ fet_beginchar ("3/4 Flat", "-3"); draw_staff (-2, 2, 0); fet_endchar; +draw_shifted_too; -if test > 0: - fet_beginchar ("3/4 Flat", "-3"); - save left_wid, overlap, right_wid; - - left_wid = .7; - right_wid = .8; - overlap = .05; - - set_char_box (1.2 stafflinethickness#, - (left_wid + right_wid - overlap) * staff_space#, - .6 staff_space#, 1.9 staff_space#); - - currentpicture := remember_pic; - - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; - - -fet_beginchar ("Double Sharp", "4"); +fet_beginchar ("Double Sharp", "doublesharp"); save klaverblad, klaversteel; save pat; path pat; @@ -622,18 +733,7 @@ fet_beginchar ("Double Sharp", "4"); draw_staff (-2, 2, 0); fet_endchar; - -if test > 0: - fet_beginchar ("Double Sharp", "4"); - set_char_box (0, staff_space#, - .5 staff_space#, .5 staff_space#); - - currentpicture := remember_pic; - - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; - +draw_shifted_too; def draw_paren = save leftindent; @@ -671,17 +771,7 @@ fet_beginchar ("Right Parenthesis", "rightparen"); draw_staff (-2, 2, 0); fet_endchar; - -if test > 0: - fet_beginchar ("Right Parenthesis", "rightparen"); - draw_paren; - penlabels (1, 2, 3); - - remember_pic := currentpicture; - - draw_staff (-2, 2, 0.5); - fet_endchar; -fi; +draw_shifted_too; fet_beginchar ("Left Parenthesis", "leftparen"); @@ -692,5 +782,4 @@ fet_beginchar ("Left Parenthesis", "leftparen"); set_char_box (charwd, charbp, chardp, charht); fet_endchar; - fet_endgroup ("accidentals"); diff --git a/mf/feta.tex b/mf/feta.tex deleted file mode 100644 index bd47bfddd4..0000000000 --- a/mf/feta.tex +++ /dev/null @@ -1,70 +0,0 @@ -% display all feta chars in a pretty picture -% GNU LilyPond -% (c) 1998--2006 Jan Nieuwenhuizen -% -% urg: fool ls-latex -\def\urg{ -\title{The Feta font} -\author{JCN} -\begin{document} -} - - -\parindent0pt -\nopagenumbers -\newcount\n -\newcount\i - -\font\fetatwenty = feta20 -\font\fetanumber = feta-nummer12 -\font\fetafinger = feta-nummer5 -\font\fetadyn = feta-din10 scaled \magstep 2 -\font\titlefont = cmbx12 scaled \magstep 4 -\font\subtitle = cmr9 - -\def\lilyfooter{Lily was here} -\def\setchar#1#2{\hbox to\charwidth{\hss{#1\char#2}\hss}} - -\def\charsperline{6} -\def\charheight{55pt} -\def\charwidth{60pt} - -\def\listfont#1#2#3{ - \n=#2 - \advance\n by-1 - \advance\n by-\charsperline - \loop\ifnum\n<#3 - \advance\n by\charsperline - \i=0 - {\vbox to\charheight{\vss\centerline{ - {\loop\ifnum\i<\charsperline - \advance\i by1 - \advance\n by1 - {\setchar{#1}{\number\n}} - \repeat}}}}\repeat} - -\def\title#1{\centerline{\titlefont #1}} -\def\author#1{\centerline{#1}} - -\title{FETA} - -\centerline{\subtitle (definitely not an abbreviation for Font-En-Tja)} - -\author{Han-Wen Nienhuys and Jan Nieuwenhuizen} - - -\vskip5mm - -\listfont{\fetatwenty}{0}{105} -% urg -\vskip-\charheight -\listfont{\fetanumber}{48}{58} -\vskip-\charheight -\listfont{\fetafinger}{48}{58} -\vskip-\charheight -\listfont{\fetadyn}{0}{6} -\vskip-\charheight - -\lilyfooter - -\bye diff --git a/python/convertrules.py b/python/convertrules.py index 165e0a52d8..d6b89e777d 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -2892,13 +2892,38 @@ def conv (str): "AccidentalCautionary #'font-size = #-2", str) str = re.sub ("Accidental\s*#'cautionary-style\s*=\s*#'parentheses", "AccidentalCautionary #'parenthesized = ##t", str) - str = re.sub ("([A-Za-z]+)\s*#'cautionary-style\s*=\s*#'parentheses", r"\1 #'parenthesized = ##t", str) str = re.sub ("([A-Za-z]+)\s*#'cautionary-style\s*=\s*#'smaller", r"\1 #'font-size = #-2", str) - + return str -conversions.append (((2, 11, 5), conv, """ly:clone-parser -> ly:parser-clone""")) +conversions.append (((2, 11, 5), conv, """deprecate cautionary-style. Use AccidentalCautionary properties""")) + + + +def conv (str): + + def sub_acc_name (m): + idx = int (m.group (1).replace ('M','-')) + + return ["accidentals.doublesharp", + "accidentals.sharp.slashslash.stemstemstem", + "accidentals.sharp", + "accidentals.sharp.slashslash.stem", + "accidentals.natural", + "accidentals.mirroredflat", + "accidentals.flat", + "accidentals.mirroredflat.flat", + "accidentals.flatflat"][4-idx] + + str = re.sub (r"accidentals[.](M?[-0-9]+)", + sub_acc_name, str) + str = re.sub (r"(KeySignature|Accidental[A-Za-z]*)\s*#'style\s*=\s*#'([a-z]+)", + r"\1 #'glyph-name-alist = #alteration-\2-glyph-name-alist", str) + + return str + +conversions.append (((2, 11, 6), conv, """Rename accidental glyphs, use glyph-name-alist.""")) diff --git a/scm/chord-name.scm b/scm/chord-name.scm index 33f82c9501..c941d50bda 100644 --- a/scm/chord-name.scm +++ b/scm/chord-name.scm @@ -21,8 +21,7 @@ 0.3 0.6) (make-musicglyph-markup - (format "accidentals.~a" - (inexact->exact (* 4 alteration))))))) + (assoc-get alteration standard-alteration-glyph-name-alist ""))))) (define (accidental->markup alteration) "Return accidental markup for ALTERATION." diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index fe584ad40d..4936710172 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -135,7 +135,8 @@ (ly:add-interface 'trill-pitch-accidental-interface "An accidental for trill pitch" - '(accidentals)) + '() + ) (ly:add-interface 'rhythmic-grob-interface diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 7ae1a0e4fe..9451952dcb 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -186,6 +186,7 @@ typeset. Valid choices depend on the function that is reading this property.") (gap ,ly:dimension? "Size of a gap in a variable symbol.") (gap-count ,integer? "Number of gapped beams for tremolo.") + (glyph-name-alist ,list? "Alist of key-string pairs.") (grow-direction ,ly:dir? "Crescendo or decrescendo?") (hair-thickness ,number? "Thickness of the thin line in a bar line.") (head-direction ,ly:dir? "Are the note heads left or right in a semitie?") @@ -246,10 +247,14 @@ multimeasure rest.") note heads in collisions, even if they have different note heads. The smaller of the two heads will be rendered invisible. This used polyphonic guitar notation. The value of this setting is used by -@internalsref{note-collision-interface} .") +@internalsref{note-collision-interface} . +merge-differently-headed only applies to opposing stem dirs +(ie. Voice 1 & 2).") (merge-differently-dotted ,boolean? "Merge note heads in collisions, even if they have a different number of dots. This normal -notation for some types of polyphonic music. ") +notation for some types of polyphonic music. +merge-differently-dotted only applies to opposing stem dirs +(ie. Voice 1 & 2).") (minimum-length-fraction ,number? "Minimum length of ledger line as fraction of note head size.") (minimum-distance ,ly:dimension? "Minimum distance between rest and notes or beam.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 6080fb021b..c4246b6589 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -20,8 +20,9 @@ (Accidental . ( (avoid-slur . inside) + (glyph-name-alist . ,standard-alteration-glyph-name-alist) + (alteration . ,accidental-interface::calc-alteration) (stencil . ,ly:accidental-interface::print) - (stencils . ,ly:accidental-interface::calc-stencils) (after-line-breaking . ,ly:accidental-interface::after-line-breaking) (meta . ((class . Item) @@ -31,8 +32,9 @@ . ( (avoid-slur . inside) (parenthesized . #t) + (glyph-name-alist . ,standard-alteration-glyph-name-alist) + (alteration . ,accidental-interface::calc-alteration) (stencil . ,ly:accidental-interface::print) - (stencils . ,ly:accidental-interface::calc-stencils) (after-line-breaking . ,ly:accidental-interface::after-line-breaking) (meta . ((class . Item) @@ -49,12 +51,13 @@ ,(ly:make-simple-closure (list ly:self-alignment-interface::x-aligned-on-self))))) (self-alignment-X . ,CENTER) (font-size . -2) + (glyph-name-alist . ,standard-alteration-glyph-name-alist) + (alteration . ,accidental-interface::calc-alteration) (Y-offset . ,ly:side-position-interface::y-aligned-side) (direction . ,UP) (staff-padding . 0.25) (outside-staff-priority . 0) (script-priority . 0) - (stencils . ,ly:accidental-interface::calc-stencils) (side-axis . ,X) (meta . ((class . Item) (interfaces . (side-position-interface @@ -117,8 +120,7 @@ (X-offset . ,ly:side-position-interface::x-aligned-side) (direction . ,LEFT) (stencil . ,ly:accidental-interface::print) - (stencils . ,ly:accidental-interface::calc-stencils) - + (glyph-name-alist . ,standard-alteration-glyph-name-alist) (after-line-breaking . ,ly:accidental-interface::after-line-breaking) (side-axis . ,X) (meta . ((class . Item) @@ -795,6 +797,7 @@ (KeyCancellation . ( (stencil . ,ly:key-signature-interface::print) + (glyph-name-alist . ,cancellation-glyph-name-alist) (space-alist . ( (time-signature . (extra-space . 1.25)) (staff-bar . (extra-space . 0.6)) @@ -814,6 +817,7 @@ . ( (stencil . ,ly:key-signature-interface::print) (avoid-slur . inside) + (glyph-name-alist . ,standard-alteration-glyph-name-alist) (space-alist . ( (time-signature . (extra-space . 1.15)) (staff-bar . (extra-space . 1.1)) @@ -1881,7 +1885,7 @@ (font-size . -4) (side-axis . ,X) (stencil . ,ly:accidental-interface::print) - (stencils . ,ly:accidental-interface::calc-stencils) + (glyph-name-alist . ,standard-alteration-glyph-name-alist) (meta . ((class . Item) (interfaces . (item-interface trill-pitch-accidental-interface diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 191b24422f..436d2c2378 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -1032,39 +1032,40 @@ recommend font for this is bold and italic" (define-builtin-markup-command (doublesharp layout props) () "Draw a double sharp symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.4"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get 1 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (sesquisharp layout props) () "Draw a 3/2 sharp symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.3"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get 3/4 standard-alteration-glyph-name-alist "")))) + (define-builtin-markup-command (sharp layout props) () "Draw a sharp symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.2"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get 1/2 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (semisharp layout props) () "Draw a semi sharp symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.1"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get 1/4 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (natural layout props) () "Draw a natural symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.0"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get 0 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (semiflat layout props) () "Draw a semiflat." - (interpret-markup layout props (markup #:musicglyph "accidentals.M1"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get -1/4 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (flat layout props) () "Draw a flat symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.M2"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get -1/2 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (sesquiflat layout props) () "Draw a 3/2 flat symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.M3"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get -3/4 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (doubleflat layout props) () "Draw a double flat symbol." - (interpret-markup layout props (markup #:musicglyph "accidentals.M4"))) + (interpret-markup layout props (markup #:musicglyph (assoc-get -1 standard-alteration-glyph-name-alist "")))) (define-builtin-markup-command (with-color layout props color arg) (color? markup?) "Draw @var{arg} in color specified by @var{color}" @@ -1098,7 +1099,7 @@ recommend font for this is bold and italic" (define-builtin-markup-command (musicglyph layout props glyph-name) (string?) "This is converted to a musical symbol, e.g. @code{\\musicglyph -#\"accidentals.0\"} will select the natural sign from the music font. +#\"accidentals.natural\"} will select the natural sign from the music font. See @usermanref{The Feta font} for a complete listing of the possible glyphs." (ly:font-get-glyph (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)) @@ -1167,30 +1168,42 @@ figured bass notation" (num-x (interval-widen (ly:stencil-extent number-stencil X) (* mag 0.2))) (num-y (ly:stencil-extent number-stencil Y)) - (slash-stencil - (ly:make-stencil - `(draw-line - ,thickness - ,(car num-x) ,(- (interval-center num-y) dy) - ,(cdr num-x) ,(+ (interval-center num-y) dy)) - num-x num-y - ))) - - (ly:stencil-add number-stencil - (cond - ((= num 5) (ly:stencil-translate slash-stencil - ;;(cons (* mag -0.05) (* mag 0.42)) - (cons (* mag -0.00) (* mag -0.07)) - - )) - ((= num 7) (ly:stencil-translate slash-stencil - ;;(cons (* mag -0.05) (* mag 0.42)) - (cons (* mag -0.00) (* mag -0.15)) - - )) - - (else slash-stencil))) - )) + (is-sane (and (interval-sane? num-x) (interval-sane? num-y))) + + (slash-stencil + (if is-sane + (ly:make-stencil + `(draw-line + ,thickness + ,(car num-x) ,(- (interval-center num-y) dy) + ,(cdr num-x) ,(+ (interval-center num-y) dy)) + num-x num-y) + #f))) + + (set! slash-stencil + (cond + ((not (ly:stencil? slash-stencil)) #f) + ((= num 5) (ly:stencil-translate slash-stencil + ;;(cons (* mag -0.05) (* mag 0.42)) + (cons (* mag -0.00) (* mag -0.07)) + + )) + ((= num 7) (ly:stencil-translate slash-stencil + ;;(cons (* mag -0.05) (* mag 0.42)) + (cons (* mag -0.00) (* mag -0.15)) + + )) + + (else slash-stencil))) + + (if slash-stencil + (set! number-stencil + (ly:stencil-add number-stencil slash-stencil)) + + (ly:warning "invalid number for slashed digit ~a" num)) + + + number-stencil)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; the note command. diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 23d0f10dfc..5ea57cc7fc 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -487,7 +487,10 @@ (let* ((xext (ly:stencil-extent dump-me X)) (yext (ly:stencil-extent dump-me Y)) - (left-overshoot (ly:get-option 'eps-box-padding)) + (padding (ly:get-option 'eps-box-padding)) + (left-overshoot (if (number? padding) + (* -1 padding (ly:output-def-lookup paper 'mm)) + #f)) (bbox (map (lambda (x) diff --git a/scm/lily.scm b/scm/lily.scm index 7f73a3dfde..bd6a95be44 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -29,18 +29,21 @@ ensure that all refs to parsed objects are dead. This is an internal option, an (debug-skylines #f "debug skylines") (delete-intermediate-files #f "delete unusable PostScript files") - (dump-signatures #f "dump output signatures of each system") + (dump-profile #f "dump timing information for each file") (dump-tweaks #f "dump page layout and tweaks for each score having the tweak-key layout property set.") + (dump-signatures #f "dump output signatures of each system") + + (eps-box-padding #f "Pad EPS bounding box left edge by this much to guarantee alignment between systems") + (gs-load-fonts #f "load fonts via Ghostscript.") + (gui #f "running from gui; redirect stderr to log file") + (include-book-title-preview #t "include book-titles in preview images.") (include-eps-fonts #t "Include fonts in separate-system EPS files.") (job-count #f "Process in parallel") - - (eps-box-padding #f "Pad EPS bounding box left edge by this much to guarantee alignment between systems") - - (gui #f "running from gui; redirect stderr to log file") (log-file #f "redirect output to log FILE.log") + (old-relative #f "relative for simultaneous music works similar to chord syntax") @@ -348,6 +351,33 @@ The syntax is the same as `define*-public'." (,symbol? . "symbol") (,vector? . "vector"))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; timing + +(define (profile-measurements) + (let* ((t (times)) + (stats (gc-stats))) + + (list + (- (+ (tms:utime t) + (tms:stime t)) + (ly:assoc-get 'gc-time-taken stats)) + + ;; difficult to put memory amount stats into here. + + ))) + +(define (dump-profile name last this) + (let* + ((outname (format "~a.profile" (basename name ".ly"))) + (diff (map (lambda (y) (apply - y)) (zip this last)))) + + (display diff) + (ly:progress "\nWriting timing to ~a..." outname) + (format (open-file outname "w") + "time: ~a" + (car diff)))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; debug mem leaks @@ -540,19 +570,20 @@ The syntax is the same as `define*-public'." )) (let* ((failed '()) - (first #t) + (start-measurements #f) (handler (lambda (key failed-file) (set! failed (append (list failed-file) failed))))) (for-each (lambda (x) - ;; We don't carry info across file boundaries - (if first - (set! first #f) - (gc)) - + (gc) + (set! start-measurements (profile-measurements)) (lilypond-file handler x) + (if (ly:get-option 'dump-profile) + (dump-profile x start-measurements (profile-measurements))) + + (ly:clear-anonymous-modules) (if (ly:get-option 'debug-gc) (dump-gc-protects) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 37f965d94f..19f3c61345 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -303,16 +303,120 @@ centered, X==1 is at the right, X == -1 is at the left." (define-public darkmagenta '(0.5 0.0 0.5)) (define-public darkyellow '(0.5 0.5 0.0)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; key signature + + +(define-public (key-signature-interface::alteration-position step alter c0-position) + ;; TODO: memoize - this is mostly constant. + + ;; fes, ges, as and bes typeset in lower octave + (define FLAT_TOP_PITCH 2) + + ;; ais and bis typeset in lower octave + (define SHARP_TOP_PITCH 4) + + (if (pair? step) + (+ (cdr step) (* (car step) 7) c0-position) + (let* + ((from-bottom-pos (modulo (+ 4 49 c0-position) 7)) + (p step) + (c0 (- from-bottom-pos 4))) + + (if + (or (and (< alter 0) (or (> p FLAT_TOP_PITCH) (> (+ p c0) 4)) (> (+ p c0) 1)) + (and (> alter 0) (or (> p SHARP_TOP_PITCH) (> (+ p c0) 5)) (> (+ p c0) 2)) + ) + + ;; Typeset below c_position + (set! p (- p 7))) + + ;; Provide for the four cases in which there's a glitch + ;; it's a hack, but probably not worth + ;; the effort of finding a nicer solution. + ;; --dl. + (cond + ((and (= c0 2) (= p 3) (> alter 0)) + (set! p (- p 7))) + ((and (= c0 -3) (= p -1) (> alter 0)) + (set! p (+ p 7))) + ((and (= c0 -4) (= p -1) (< alter 0)) + (set! p (+ p 7))) + ((and (= c0 -2) (= p -3) (< alter 0)) + (set! p (+ p 7)))) + + (+ c0 p)))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; accidentals + +(define-public (accidental-interface::calc-alteration grob) + (ly:pitch-alteration (ly:event-property (event-cause grob) 'pitch))) + + +(define-public cancellation-glyph-name-alist + '((0 . "accidentals.natural"))) + +(define-public standard-alteration-glyph-name-alist + '( + ;; ordered for optimal performance. + (0 . "accidentals.natural") + (-1/2 . "accidentals.flat") + (1/2 . "accidentals.sharp") + + (1 . "accidentals.doublesharp") + (-1 . "accidentals.flatflat") + + (3/4 . "accidentals.sharp.slashslash.stemstemstem") + (1/4 . "accidentals.sharp.slashslash.stem") + (-1/4 . "accidentals.mirroredflat") + (-3/4 . "accidentals.mirroredflat.flat") + )) + +(define-public makam-alteration-glyph-name-alist + '((1 . "accidentals.doublesharp") + (8/9 . "accidentals.sharp.slashslashslash.stemstem") + (5/9 . "accidentals.sharp.slashslashslash.stem") + (4/9 . "accidentals.sharp") + (1/9 . "accidentals.sharp.slashslash.stem") + (0 . "accidentals.natural") + (-1/9 . "accidentals.mirroredflat") + (-4/9 . "accidentals.flat.slash") + (-5/9 . "accidentals.flat") + (-8/9 . "accidentals.flat.slashslash") + (-1 . "accidentals.flatflat") + )) + +(define-public alteration-hufnagel-glyph-name-alist + '((1/2 . "accidentals.hufnagel-1") + (0 . "accidentals.vaticana0") + (-1/2 . "accidentals.mensural1"))) + +(define-public alteration-medicaea-glyph-name-alist + '((1/2 . "accidentals.medicaea-1") + (0 . "accidentals.vaticana0") + (-1/2 . "accidentals.mensural1"))) + +(define-public alteration-vaticana-glyph-name-alist + '((1/2 . "accidentals.vaticana-1") + (0 . "accidentals.vaticana0") + (-1/2 . "accidentals.mensural1"))) + +(define-public alteration-mensural-glyph-name-alist + '((1/2 . "accidentals.mensural-1") + (0 . "accidentals.vaticana0") + (-1/2 . "accidentals.mensural1"))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; * Pitch Trill Heads ;; * Parentheses (define-public (parentheses-item::calc-parenthesis-stencils grob) - (let* ( - (font (ly:grob-default-font grob)) + (let* ((font (ly:grob-default-font grob)) (lp (ly:font-get-glyph font "accidentals.leftparen")) - (rp (ly:font-get-glyph font "accidentals.rightparen")) - ) + (rp (ly:font-get-glyph font "accidentals.rightparen"))) (list lp rp))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index a50f82d639..9a65b0c5e5 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -65,10 +65,16 @@ (/ (round (* 10000 num)) 10000)) (define (str4 num) - (format #f "~f" (round4 num))) + (if (or (nan? num) (inf? num)) + (begin + (ly:warning (_ "Found infinity or nan in output. Substituting 0.0")) + "0.0") + (format #f "~f" (round4 num)))) (define (number-pair->string4 numpair) - (format #f "~f ~f" (round4 (car numpair)) (round4 (cdr numpair)))) + (string-append (str4 (car numpair)) + " " + (str4 (cdr numpair)))) (define (numbers->string4 numlist) (string-join (map str4 numlist) " ")) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 472101b8b5..89a974879e 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -80,7 +80,6 @@ _ ("Process LilyPond snippets in hybrid HTML, LaTeX, texinfo or DocBook document authors = ('Jan Nieuwenhuizen ', 'Han-Wen Nienhuys ') - ################################################################ def exit (i): if global_options.verbose: @@ -139,11 +138,19 @@ def get_option_parser (): metavar=_ ("DIR"), action='append', dest='include_path', default=[os.path.abspath (os.getcwd ())]) + + p.add_option ('--left-padding', + metavar=_("PAD"), + dest="padding_mm", + help="Pad left side of music to align music inspite of uneven bar numbers. (in mm)", + type="float", + default=3.0) p.add_option ("-o", '--output', help=_ ("write output to DIR"), metavar=_ ("DIR"), action='store', dest='output_name', default='') + p.add_option ('-P', '--process', metavar=_ ("COMMAND"), help = _ ("process ly_files using COMMAND FILE..."), action='store', @@ -698,6 +705,8 @@ PREAMBLE_LY = '''%%%% Generated by %(program_name)s #(define dump-extents #t) %(font_dump_setting)s %(paper_string)s + force-assignment = #"" + line-width = #(- line-width (* mm %(padding_mm)f)) } \layout { @@ -1052,7 +1061,7 @@ class Lilypond_snippet (Snippet): '\n ') % vars () preamble_string = string.join (compose_dict[PREAMBLE], '\n ') % override - + padding_mm = global_options.padding_mm font_dump_setting = '' if FONTLOAD in self.option_dict: font_dump_setting = '#(define-public force-eps-font-include #t)\n' @@ -1762,6 +1771,22 @@ def do_options (): return args +def psfonts_warning (options, basename): + if options.format in (TEXINFO, LATEX): + psfonts_file = os.path.join (options.output_name, basename + '.psfonts') + output = os.path.join (options.output_name, basename + '.dvi' ) + + if not options.create_pdf: + if not options.psfonts: + warning (_ ("option --psfonts not used")) + warning (_ ("processing with dvips will have no fonts")) + else: + progress ('\n') + progress (_ ("DVIPS usage:")) + progress ('\n') + progress (" dvips -h %(psfonts_file)s %(output)s" % vars ()) + progress ('\n') + def main (): # FIXME: 85 lines of `main' macramee?? files = do_options () @@ -1790,15 +1815,16 @@ def main (): if global_options.format in (TEXINFO, LATEX): ## prevent PDF from being switched on by default. global_options.process_cmd += ' --formats=eps ' - - if (global_options.format in (TEXINFO, LATEX) - and global_options.create_pdf): - global_options.process_cmd += "--pdf -dinclude-eps-fonts -dgs-load-fonts " + if global_options.create_pdf: + global_options.process_cmd += "--pdf -dinclude-eps-fonts -dgs-load-fonts " if global_options.verbose: global_options.process_cmd += " --verbose " - global_options.process_cmd += " -dread-file-list -deps-box-padding=-3 " + if global_options.padding_mm: + global_options.process_cmd += " -deps-box-padding=%f " % global_options.padding_mm + + global_options.process_cmd += " -dread-file-list " identify () @@ -1822,19 +1848,7 @@ def main (): except Compile_error: exit (1) - if global_options.format in (TEXINFO, LATEX): - psfonts_file = os.path.join (global_options.output_name, basename + '.psfonts') - output = os.path.join (global_options.output_name, basename + '.dvi' ) - - if not global_options.psfonts and not global_options.create_pdf: - warning (_ ("option --psfonts not used")) - warning (_ ("processing with dvips will have no fonts")) - else: - progress ('\n') - progress (_ ("DVIPS usage:")) - progress ('\n') - progress (" dvips -h %(psfonts_file)s %(output)s" % vars ()) - progress ('\n') + psfonts_warning (global_options, basename) inputs = note_input_file ('') inputs.pop () diff --git a/stepmake/stepmake/generic-rules.make b/stepmake/stepmake/generic-rules.make index 1a19a4dc88..2500d80d41 100644 --- a/stepmake/stepmake/generic-rules.make +++ b/stepmake/stepmake/generic-rules.make @@ -1,9 +1,6 @@ $(outdir)/%: %.m4 $(M4) $< > $@ -%.dep: - touch $@ - %.gz: % gzip -c9 $< > $@ diff --git a/stepmake/stepmake/metafont-rules.make b/stepmake/stepmake/metafont-rules.make index 2ccf2f7b2c..b33bd10be6 100644 --- a/stepmake/stepmake/metafont-rules.make +++ b/stepmake/stepmake/metafont-rules.make @@ -1,4 +1,3 @@ - # Don't remove $(outdir)/.log's. Logs are a target! # we want to see botched results as well. @@ -8,25 +7,11 @@ $(outdir)/%.dvi: %.mf mv $(basename $<).dvi $(outdir) rm $(basename $<).*gf -# This is not metafont, this is feta-specific -$(outdir)/%.log: %.mf - MFINPUTS=$(src-dir) $(METAFONT) "\mode:=$(MFMODE); nonstopmode; input $<;" - mv $(@F) $@ - rm $(basename $(@F)).*gf - -$(outdir)/%.tfm $(outdir)%.log: %.mf +$(outdir)/%.tfm $(outdir)/%.log: %.mf MFINPUTS=$(src-dir) $(METAFONT) "\mode:=$(MFMODE); nonstopmode; input $<;" # Let's keep this log output, it saves another mf run. mv $(basename $(@F)).log $(basename $(@F)).tfm $(outdir) - rm $(basename $(@F)).*gf - -$(outdir)/%.$(XPM_RESOLUTION)gf: %.mf - MFINPUTS=$(src-dir) $(METAFONT) "\\mode=$(XPM_MODE); \\input $<" -# Let's keep this log output, it saves another mf run. - mv $(@F) $(basename $(@F)).log $(basename $(@F)).tfm $(outdir) - -$(outdir)/%.$(XPM_RESOLUTION)pk: $(outdir)/%.$(XPM_RESOLUTION)gf - gftopk $< $@ + rm -f $(basename $(@F)).*gf $(basename $(@F)).*pk MFTRACE_FORMATS = pfa pfb svg @@ -36,7 +21,3 @@ $(outdir)/%.pfb $(outdir)/%.svg $(outdir)/%.pfa: %.mf -mv $(basename $(@F)).pfa $(outdir) -mv $(basename $(@F)).pfb $(outdir) -mv $(basename $(@F)).svg $(outdir) - -#%.afm: -# $(SHELL) $(depth)/buildscripts/tfmtoafm.sh $(shell basename $@ .afm) -# mv $@ $@.in diff --git a/stepmake/stepmake/metafont-targets.make b/stepmake/stepmake/metafont-targets.make index 616e5868a7..dfaf2c18ce 100644 --- a/stepmake/stepmake/metafont-targets.make +++ b/stepmake/stepmake/metafont-targets.make @@ -3,10 +3,5 @@ tfm: $(TFM_FILES) dvi: $(DVI_FILES) -pks: $(addprefix $(outdir)/, $(XPM_FONTS:%=%.$(XPM_RESOLUTION)pk)) - -xpms: $(addprefix $(outdir)/, $(XPM_FONTS:%=%.afm)) pks - $(foreach i, $(XPM_FONTS), $(SHELL) $(depth)/buildscripts/mf-to-xpms.sh $(i) && ) true - pfb: $(PFB_FILES) diff --git a/stepmake/stepmake/metafont-vars.make b/stepmake/stepmake/metafont-vars.make index c1636f1c9f..db3722edcd 100644 --- a/stepmake/stepmake/metafont-vars.make +++ b/stepmake/stepmake/metafont-vars.make @@ -7,14 +7,5 @@ MF_LOG_FILES = $(addprefix $(outdir)/, $(FONT_FILES:.mf=.log)) DVI_FILES += $(MF_DVI_FILES) TFM_FILES += $(MF_TFM_FILES) -# XPM_MODE=sun -# XPM_RESOLUTION=85 - -# XPM_MODE=declarge -# XPM_RESOLUTION=100 - -XPM_MODE=ibmvga -XPM_RESOLUTION=110 - diff --git a/stepmake/stepmake/test-vars.make b/stepmake/stepmake/test-vars.make index 97a1c6b443..ffd57d480b 100644 --- a/stepmake/stepmake/test-vars.make +++ b/stepmake/stepmake/test-vars.make @@ -4,4 +4,4 @@ O_FILES := $(filter-out $(outdir)/test%, $(O_FILES)) TEST_EXECUTABLE = $(outdir)/test-$(NAME) TEST_MODULE_LIBES =$(addprefix $(outdir)/../, $(addsuffix /$(outbase)/library.a, $(TEST_MODULE_LIBS))) -TEST_LOADLIBES = $(TEST_MODULE_LIBES) $(LOADLIBES) -lboost_unit_test_framework +TEST_LOADLIBES = $(TEST_MODULE_LIBES) $(LOADLIBES)