********
-[Linux Intel, EGCS-1.1b]
-
-Compiling with -O2 -finline-functions will cause crashes during
-parsing stage.
-
-
[Linux ppc, egcs-1.0.2]
All compiling with -O2 is suspect, in particular guile-1.3, and
Please follow the documentation Cygnus has on there web site for
downloading and installing. The important part is that you down load
-the entire development kit. I believe it is file(cdk.exe). The
+the entire development kit. I believe it is file(full.exe). The
installation will ask you where you want to install it. I will refer
-to Cygnus installation directory as file(/gnuwin32/b19). There should be a
-file(README) file that contains installation instructions. After the
-installation is complete you should have a em(Cygnus) shortcut in your
-em(Program) section of your em(Start Menu). This shortcut is your
-door to the tt(UNIX) world and I will refer to the resulting window
-as a file(bash) shell.
+to Cygnus installation directory as file(/gnuwin32/cygwin-b20). There
+should be a file(README) file that contains installation instructions.
+After the installation is complete you should have a em(Cygnus)
+shortcut in your em(Program) section of your em(Start Menu). This
+shortcut is your door to the tt(UNIX) world and I will refer to the
+resulting window as a file(bash) shell.
-The shortcut points to file(/gnuwin32/b19/cygnus.bat). The following
-is my file(cygnus.bat) file.
+The shortcut points to file(/gnuwin32/cygwin-b20/cygnus.bat). The
+following is my file(cygnus.bat) file.
verb(
@ECHO OFF
SET MAKE_MODE=unix
SET LOCAL_ROOT=d:\gnuwin32
SET LOCAL_FS=d:/gnuwin32
-SET LOCAL_DIR=/gnuwin32
-SET CYGROOT=%LOCAL_ROOT%\b19
-SET CYGFS=%LOCAL_FS%/b19
-SET GCC_EXEC_PREFIX=%CYGROOT%\H-i386-cygwin32\lib\gcc-lib\
+SET LOCAL_DIR=d:/gnuwin32/cygwin-b20
+SET CYGROOT=%LOCAL_ROOT%\cygwin-b20
+SET CYGFS=%LOCAL_FS%/cygwin-b20
SET TCL_LIBRARY=%CYGROOT%\share\tcl8.0\
-SET GDBTK_LIBRARY=%CYGFS%/share/gdbtcl
+rem
rem This was not in the original but is needed by lots of packages
+rem
SET BISON_SIMPLE=%CYGFS%/share/bison.simple
+rem
rem I place the cygnus stuff in front of /WINNT
-SET PATH=d:\bin;%CYGROOT%\H-i386-cygwin32\bin;%PATH%
-SET MANPATH=%LOCAL_ROOT%\man;%LOCAL_ROOT%\b19\man;%LOCAL_ROOT%\b19\cdk-man\man;%LOCAL_ROOT%\a2ps-4.10\man
-SET INFOPATH=%LOCAL_FS%/b19/cdk-man/info;%LOCAL_FS%/b19/info;%LOCAL_DIR%/info
-SET PATH=%PATH%;%LOCAL_ROOT%\bin
+rem
+SET PATH=d:\bin;%LOCAL_ROOT%\bin;%CYGROOT%\H-i586-cygwin32\bin;%PATH%
+SET MANPATH=%LOCAL_ROOT%\man;%LOCAL_ROOT%\cygwin-b20\full-man\man
+SET INFOPATH=%LOCAL_FS%/cygwin-b20/full-man/info;%LOCAL_FS%/cygwin-b20/info;%LOCAL_DIR%/info
rem General tools not included with Cygnus Development Kit
-
rem CVS
SET PATH=%PATH%;%LOCAL_ROOT%\cvs-1.9.28\bin
include alot of the packages listed. We will be installing some of
these.
-There is also some discussion of how you want to em(mount) the Cygnus
-development kit. em(mount) is a tt(UNIX) term that refers to the
-mechanism used to provide a disk resource to the filesystem. Cygnus
-supplies a mechinism for em(mounting) a filesystem as a tt(DOS) like
-resource or a tt(UNIX) like resource. Among other things this
-attempts to deal with the text file carriage return line feed on
-tt(DOS) versus the line feed on tt(UNIX) and the issue that tt(DOS)
-has two file types, text and binary. Where tt(UNIX) deals with a
-single streams type. I have used the default out of the box
-configuration with no problems. We will however later discuss
-mounting a directory as a binary resource ref(binary).
The installation also suggests that you create a directory file(/bin)
-and copy file(/gnuwin32/b19/H-i386-cygwin32/bin/sh.exe) to file(/bin).
-The file(sh.exe) shell provided by Cygnus is a descendant of the
-file(ash) shell and I have found that some of the tt(GNU) products
-configure/installations work better with the file(bash) shell. So
-this is my recommendation for post installation steps. From a
+and copy file(/gnuwin32/cygwin-b20/H-i586-cygwin32/bin/sh.exe) to
+file(/bin). The file(sh.exe) shell provided by Cygnus is a descendant
+of the file(ash) shell. The file(sh.exe) shell has improved greatly
+and is much faster than the file(bash) shell for script invocations.
+So this is my recommendation for post installation steps. From a
file(bash) shell:
itemize(
it()code(cd /)
it()code(mkdir bin)
it()code(cd /bin)
-it()code(cp /gnuwin32/b19/H-i386-cygwin32/bin/bash.exe sh.exe)
+it()code(cp /gnuwin32/cygwin-b20/H-i586-cygwin32/bin/sh.exe sh.exe)
+it()code(cp /gnuwin32/cygwin-b20/H-i586-cygwin32/bin/bash.exe bash.exe)
it()code(cd /)
it()code(mkdir /tmp)
it()code(chmod a+rwx tmp)
it()code(mkgroup -l > group)
)
-subsubsect(Ecgs Compiler, assembler, and linker)
-lurl(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs.html)
-
-
-Cygnus recommends using the ecgs compiler. I do too. Follow the
-instructions from the above site to install ecgs compiler/linker and
-the gas assembler. We have attempted to compile lilypond with the
-Cygnus default compiler/linker with poor results. So for lilypond
-anyway this step is a requirement.
+subsubsubsect(Binary Mounts) label(binary)
-I took the following steps to download and install the ecgs suite.
-Keep in mind that it is better to follow the instructions from the
-indicated website.
+There is also some discussion of how you want to em(mount) the Cygnus
+development kit. em(mount) is a tt(UNIX) term that refers to the
+mechanism used to provide a disk resource to the filesystem. Cygnus
+supplies a mechinism for em(mounting) a filesystem as a tt(DOS) like
+resource or a tt(UNIX) like resource. Among other things this
+attempts to deal with the text file carriage return line feed on
+tt(DOS) versus the line feed on tt(UNIX) and the issue that tt(DOS)
+has two file types, text and binary. Where tt(UNIX) deals with a
+single streams type. My opinion on this matter currently is to use
+binary mounts only. This can be accomplished by:
itemize(
-it()download
-url(egcs-1.0.2-cygb19.tar.gz)(ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin32/b19-releases/egcs-1.0.2-cygb19.tar.gz)
-to /tmp
-it()download
-url(gas-980303-cygb19.tar.gz)(ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin32/b19-releases/gas-980303-cygb19.tar.gz)
-to /tmp
-it() read
-url(INSTALL)(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs-cygb19-install.html)
+it() From a bash shell, umount /
+it() mount -b d: /
)
-In a bash shell
-itemize(
-it() cd $CYGFS/include
-it() mv g++ g++-b19
-it() cd $CYGFS
-it() tar zxf /tmp/gas-980303-cygb19.tar.gz
-it() tar zxf /tmp/egcs-1.0.2-cygb19.tar.gz
-)
+If you have other disks that you intend to use for data generated by
+cygnus tools you will have to mount those devices with the em(-b)
+switch.
+
+
+subsubsect(Ecgs Compiler, assembler, and linker)
+lurl(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs.html)
-You now have a compiler, assembler, linker combination capable of
-compiling lilypond.
+Cygnus now distributes the ecgs compiler with cygwin-b20.
subsubsect(bf(GNU)'s Internationalization Package)
lurl(http://www.gnu.org/order/ftp.html)
verb(
#!/bin/sh
-realinstall=/gnuwin32/b19/H-i386-cygwin32/bin/install.exe
+realinstall=/gnuwin32/cygwin-b20/H-i586-cygwin32/bin/install.exe
args=''
while [ $# -ne 0 ]
do
it() From a bash shell, cd ~/usr/src.
it() tar zxf gettext-0.10.tar.gz
it() cd gettext-0.10
-it() ./configure --prefix=$CYGFS/H-i386-cygwin32
+it() ./configure --prefix=$CYGFS/H-i586-cygwin32
it() make
it() make install
)
description(
dit(releases/) Downloaded and generated releases live here. For
-example file(yodl-1.30.0.pre12.tar.gz) and
-file(lilypond-0.1.81.tar.gz).
+example file(yodl-1.31.7.tar.gz) and file(lilypond-1.1.17.tar.gz).
dit(patches/) Downloaded and generated patches live here. For
-example file(yodl-1.30.0.pre12.diff.gz) and
-file(lilypond-0.1.81.diff.gz).
+example file(yodl-1.31.7.diff.gz) and file(lilypond-1.1.17.diff.gz).
dit(test/) This directory is used to generate releases and patches.
verb(\
rem yodl
-SET PATH=%PATH%;%LOCAL_ROOT%\yodl-1.30.0.pre12\bin
+SET PATH=%PATH%;%LOCAL_ROOT%\yodl-1.31.7\bin
)
)
-subsubsubsect(Yodl build CAVEAT)
+subsubsect(guile)
+
+GUILE, GNU's Ubiquitous Intelligent Language for Extension, is a
+library that implements the Scheme language plus various convenient
+facilities. It's designed so that you can link it into an application
+or utility to make it extensible. GNU's plan is to link this library
+into all GNU programs that call for extensibility.
+
+itemize(
+it() download guile-1.3 patch from
+lurl(http://www.realtime.net/~daboys/lilypond/guile.patch) and save it
+to file(/tmp/guile.patch).
+it() download guile-1.3 from one of GNU's ftp sites.
+it() From a bash shell, tar zxf guile-1.3.tar.gz
+it() cd guile-1.3
+it() patch -p2 < /tmp/guile.patch
+it() LD=/gnuwin32/cygwin-b20/H-i586-cygwin32/bin/ld \ nl()
+ ./configure --prefix=$CYGFS/H-i586-cygwin32
+it() make sure bin_PROGRAMS macro in libguile/Makefile does em(not) have the
+.exe extension during the build
+it() make
+it() make sure bin_PROGRAMS in libguile/Makefile em(does) have the
+.exe extension during the install. Yuck.
+it() make install
+)
-em(yodl) uses the em(stepmake) package for it's build methodology.
-The build of em(stepmake) documentation will fail due to the fact
-that em(yodl) is not yet installed. This is normal and shouldn't be a
-problem.
subsubsect(LilyPond) label(lilybuild)
itemize(
it() tar zxf releases/lilypond-em(<version>).tar.gz
it() cd lilypond-em(<version>)
it() ./configure --prefix=/gnuwin32/lilypond-em(<version>) \ nl()
- --srcdir=. \ nl()
- --enable-tex-prefix=/gnuwin32/lilypond-em(<version>)/texmf \ nl()
- --enable-tex-dir=/gnuwin32/lilypond-em(<version>)/texmf/tex \ nl()
- --enable-mf-dir=/gnuwin32/lilypond-em(<version>)/texmf/mf nl()
+ --srcdir=. nl()
Since em(lilypond) is under development I choose to install it in a
version rooted directory. This allows me to test newly released
versions without losing a known working version.
verb(\
rem lilypond
-SET PATH=%PATH%;%LOCAL_ROOT%\lilypond-0.1.80\bin
+SET PATH=%PATH%;%LOCAL_ROOT%\lilypond-1.1.17\bin
)
)
it() obtain python source from lurl(http://www.python.org)
it() tar zxf /tmp/python-em(<version>).tar.gz
it() cd python-em(<version>)
-it() configure --prefix=/gnuwin32/python-em(<version>)
+it() configure --prefix=/gnuwin32/Python-em(<version>)
it() edit toplevel file(Makefile) code(EXE) macro so it reads code(EXE=.exe)
it() make
it() make install
link(Back to top)(contents)
clearpage()
+I'm back from the dead! There have been many changes since my last
+update. Please read information on batch files and update as needed.
+The fonts have changed so you will also need to remove any cached
+fonts. In addition please bring music sources up to date by using
+convert-mudela utility. I used:
+
+verb(
+% bf(convert-mudela.py -e angels.ly)
+)
+
+Also please refer to LilyPond documentation for new and changed
+features.
subsect(NEWS) label(news)
This is what the version @TOPLEVEL_VERSION@ brings:
subsect(Download) label(download)
itemize(
+ it() pre-guile version lurl(lilypond-1.0.17.jbr1.bin.zip) nl()
+ NOTE: LILYPONDPREFIX=em(LilyPond-dir) for this version
it()lurl(lilypond-@TOPLEVEL_VERSION@.bin.zip)
)
description(
dit(batch file)
In a batch file you can add the following entries: nl()
- bf(set LILYPONDPREFIX=em(LilyPond-dir)) nl()
- bf(set path=%path%;%LILYPONDPREFIX%\bin;em(MiKTeX-dir)\miktex\bin) nl()
- bf(set TEXINPUTS=%LILYPONDPREFIX%\share\lilypond\tex;;) nl()
- bf(set MFINPUTS=%LILYPONDPREFIX%\share\lilypond\mf;;) nl()
+ bf(set LILYPONDHOME=em(LilyPond-dir)) nl()
+ bf(set LILYPONDPREFIX=%LILYPONDHOME%\share\lilypond) nl()
+ bf(set path=%path%;%LILYPONDHOME%\bin;em(MiKTeX-dir)\miktex\bin) nl()
+ bf(set TEXINPUTS=%LILYPONDPREFIX%\tex;%LILYPONDPREFIX%\ps;;) nl()
+ bf(set MFINPUTS=%LILYPONDPREFIX%\mf;;) nl()
COMMENT( dit(Windows Environment)
In the Windows environment you can select
properties menu of the My Computer icon. Click on
+pl 17.jbr2
+ - Documentation/README-W32: Brought my stuff up to date
+ - Documentation/ntweb: updated for realease
+ - stepmake/bin/package-zip32.sh: cygwin-b20 changes
+ - scripts/ly2dvi.py: LILYPONDPREFIX fixes
+
+pl 17.jbr1
+ - scripts/ly2dvi.py root is now the shared directory path not the
+ root of the lily installation. Environment variable LILYPONDPREFIX
+ is also the path to shared directory.
+ - lily/main.cc WINNT conditional added to avoid a casting of
+ main_prog
+
+pl 17.hwn1
+ - bfs wtk1-fugue1
+ - spacing tweak: very widely and tightly spaced lines look
+better.
+ - allow Beam settings to be overriden: property
+ stemLeftBeamCount, stemRightBeamCount
+ - junked Assoc, Assoc_iter
+ - junked Graphical_element::{width,height}
+ - junked Plet_swallow_engraver, Plet_engraver
+ - Command_tie_engraver -> Tie_engraver, Command_beam_engraver -> Beam_engraver
+ - naming brew_molecule_p / do_brew_molecule -> output_processing, do_brew_molecule_p
+ - experimental Text_item, Staff_side
+ - junked old Beam_engraver and old Tie_engraver.
+ - AFM administration cleanup.
+ - cache brewed molecules. Speed up ?
+ - rehacked Graphical_element, introduced Dimension_cache
+
+********
+
+pl 17
pl 16.jcn2
- fix: TEMPO 4., well urg, "TEMPO 4 ."
- beginning of violino/violoncello (viola) duet
pl 16.jcn1
- resurrected po-stuff
+********
+pl 16
+
+*********
+pl 16
+
pl 15.uu1
- dynamic fix.
- junked abbrev stuff from parser.
-Features you cannot find in the doco as working, should be mentioned here.
+Features you cannot find in the doco as working, should be mentioned
+here.
This is an assorted collection of stuff that will be done, might be
done, or is an idea that I want to think about
Most of the items are marked in the code as well, with full explanation.
grep for TODO and ugh/ugr/urg
+ * scm-ify \property values.
+
+ * move class Lookup {} into scm
+
+ * read tfms too.
+
+ * update mi2mu for lilypond 1.1
+
BUGS:
+
+ * fix braces
+
+ * ly2dvi barfs on linewidth = -1.
+
+ * fix midi output.
+
* c4 \! \> c4
* tremolo stuff
* \breathmark TeX macro
- * configure error if GUILE 1.3 not found
-
- * configure error if no rtti (gcc 2.8 or egcs-1.1)
-
* catch GUILE errors?
* add new glyphs to font.ly
* $DEPENDENCIES_OUTPUT support
- * fix BUGs
-
* fix weird behaviour when .AFMs/.SCMs not found.
* Xdvi zooming ?! Try to understand GS garbage collection.
* midi esp.: use I32 iso int where 32 bits are needed (or assumed...)
- * Flower types:
- - A decent scalar type
-
* stafftypes: voice names/ instrument names.
* lily \tempo
dnl WARNING WARNING WARNING WARNING
dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
+dnl WARNING WARNING WARNING WARNING
+dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
+dnl WARNING WARNING WARNING WARNING
+dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
dnl aclocal.m4 -*-shell-script-*-
dnl StepMake subroutines for configure.in
AC_DEFUN(AC_STEPMAKE_GXX, [
# ugh autoconf
changequote(<<, >>)dnl
- if $CXX --version | grep '2\.[78]' > /dev/null ||
+ if $CXX --version | grep '2\.8' > /dev/null ||
$CXX --version | grep 'egcs' > /dev/null
changequote([, ])dnl
then
true
else
- AC_STEPMAKE_WARN(can\'t find g++ 2.7, 2.8 or egcs)
+ AC_STEPMAKE_WARN(can\'t find g++ 2.8 or egcs)
fi
])
# others need readline, dl (or even more)
# urg, must check for different functions in libguile
# to force new check iso reading from cache
- AC_CHECK_LIB(guile, scm_shell, \
+
+ # gh_scm2doubles,gh_doubles2scm are new in 1.3
+ AC_CHECK_LIB(guile, gh_scm2doubles, \
LIBS="-lguile $LIBS"; AC_DEFINE(HAVE_LIBGUILE), \
AC_CHECK_LIB(readline, readline) \
AC_CHECK_LIB(dl, dlopen) \
AC_CHECK_LIB(socket, socket)\
AC_CHECK_LIB(termcap,tgetent)\
AC_CHECK_LIB(m, fabs)\
- AC_CHECK_LIB(guile, scm_boot_guile)\
+ AC_CHECK_LIB(guile, gh_doubles2scm)\
)
- if test "$ac_cv_lib_guile_scm_shell" != yes -a \
- "$ac_cv_lib_guile_scm_boot_guile" != yes ; then
+ if test "$ac_cv_lib_guile_gh_scm2doubles" != yes -a \
+ "$ac_cv_lib_guile_gh_doubles2scm" != yes ; then
AC_STEPMAKE_WARN(You should install guile 1.3 or newer)
fi
])
*/
#include <fstream.h>
-#include "assoc.hh"
+#include "dictionary-iter.hh"
#include "dstream.hh"
#include "scalar.hh"
#include "text-db.hh"
#include "string-convert.hh"
-#include "assoc-iter.hh"
#include "rational.hh"
/// indent of each level
String cl (strip_member (mem));
String idx = cl;
- if (silent_assoc_p_->elem_b (mem))
+ if (silent_dict_p_->elem_b (mem))
idx = mem;
- else if (silent_assoc_p_->elem_b (cl))
+ else if (silent_dict_p_->elem_b (cl))
idx = cl;
else
{
- (*silent_assoc_p_)[idx] = default_silence_b_;
+ (*silent_dict_p_)[idx] = default_silence_b_;
}
- local_silence_b_ = (*silent_assoc_p_)[idx];
+ local_silence_b_ = (*silent_dict_p_)[idx];
if (current_classname_str_ != idx && !local_silence_b_)
{
current_classname_str_=idx;
- if (!(*silent_assoc_p_)["Dstream"])
+ if (!(*silent_dict_p_)["Dstream"])
*os_l_ << "[" << current_classname_str_ << ":]"; // messy.
}
return *this;
bool
Dstream::silent_b (String s) const
{
- if (!silent_assoc_p_->elem_b (s))
+ if (!silent_dict_p_->elem_b (s))
return false;
- return (*silent_assoc_p_)[s];
+ return (*silent_dict_p_)[s];
}
Dstream &
Dstream::Dstream (ostream *r, char const * cfg_nm)
{
os_l_ = r;
- silent_assoc_p_ = new Assoc<String,bool>;
+ silent_dict_p_ = new Dictionary<bool>;
default_silence_b_ = false;
indent_level_i_ = 0;
if (!os_l_)
r.message (_ ("Not enough fields in Dstream init."));
continue;
}
- (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1]));
+ (*silent_dict_p_)[r[0]] = (bool)(int)(Scalar (r[1]));
}
- if ((*silent_assoc_p_).elem_b ("Dstream_default_silence"))
- default_silence_b_ = (*silent_assoc_p_)["Dstream_default_silence"];
+ if ((*silent_dict_p_).elem_b ("Dstream_default_silence"))
+ default_silence_b_ = (*silent_dict_p_)["Dstream_default_silence"];
}
Dstream::~Dstream()
{
- delete silent_assoc_p_;
+ delete silent_dict_p_;
assert (!indent_level_i_) ;
}
void
Dstream::clear_silence()
{
- for (Assoc_iter<String, bool> i (*silent_assoc_p_); i.ok(); i++)
+ for (Dictionary_iter<bool> i (*silent_dict_p_); i.ok(); i++)
{
- i.val() = false;
+ i.val_ref() = false;
}
}
/*
path.cc - manipulation of paths and filenames.
*/
+
#include <stdio.h>
+
#include "config.hh"
#include "file-path.hh"
#include "flower-debug.hh"
-/** find a file.
+/** Find a file.
It will search in the current dir, in the construction-arg, and
in any other added path, in this order.
return result;
}
+
+unsigned int hash (unsigned int i)
+{
+ return i;
+}
+
+unsigned int hash (int i)
+{
+ return (unsigned) i;
+}
#include "dictionary.hh"
-
-
-#include "dictionary.hh"
-
-template<class V>
-class Dictionary_iter
+template<class K, class V>
+class Hash_table_iter
{
- Dictionary<V> *dict_l_;
+ Hash_table<K,V> *dict_l_;
int i;
public:
- Dictionary_iter(Dictionary<V> const &dict)
+ Hash_table_iter(Hash_table<K,V> const &dict)
{
i =0;
- dict_l_ =(Dictionary<V> *) & dict;
+ dict_l_ =(Hash_table<K,V> *) & dict;
next_used ();
}
next_used ();
}
- String key ()
+ K key ()
+ {
+ return dict_l_->fixed_p_->dict_arr_[i].key_;
+ }
+ V val ()
{
- return dict_l_->fixed_p_->dict_arr_[i].name_;
+ return dict_l_->fixed_p_->dict_arr_[i].value_;
}
- V val ()
+ V &val_ref ()
{
return dict_l_->fixed_p_->dict_arr_[i].value_;
}
};
-#endif // DICTIONARY_ITER_HH
+template<class V>
+class Dictionary_iter<V> : public Hash_table_iter<String,V>
+{
+public:
+ Dictionary_iter (Dictionary<V> const &d)
+ : Hash_table_iter<String,V> (d)
+ {
+
+ }
+
+
+};
+#endif // Hash_table_ITER_HH
#include "array.hh"
unsigned long prime_list (int idx);
-template<class V>
-struct Dict_entry
+template<class K, class V>
+struct Hash_table_entry
{
- String name_;
+ K key_;
V value_;
bool free_b_;
- Dict_entry() {
+ Hash_table_entry() {
free_b_ = true;
}
- Dict_entry (String s, V v)
+ Hash_table_entry (K s, V v)
{
- name_ = s;
+ key_ = s;
value_ = v;
free_b_ = false;
}
};
unsigned int hash (String);
+unsigned int hash (int);
+
+template<class V>
+struct Dict_initialiser
+{
+ char *key_;
+ V value_;
+};
/**
A hash table of prime size.
We use quadratic probing.
*/
-template<class V>
-class Fixed_size_dictionary
+template<class K, class V>
+class Fixed_size_hash_table
{
public:
- Array<Dict_entry<V> > dict_arr_;
+ Array<Hash_table_entry<K,V> > dict_arr_;
int size_idx_;
- Fixed_size_dictionary (int size_idx)
+ Fixed_size_hash_table (int size_idx)
{
size_idx_ = size_idx;
int sz = prime_list(size_idx_);
}
/// find #s#, or find first empty entry corresponding to #s#
- int lookup (String s)
+ int lookup (K s)
{
int sz =dict_arr_.size ();
int i = hash (s) % sz;
if (dict_arr_[i].free_b_)
return i;
- if (dict_arr_[i].name_ == s)
+ if (dict_arr_[i].key_ == s)
return i;
j++;
}
/// remove #s# from the hash table.
- V remove (String s)
+ V remove (K s)
{
assert (false); // Untested routine.
int sz =dict_arr_.size ();
int i = hash (s) % sz;
int j = 0;
V retval;
- while (j <= sz/2 && dict_arr_[i].name_ != s)
+ while (j <= sz/2 && dict_arr_[i].key_ != s)
{
assert (!dict_arr_[i].free_b_);
/**
Hash table with sliding sizes.
*/
-template<class V>
-class Dictionary
+template<class K, class V>
+class Hash_table
{
- Fixed_size_dictionary<V> * fixed_p_;
+ Fixed_size_hash_table<K,V> * fixed_p_;
/// set size to next prime, and copy contents
void enlarge ()
{
- Fixed_size_dictionary<V> *f = new Fixed_size_dictionary<V> (fixed_p_->size_idx_ +1);
+ Fixed_size_hash_table<K,V> *f = new Fixed_size_hash_table<K,V> (fixed_p_->size_idx_ +1);
for (int i=0; i < fixed_p_->dict_arr_.size(); i++)
{
if (fixed_p_->dict_arr_[i].free_b_)
continue;
- String nm (fixed_p_->dict_arr_[i].name_);
+ K nm (fixed_p_->dict_arr_[i].key_);
int nl = f->lookup (nm);
- f->dict_arr_[nl] = Dict_entry<V> (nm, fixed_p_->dict_arr_[i].value_);
+ f->dict_arr_[nl] = Hash_table_entry<K,V> (nm, fixed_p_->dict_arr_[i].value_);
}
delete fixed_p_;
fixed_p_ = f;
}
public:
- Dictionary ()
+ Hash_table ()
{
- fixed_p_ = new Fixed_size_dictionary<V> (0);
+ fixed_p_ = new Fixed_size_hash_table<K,V> (0);
}
- ~Dictionary ()
+ ~Hash_table ()
{
delete fixed_p_;
}
- void operator = (Dictionary<V> const &src)
+ void operator = (Hash_table<K,V> const &src)
{
if (&src == this)
return;
delete fixed_p_;
- fixed_p_ = new Fixed_size_dictionary<V> (*src.fixed_p_);
+ fixed_p_ = new Fixed_size_hash_table<K,V> (*src.fixed_p_);
}
- Dictionary (Dictionary<V> const &src)
+ Hash_table (Hash_table<K,V> const &src)
{
- fixed_p_ = new Fixed_size_dictionary<V> (*src.fixed_p_);
+ fixed_p_ = new Fixed_size_hash_table<K,V> (*src.fixed_p_);
}
- bool elem_b (String s) const
+
+ void clear ()
+ {
+ int i= fixed_p_->size_idx_;
+ delete fixed_p_;
+ fixed_p_ = new Fixed_size_hash_table<K,V> (i);
+ }
+ bool elem_b (K s) const
{
int l = fixed_p_->lookup (s);
/**
Find and return element. If #s# is not in the table, create an entry in the table, and init
*/
- V& elem (String s)
+ V& elem (K s)
{
int l;
while ((l= fixed_p_->lookup (s)) <0)
fixed_p_->dict_arr_[l].free_b_ = false;
- fixed_p_->dict_arr_[l].name_ = s;
+ fixed_p_->dict_arr_[l].key_ = s;
return fixed_p_->dict_arr_[l].value_;
}
- V elem (String s) const
+ V elem (K s) const
{
return const_elem (s);
}
- V const_elem (String k) const
+ V const_elem (K k) const
{
V retval;
if (elem_b (k))
- retval = ((Dictionary<V>*)this)->elem (k);
+ retval = ((Hash_table<K,V>*)this)->elem (k);
return retval;
}
- V& operator [] (String k)
+ V& operator [] (K k)
{
return elem (k);
}
- V operator [] (String k) const
+ V operator [] (K k) const
{
return const_elem (k);
}
- V remove (String s)
+ V remove (K s)
{
return fixed_p_->remove (s);
}
+ friend class Hash_table_iter<K,V>;
+};
+
+template<class V>
+class Dictionary : public Hash_table<String, V>
+{
+public:
+ Dictionary ()
+ {}
+ Dictionary (Dict_initialiser<V> *p)
+ {
+ for (Dict_initialiser<V> *q = p; q->key_; q++)
+ elem (q->key_) = q->value_;
+
+ }
+
friend class Dictionary_iter<V>;
};
const char eol= '\n';
-template<class K,class V>
-struct Assoc;
-
/** Debug stream.
a class for providing debug output of nested structures,
with indents according to \{\}()[].
bool default_silence_b_;
String current_classname_str_;
void output (String s);
- Assoc<String, bool> *silent_assoc_p_;
+ Dictionary<bool> *silent_dict_p_;
public:
void clear_silence();
template<class T> struct Array;
template<class T> struct sstack;
template<class T,class K> struct Assoc;
+template<class K, class V> struct Hash_table;
+template<class K, class V> struct Hash_table_iter;
+template<class T> struct Dictionary_iter;
template<class T> struct Dictionary;
template<class T> struct Dictionary_iter;
template<class T> struct List;
template<class T>
class Link_array : public Array<T*>
{
- static default_compare (T *const& p1, T *const&p2) {
- /* can't do p1 -p2, since T might be an incomplete type */
- if (p1 < p2)
- return -1 ;
- if (p2 < p1)
- return 1;
- return 0;
- }
+ static default_compare (T *const& p1, T *const&p2) {
+ /* can't do p1 -p2, since T might be an incomplete type */
+ if (p1 < p2)
+ return -1 ;
+ if (p2 < p1)
+ return 1;
+ return 0;
+ }
public:
- void substitute (T *old, T*new_l)
+ void substitute (T *old, T*new_l)
{
- int i;
- while ((i = find_i (old)) >=0)
- if (new_l)
- elem (i) =new_l;
- else
- del (i);
+ int i;
+ while ((i = find_i (old)) >=0)
+ if (new_l)
+ elem (i) =new_l;
+ else
+ del (i);
}
- void unordered_substitute (T* old, T * new_l)
+ void unordered_substitute (T* old, T * new_l)
{
- int i;
- while ((i = find_i (old)) >=0)
- if (new_l)
- elem (i) =new_l;
- else {
- unordered_del (i);
- }
+ int i;
+ while ((i = find_i (old)) >=0)
+ if (new_l)
+ elem (i) =new_l;
+ else {
+ unordered_del (i);
+ }
}
- void default_sort() {
- sort (default_compare);
- }
- void uniq() {
- Link_array<T> l_arr;
- for (int i=0; i < size(); i++)
- if (!i || elem (i-1) != elem (i))
- l_arr.push (elem (i));
- *this = l_arr;
- }
+ void default_sort() {
+ sort (default_compare);
+ }
+ void uniq() {
+ Link_array<T> l_arr;
+ for (int i=0; i < size(); i++)
+ if (!i || elem (i-1) != elem (i))
+ l_arr.push (elem (i));
+ *this = l_arr;
+ }
- int find_i (T const * t) const {
- for (int i=0; i < size(); i++)
- if (elem (i) == t)
- return i;
- return -1;
- }
- T *find_l (T const *t) const
+ int find_i (T const * t) const {
+ for (int i=0; i < size(); i++)
+ if (elem (i) == t)
+ return i;
+ return -1;
+ }
+ T *find_l (T const *t) const
{
- int i = find_i (t);
- if (i >= 0)
- return elem (i);
- else
- return 0;
+ int i = find_i (t);
+ if (i >= 0)
+ return elem (i);
+ else
+ return 0;
}
};
+template<class T, class V>
+Link_array<T>
+typecast_array (Link_array<V> const &a, T * /* dummy */ )
+{
+ Link_array<T> ret;
+ for (int i=a.size (); i-- ; )
+ ret.push (dynamic_cast<T*> (a[i])); // ugh?
+ return ret;
+}
+
+
#endif // PARRAY_HH
+
\consists "Separating_line_group_engraver";
\accepts "Voice";
+ dynamicStyle = "dynamic";
};
\translator{\StaffContext }
\consists "Rest_engraver";
\consists "Dot_column_engraver";
\consists "Stem_engraver";
-% \consists "Plet_engraver";
- \consists "Command_beam_engraver";
+ \consists "Beam_engraver";
\consists "Abbreviation_beam_engraver";
\consists "Multi_measure_rest_engraver";
+
+ % ugh. Order matters here.
+ \consists "Text_engraver";
\consists "Script_engraver";
\consists "Rhythmic_column_engraver";
\consists "Font_size_engraver";
\consists "Slur_engraver";
- \consists "Command_tie_engraver";
+ \consists "Tie_engraver";
\consists "Tuplet_engraver";
\consists "Note_heads_engraver" ;
\consists "Skip_req_swallow_translator";
\consists "Lyric_engraver";
\consists "Extender_engraver";
\consists "Beam_req_swallow_translator";
- \consists "Plet_swallow_engraver";
}
\translator {
%hmm, (these) abbrevs suck, imo
% i guess they're meant as some form of doco
% that's what i use them for...
-stemup = \notes {
- s1*0
- % Stupid hack to make < { \stemup } > work
+stemup =
\property Voice.ydirection = \up
- }
-stemboth= \notes {
- s1*0
- \property Voice.ydirection = \center
-}
-stemdown = \notes {
- s1*0
- \property Voice.ydirection = \down
-}
+stemboth= \property Voice.ydirection = \center
+stemdown = \property Voice.ydirection = \down
+
slurup = \notes {
s1*0
\property Voice.slurydirection = \up
table_eleven = \symboltables {
- \font "feta11.afm"
+ \font "feta11"
% index symbol #parameters xmin xmax ymin ymax
table_thirteen = \symboltables {
- \font "feta13.afm"
+ \font "feta13"
% index symbol #parameters xmin xmax ymin ymax
table_sixteen=
\symboltables {
- \font "feta16.afm"
+ \font "feta16"
% index symbol #parameters xmin xmax ymin ymax
table_twenty =
\symboltables {
- \font "feta20.afm"
+ \font "feta20"
% index symbol #parameters xmin xmax ymin ymax
table_twentysix = \symboltables {
- \font "feta26.afm"
+ \font "feta26"
% index symbol #parameters xmin xmax ymin ymax
Csus; Csus4 c-4; c-sus
%}
-scales = \notes\transpose c''\chords{
+scales = \notes \transpose c'' \chords{
%<c1 e g>
c1-m c-min c4-dim c-aug c-sus c-maj
c1-6 c4-7 c-9 c-11 c-13
--- /dev/null
+\header {
+opus = "BWV 937 (prelude)";
+composer = "J. S. Bach";
+source = "Petits Preludes et Fugues. Urtext. Editions Henry Lemoine, Paris.";
+}
+
+%{
+1. upon stretching: every note should stretch according to duration
+
+2. 8th notes should be spaced equidistantly.
+%}
+
+\score {
+ \notes \relative c''
+ \type GrandStaff <
+ \type Staff = SA <
+ \type Voice = VA { \property Voice.ydirection= 1
+ e4 dis4 e2 }
+ \type Voice = VB { \property Voice.ydirection= -1
+ [cis8 a] [fis b] gis2 }
+ {\key e; }
+ >
+ \type Staff = SB { \clef "bass"; \key e;
+ [a,,16 e dis e] [b'8 b,] [e16 e, gis b] e4
+ }
+>
+
+\paper
+{
+}
+\paper
+{
+% linewidth = 5.0 \cm; % ly2dvi barfs on -1
+ linewidth = 8.0 \cm;
+}
+}
}
Molecule*
-Abbreviation::brew_molecule_p () const
+Abbreviation::do_brew_molecule_p () const
{
Real interbeam_f = paper ()->interbeam_f (stem_l_->mult_i_);
Real w = 1.5 * lookup_l ()->ball (2).dim_.x ().length ();
}
Molecule*
-Abbreviation_beam::brew_molecule_p () const
+Abbreviation_beam::do_brew_molecule_p () const
{
/*
todo
*/
- return Beam::brew_molecule_p ();
+ return Beam::do_brew_molecule_p ();
#if 0
Molecule *mol_p = new Molecule;
// huh? inter-what
--- /dev/null
+#include "pointer.hh"
+#include "main.hh"
+#include "all-fonts.hh"
+#include "debug.hh"
+#include "warn.hh"
+#include "afm.hh"
+
+const char * default_font_sz_ = "cmr10";
+
+
+
+All_font_metrics::All_font_metrics (String path)
+{
+ search_path_.parse_path (path);
+
+ String f = default_font_sz_ + String (".afm");
+ f = search_path_.find (f);
+ if (f.empty_b ())
+ error (_f("Can't find default font (PATH = %s)", path));
+
+
+ afm_p_dict_[default_font_sz_] = new Adobe_font_metric (read_afm_file (f));
+}
+
+Adobe_font_metric *
+All_font_metrics::find_font (String name)
+{
+ if (!afm_p_dict_.elem_b (name))
+ {
+ String path = name + ".afm";
+ path = search_path_.find (path);
+ if (path.empty_b ())
+ {
+ warning (_f ("Can't find `%s'", name));
+ return afm_p_dict_[default_font_sz_];
+ }
+
+ *mlog << "[" << path;
+ Adobe_font_metric
+ * afm_p = new Adobe_font_metric (read_afm_file (path));
+ *mlog << "]" << flush ;
+
+ afm_p_dict_[name] = afm_p;
+ }
+
+ return afm_p_dict_[name];
+}
+
+
}
void
-read_char_metrics (Array<Adobe_font_char_metric> &mets, Data_file &input)
+Adobe_font_metric::read_char_metrics (Data_file &input)
{
while (!input.eof_b ())
{
String s= input.get_line ();
if (s == "EndCharMetrics")
return ;
- mets.push (read_char_metric (s));
+ Adobe_font_char_metric afm_char =read_char_metric (s);
+ char_metrics_.push (afm_char);
+ int i = char_metrics_.size ()-1;
+ ascii_to_metric_idx_ [afm_char.C_] = i;
+ name_to_metric_dict_ [afm_char.N_] = i;
}
}
}
Adobe_font_metric
-read_afm (String fn)
+read_afm_file (String fn)
{
Data_file input (fn);
assert (!input.eof_b ());
Adobe_font_metric afm;
-
+
+ for (int i=0; i < 256; i++)
+ {
+ afm.ascii_to_metric_idx_.push (-1);
+ }
+
while (!input.eof_b ())
{
input.gobble_leading_white ();
if (key == "StartCharMetrics")
{
input.get_line ();
- read_char_metrics (afm.char_metrics_, input);
+ afm.read_char_metrics (input);
}
if (key == "EndFontMetrics")
break;
Adobe_font_char_metric
Adobe_font_metric::find_char (String nm, bool warn) const
{
- for (int i=0; i < char_metrics_.size (); i++)
- if (char_metrics_[i].N_ == nm)
- return char_metrics_[i];
- if (warn)
- warning (_f ("can't find character called `%s'", nm.ch_C()));
-
- Adobe_font_char_metric a;
- return a;
+ if (warn && !name_to_metric_dict_.elem_b (nm))
+ {
+ Adobe_font_char_metric m;
+ warning (_f ("can't find character called `%s'", nm.ch_C()));
+ return m;
+ }
+
+ return char_metrics_[name_to_metric_dict_ [nm]];
}
+
Offset
Atom::offset () const
{
+ check_infinity_b ();
return off_;
}
void
Bar_column_engraver::do_process_requests ()
{
- Scalar pri = get_property ("barColumnPriority");
+ Scalar pri = get_property ("barColumnPriority", 0);
if (pri.length_i() && pri.isnum_b ())
{
break_priority_i_ = int(pri);
{
bar_p_ = new Bar;
bar_p_->break_priority_i_ = 0;
- String default_type = get_property ("defaultBarType");
+ String default_type = get_property ("defaultBarType", 0);
if (default_type.length_i ())
{
bar_p_->type_str_ = default_type;
else
{
Time_description const *time = get_staff_info().time_C_;
- String always = get_property ("barAlways");
+ String always = get_property ("barAlways", 0);
if ((time && !time->whole_in_measure_) || always.length_i ())
create_bar ();
}
script_p_->specs_p_ = td_p->clone ();
script_p_->breakable_b_ = true;
- Scalar pri = get_property ("barNumberBreakPriority");
+ Scalar pri = get_property ("barNumberBreakPriority", 0);
if (pri.length_i () && pri.isnum_b ())
{
script_p_->break_priority_i_ = int (pri);
else
script_p_->break_priority_i_ = b->break_priority_i_;
- Scalar padding = get_property ("barScriptPadding");
+ Scalar padding = get_property ("barScriptPadding", 0);
if (padding.length_i() && padding.isnum_b ())
{
script_p_->padding_f_ = Real(padding);
}
Molecule*
-Bar::brew_molecule_p () const
+Bar::do_brew_molecule_p () const
{
Paper_def *p = paper ();
Atom s = lookup_l ()->bar (type_str_, p->get_var ("barsize"));
-/*
- beam-grav.cc -- implement Beam_engraver
-
+/*
+ beam-engraver.cc -- implement Beam_engraver
+
source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-#include "duration-convert.hh"
-#include "time-description.hh"
#include "beam-engraver.hh"
-#include "stem.hh"
-#include "beam.hh"
#include "musical-request.hh"
+#include "beam.hh"
#include "grouping.hh"
-#include "p-col.hh"
+#include "stem.hh"
#include "warn.hh"
+#include "time-description.hh"
-Beam_engraver::Beam_engraver()
+Beam_engraver::Beam_engraver ()
{
- span_reqs_drul_[LEFT] = span_reqs_drul_[RIGHT] =0;
- beam_p_ =0;
- current_grouping_p_ =0;
+ beam_p_ = 0;
+ finished_beam_p_ =0;
+ finished_grouping_p_ = 0;
+ grouping_p_ =0;
+ reqs_drul_[LEFT] = reqs_drul_[RIGHT] =0;
}
bool
-Beam_engraver::do_try_music (Music*r)
+Beam_engraver::do_try_music (Music *m)
{
- Beam_req* b = dynamic_cast <Beam_req *> (r);
- if (!b)
- return false;
-
- if (bool (beam_p_) == bool (b->spantype_ == START))
- return false;
-
- Direction d = (!beam_p_) ? LEFT : RIGHT;
- if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (b))
- return false;
-
- span_reqs_drul_[d] = b;
- return true;
+ if (Beam_req * c = dynamic_cast<Beam_req*>(m))
+ {
+ reqs_drul_[c->spantype_] = c;
+ return true;
+ }
+ return false;
}
+
void
-Beam_engraver::do_process_requests()
+Beam_engraver::do_process_requests ()
{
- if (beam_p_ || !span_reqs_drul_[LEFT])
- return;
+ if (reqs_drul_[STOP])
+ {
+ if (!beam_p_)
+ reqs_drul_[STOP]->warning (_("No beam to stop"));
+ finished_beam_p_ = beam_p_;
+ finished_grouping_p_ = grouping_p_;
- current_grouping_p_ = new Rhythmic_grouping;
- beam_p_ = new Beam;
+ beam_p_ = 0;
+ grouping_p_ = 0;
+ }
+
+ if (reqs_drul_[START])
+ {
+ beam_p_ = new Beam;
+ grouping_p_ = new Rhythmic_grouping;
- Scalar prop = get_property ("beamslopedamping");
- if (prop.isnum_b ())
- beam_p_->damping_i_ = prop;
+ Scalar prop = get_property ("beamslopedamping", 0);
+ if (prop.isnum_b ())
+ beam_p_->damping_i_ = prop;
- prop = get_property ("beamquantisation");
- if (prop.isnum_b ())
- beam_p_->quantisation_ = (Beam::Quantisation)(int)prop;
+ prop = get_property ("beamquantisation", 0);
+ if (prop.isnum_b ())
+ beam_p_->quantisation_ = (Beam::Quantisation)(int)prop;
- announce_element (Score_element_info (beam_p_, span_reqs_drul_[LEFT]));
+ announce_element (Score_element_info (beam_p_, reqs_drul_[START]));
+ }
}
void
-Beam_engraver::do_pre_move_processing()
+Beam_engraver::typeset_beam ()
{
- if (!beam_p_ || !span_reqs_drul_[RIGHT])
- return;
-
- Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
- rg_C->extend (current_grouping_p_->interval());
- beam_p_->set_grouping (*rg_C, *current_grouping_p_);
- typeset_element (beam_p_);
- beam_p_ = 0;
-
- delete current_grouping_p_;
- current_grouping_p_ = 0;
-
- span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
+ if (finished_beam_p_)
+ {
+ Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
+ rg_C->extend (finished_grouping_p_->interval());
+ finished_beam_p_->set_grouping (*rg_C, *finished_grouping_p_);
+ typeset_element (finished_beam_p_);
+ finished_beam_p_ = 0;
+
+ delete finished_grouping_p_;
+ finished_grouping_p_= 0;
+
+ reqs_drul_[STOP] = 0;
+ }
}
void
-Beam_engraver::do_removal_processing()
+Beam_engraver::do_post_move_processing ()
{
- if (beam_p_)
- {
- span_reqs_drul_[LEFT]->warning (_("unterminated beam"));
- typeset_element (beam_p_);
- beam_p_ =0;
- }
+ reqs_drul_ [START] =0;
}
-
void
-Beam_engraver::acknowledge_element (Score_element_info i)
+Beam_engraver::do_pre_move_processing ()
{
- Stem* s = dynamic_cast<Stem *> (i.elem_l_);
- if (!beam_p_ || !s)
- return;
+ typeset_beam ();
+}
- if (!dynamic_cast <Rhythmic_req *> (i.req_l_))
- {
- ::warning ( _("Stem must have Rhythmic structure."));
- return;
- }
+void
+Beam_engraver::do_removal_processing ()
+{
+ typeset_beam ();
+ finished_beam_p_ = beam_p_;
+ finished_grouping_p_ = grouping_p_;
+ typeset_beam ();
+}
- Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (i.req_l_);
- if (rhythmic_req->duration_.durlog_i_<= 2)
- {
- rhythmic_req->warning (_ ("stem doesn't fit in beam"));
- return;
- }
+void
+Beam_engraver::acknowledge_element (Score_element_info info)
+{
+ if (beam_p_)
+ {
+ Stem* stem_l = dynamic_cast<Stem *> (info.elem_l_);
+ if (!stem_l)
+ return;
+
+
+ Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (info.req_l_);
+ if (!rhythmic_req)
+ {
+ String s=_("Stem must have Rhythmic structure.");
+ if (info.req_l_)
+ info.req_l_->warning(s);
+ else
+ ::warning (s);
+
+ return;
+ }
+
+
+ if (rhythmic_req->duration_.durlog_i_<= 2)
+ {
+ rhythmic_req->warning (_ ("stem doesn't fit in beam"));
+ return;
+ }
+
+ /*
+ TODO: do something sensible if it doesn't fit in the beam.
+ */
+ Moment start = get_staff_info().time_C_->whole_in_measure_;
+
+ if (!grouping_p_->child_fit_b (start))
+ {
+ String s (_("please fix me") + ": "
+ + _f ("stem at %s doesn't fit in beam", now_moment ().str ()));
+
+ if (info.req_l_)
+ info.req_l_->warning(s);
+ else
+ warning (s);
+ }
+ else
+ {
+ grouping_p_->add_child (start, rhythmic_req->duration ());
+ stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
+ beam_p_->add_stem (stem_l);
+ }
+ }
+}
- /*
- TODO: do something sensible if it doesn't fit in the beam.
- */
- Moment start = get_staff_info().time_C_->whole_in_measure_;
- if (!current_grouping_p_->child_fit_b (start))
- {
- String s (_("please fix me") + ": "
- + _f ("stem at %s doesn't fit in beam", now_moment ().str ()));
- if (i.req_l_)
- i.req_l_->warning(s);
- else
- warning (s);
- }
- else
- {
- current_grouping_p_->add_child (start, rhythmic_req->duration ());
- s->flag_i_ = rhythmic_req->duration_.durlog_i_;
- beam_p_->add_stem (s);
- }
-}
ADD_THIS_TRANSLATOR(Beam_engraver);
}
Molecule*
-Beam::brew_molecule_p () const
+Beam::do_brew_molecule_p () const
{
Molecule *mol_p = new Molecule;
-
Real internote_f = paper ()->internote_f ();
Real x0 = stems_[0]->hpos_f ();
Offset
Beam::center () const
{
- Real w= (paper ()->note_width () + width ().length ())/2.0;
+ Real w= (paper ()->note_width () + extent (X_AXIS).length ())/2.0;
return Offset (w, (left_y_ + w* slope_f_)*paper ()->internote_f ());
}
assert (stems_.size () == b.size ()/2);
}
- for (int j=0, i=0; i < b.size () && j <stems_.size (); i+= 2, j++)
+ for (int j=0, i=0; i < b.size () && j <stems_.size (); j++)
{
Stem *s = stems_[j];
- s->beams_i_drul_[LEFT] = b[i];
- s->beams_i_drul_[RIGHT] = b[i+1];
- multiple_i_ = multiple_i_ >? (b[i] >? b[i+1]);
+ Direction d = LEFT;
+ do {
+ if (s->beams_i_drul_[d] < 0)
+ s->beams_i_drul_[d] = b[i];
+
+ multiple_i_ = multiple_i_ >? s->beams_i_drul_[d];
+ i++;
+ } while ((flip (&d)) != LEFT);
}
}
}
Molecule*
-Bow::brew_molecule_p () const
+Bow::do_brew_molecule_p () const
{
Real thick = paper ()->get_var ("slur_thickness");
Array<Offset> c = get_controls ();
{
Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
- Real dx = width ().length ();
+ Real dx = extent(X_AXIS).length ();
return Offset (dx / 2, dy);
}
{
Offset d (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT],
dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]);
- d.x() += width (). length ();
+ d.x() += extent (X_AXIS). length ();
Array<Offset> notes;
notes.push (Offset (0, 0));
#include "paper-def.hh"
#include "main.hh"
#include "dimensions.hh"
+#include "g-text-item.hh"
ADD_THIS_TRANSLATOR (Chord_name_engraver);
return false;
}
+/*
+ UGH.
+
+ Split this routine into neat packets
+ */
void
Chord_name_engraver::do_process_requests ()
{
- move this stuff to new Item class Chord_name
- switch on property, add american (?) chordNameStyle
- Scalar chordNameStyle = get_property ("chordNameStyle");
+ Scalar chordNameStyle = get_property ("chordNameStyle", 0);
if (chordNameStyle == "Banter")
chord = pitches_to_banter (pitch_arr_));
*/
- Scalar style = get_property ("textstyle");
- Scalar alignment = get_property ("textalignment");
- Text_def* text_p = new Text_def;
- text_p->align_dir_ = LEFT;
- if (style.length_i ())
- text_p->style_str_ = style;
- if (alignment.isnum_b())
- text_p->align_dir_= (Direction)(int)alignment;
-
-
+
/*
find tonic: after longest line of triads
*/
int tonic_i = 0;
- Scalar chord_inversions = get_property ("chordInversion");
+ Scalar chord_inversions = get_property ("chordInversion", 0);
if (chord_inversions.to_bool ())
{
int longest_i = 0;
+ acc[tonic.accidental_i_ + 2];
}
- text_p->text_str_ = tonic_str + "$^{" + add_str + "}$" + inversion_str;
- Text_item* item_p = new Text_item (text_p);
- item_p->dir_ = DOWN;
- item_p->fat_b_ = true;
+
+ G_text_item* item_p = new G_text_item;
+
+
+ item_p->text_str_ = tonic_str + "$^{" + add_str + "}$" + inversion_str;
+ Scalar style = get_property ("textstyle", 0);
+ if (style.length_i ())
+ item_p->style_str_ = style;
+
text_p_arr_.push (item_p);
announce_element (Score_element_info (item_p, 0));
}
void
Clef_engraver::do_creation_processing()
{
- Scalar def = get_property ("defaultClef");
+ Scalar def = get_property ("defaultClef", 0);
if (def.to_bool ()) // egcs: Scalar to bool is ambiguous
set_type (def);
Molecule*
-Clef_item::brew_molecule_p() const
+Clef_item::do_brew_molecule_p() const
{
String t = symbol_;
if (change_b_)
fixpos_p_.set_l (fixed_C);
ugh_b_ = false;
pcol_l_ = col_l;
- width_ = pcol_l_->width();
+ width_ = pcol_l_->extent(X_AXIS);
if (width_.empty_b())
width_ = Interval(0,0);
}
return b && type_str_ == b->type_str_;
}
-void
-Command_tie_req::do_print () const
-{}
Atom
Crescendo::get_symbol() const
{
- Real w_dim = width().length ();
+ Real w_dim = extent(X_AXIS).length ();
if (dyn_b_drul_[LEFT])
{
w_dim -= absdyn_dim;
}
Molecule*
-Crescendo::brew_molecule_p() const
+Crescendo::do_brew_molecule_p() const
{
Molecule* m_p =0;
Real x_off_dim=0.0;
--- /dev/null
+/*
+ dimension-cache.cc -- implement Dimension_cache
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ */
+
+#include "dimension-cache.hh"
+#include "parray.hh"
+
+Dimension_cache::Dimension_cache (Dimension_cache const &d)
+{
+ init();
+ empty_b_ = d.empty_b_;
+}
+
+Dimension_cache::Dimension_cache ()
+{
+ init();
+}
+
+void
+Dimension_cache::init()
+{
+ offset_ =0.0;
+ elt_l_ = 0;
+ dim_.set_empty ();
+ parent_l_ =0;
+ valid_b_ = false;
+ empty_b_ = false;
+}
+
+
+void
+Dimension_cache::invalidate ()
+{
+ valid_b_ = false;
+ invalidate_dependencies ();
+}
+
+void
+Dimension_cache::invalidate_dependencies ()
+{
+ for (int i=0; i < dependencies_l_arr_.size (); i++)
+ {
+ Dimension_cache * g = dependencies_l_arr_[i];
+ if (g->valid_b_)
+ {
+ g->invalidate ();
+ }
+ }
+}
+
+void
+Dimension_cache::set_offset (Real x)
+{
+ invalidate_dependencies ();
+ offset_ = x;
+}
+
+void
+Dimension_cache::translate (Real x)
+{
+ invalidate_dependencies ();
+ offset_ += x;
+}
+
+
+Real
+Dimension_cache::absolute_coordinate () const
+{
+ Real r = offset_;
+ for (Dimension_cache * c = parent_l_;
+ c; c = c->parent_l_)
+ r += c->offset_;
+ return r;
+}
+
+Real
+Dimension_cache::relative_coordinate (Dimension_cache *d) const
+{
+ Real r =0.0;
+
+ for (Dimension_cache* c = parent_l_;
+ c != d;
+ c = c->parent_l_)
+ r += c->offset_;
+ return r;
+}
+
+Dimension_cache *
+Dimension_cache::common_group (Dimension_cache const* s) const
+{
+ Link_array<Dimension_cache const> my_groups;
+ for (Dimension_cache const *c = this;
+ c ; c = c->parent_l_)
+ my_groups.push (c);
+
+
+ Dimension_cache const *common=0;
+
+ for (Dimension_cache const * d = s;
+ !common && d;
+ d = d->parent_l_)
+ common = my_groups.find_l (d);
+
+ return (Dimension_cache*)common;
+}
+
+
+
+void
+Dimension_cache::set_empty (bool b)
+{
+ if (empty_b_ != b)
+ {
+ empty_b_ = b;
+ if (!empty_b_)
+ invalidate ();
+ }
+}
+
+void
+Dimension_cache::set_dim (Interval v)
+{
+ dim_ = v;
+ valid_b_ = true;
+}
+
+
+Interval
+Dimension_cache::get_dim () const
+{
+ Interval r;
+ if (empty_b_)
+ {
+ r.set_empty ();
+ return r;
+ }
+
+ assert (valid_b_);
+
+ r=dim_;
+ if (!r.empty_b()) // float exception on DEC Alpha
+ r += offset_;
+
+ return r;
+}
+
+
Offset
Directional_spanner::center () const
{
- Real w= width ().length ();
+ Real w= extent (X_AXIS).length ();
Offset o (w/2, 0);
return o;
}
{
Interval w;
for (int i=0; i < head_l_arr_.size (); i++)
- w.unite (head_l_arr_[i]->width ());
+ w.unite (head_l_arr_[i]->extent (X_AXIS));
if (!w.empty_b ())
- translate_axis (w[RIGHT] - width() [LEFT],X_AXIS);
+ translate_axis (w[RIGHT] - extent(X_AXIS) [LEFT],X_AXIS);
}
}
Molecule*
-Dots::brew_molecule_p () const
+Dots::do_brew_molecule_p () const
{
Molecule *out = new Molecule;
Atom fill = lookup_l ()->fill (Box (Interval (0,0),
#include "score-column.hh"
#include "staff-sym.hh"
#include "note-column.hh"
+#include "g-text-item.hh"
+#include "g-staff-side.hh"
+#include "engraver.hh"
+#include "stem.hh"
+#include "note-head.hh"
+
+/**
+ print text & hairpin dynamics.
+ */
+class Dynamic_engraver : public Engraver
+{
+ G_text_item * text_p_;
+ G_staff_side_item * staff_side_p_;
+
+ Crescendo * to_end_cresc_p_;
+ Crescendo * cresc_p_;
+ Span_dynamic_req * cresc_req_l_;
+ Array<Dynamic_req*> dynamic_req_l_arr_;
+ void typeset_all ();
+public:
+ VIRTUAL_COPY_CONS(Translator);
+ Dynamic_engraver();
+
+protected:
+ virtual void do_removal_processing ();
+ virtual void acknowledge_element (Score_element_info);
+ virtual bool do_try_music (Music *req_l);
+ virtual void do_process_requests();
+ virtual void do_pre_move_processing();
+ virtual void do_post_move_processing();
+};
+
+
Dynamic_engraver::Dynamic_engraver()
{
do_post_move_processing();
- dir_ = CENTER;
- dynamic_p_ =0;
+ text_p_ =0;
+ staff_side_p_ =0;
to_end_cresc_p_ = cresc_p_ = 0;
cresc_req_l_ = 0;
}
Dynamic_req *dreq_l = dynamic_req_l_arr_[i];
if (Absolute_dynamic_req *absd = dynamic_cast<Absolute_dynamic_req *> (dreq_l))
{
-
- if (dynamic_p_)
+ if (text_p_)
{
dynamic_req_l_arr_[i]->warning (_("Got a dynamic already. Continuing dazed and confused"));
continue;
}
- Text_def * td_p = new Text_def;
String loud = absd->loudness_str ();
- td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh
- td_p->style_str_ = "dynamic";
- td_p->align_dir_ = RIGHT;
- Real nw_f = paper ()->note_width () * 0.8;
- dynamic_p_ = new Text_item (td_p);
- dynamic_p_->translate (Offset (nw_f, 0));
+ text_p_ = new G_text_item;
+ text_p_->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_;
+ Scalar prop = get_property ("dynamicStyle", 0);
+
+ text_p_->style_str_ = prop.length_i () ? prop : "dynamic";
+
+ staff_side_p_ = new G_staff_side_item;
+ staff_side_p_->set_victim (text_p_);
+
- announce_element (Score_element_info (dynamic_p_, dreq_l));
+ prop = get_property ("dynamicDir", 0);
+ if (prop.isnum_b ())
+ {
+ staff_side_p_->dir_ = (Direction) (int) prop;
+ }
+
+
+ announce_element (Score_element_info (text_p_, dreq_l));
+ announce_element (Score_element_info (staff_side_p_, dreq_l));
}
else if (Span_dynamic_req *span_l = dynamic_cast <Span_dynamic_req *> (dreq_l))
{
assert (!to_end_cresc_p_);
to_end_cresc_p_ =cresc_p_;
cresc_p_ = 0;
+ Scalar prop = get_property ("dynamicDir", 0);
+ if (prop.isnum_b ())
+ {
+ to_end_cresc_p_->dir_ = (Direction) (int) prop;
+ }
+
}
}
else if (span_l->spantype_ == START)
cresc_p_ = new_cresc_p;
cresc_p_->set_bounds(LEFT,get_staff_info().musical_l ());
- if (dynamic_p_)
+ if (text_p_)
{
cresc_p_->dyn_b_drul_[LEFT] = true;
+ if (to_end_cresc_p_)
+ to_end_cresc_p_->dyn_b_drul_[RIGHT] = true;
}
}
}
{
Staff_symbol* s_l = get_staff_info().staff_sym_l_;
if (to_end_cresc_p_)
- {
- if (dynamic_p_)
- to_end_cresc_p_->dyn_b_drul_[RIGHT]=true;
+ to_end_cresc_p_->add_support (s_l);
+ if (staff_side_p_)
+ staff_side_p_->add_support (s_l);
- Scalar prop = get_property ("dynamicdir");
- if (prop.isnum_b ())
- {
- to_end_cresc_p_->dir_ = (Direction) (int) prop;
- }
- to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ());
- to_end_cresc_p_->add_support (s_l);
- typeset_element (to_end_cresc_p_);
- to_end_cresc_p_ = 0;
- }
- if (dynamic_p_)
- {
- Scalar prop = get_property ("dynamicdir");
- if (prop.isnum_b ())
- {
- dynamic_p_->dir_ = (Direction) (int) prop;
- }
-
- dynamic_p_->add_support (s_l);
- typeset_element (dynamic_p_);
- dynamic_p_ = 0;
- }
+ typeset_all ();
}
if (cresc_p_)
{
typeset_element (cresc_p_ );
-
cresc_req_l_->warning (_ ("unended crescendo"));
cresc_p_ =0;
}
+ typeset_all ();
+}
+
+
+void
+Dynamic_engraver::typeset_all ()
+{
if (to_end_cresc_p_)
{
+ to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ());
typeset_element (to_end_cresc_p_);
to_end_cresc_p_ =0;
}
- if (dynamic_p_)
+ if (text_p_)
{
- typeset_element (dynamic_p_);
- dynamic_p_ =0;
+ typeset_element (text_p_);
+ typeset_element (staff_side_p_);
+ text_p_ =0;
+ staff_side_p_ =0;
}
}
+
void
Dynamic_engraver::acknowledge_element (Score_element_info i)
{
- if (dynamic_cast<Note_column *> (i.elem_l_))
+ if (dynamic_cast<Stem *> (i.elem_l_)
+ || dynamic_cast<Note_head *> (i.elem_l_)
+ )
{
- if (dynamic_p_)
- dynamic_p_->add_support (i.elem_l_);
+ if (staff_side_p_)
+ staff_side_p_->add_support (i.elem_l_);
if (to_end_cresc_p_)
to_end_cresc_p_->add_support (i.elem_l_);
if (stem->dir_ != dir)
o_.x () -= 0.5 * notewidth * stem->dir_;
- o_.y () = stem->height ()[dir];
+ o_.y () = stem->extent (Y_AXIS)[dir];
/*
leave a gap: slur mustn't touch head/stem
*/
Offset
Extender_spanner::center () const
{
- Real dx = width ().length ();
+ Real dx = extent (X_AXIS).length ();
return Offset (dx / 2, 0);
}
Molecule*
-Extender_spanner::brew_molecule_p () const
+Extender_spanner::do_brew_molecule_p () const
{
Molecule* mol_p = new Molecule;
- Real w = width ().length ();
+ Real w = extent (X_AXIS).length ();
w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
{
Text_item* t = textitem_l_drul_[d] ? textitem_l_drul_[d] : textitem_l_drul_[(Direction)-d];
- dy_f_drul_[d] += t->height ().length () / 2;
+ dy_f_drul_[d] += t->extent (Y_AXIS).length () / 2;
if (d == LEFT)
- dx_f_drul_[d] += t->width ().length ();
+ dx_f_drul_[d] += t->extent (X_AXIS).length ();
else
dx_f_drul_[d] -= d * nw_f / 2;
void
Font_size_engraver::do_process_requests ()
{
- Scalar s (get_property ("fontsize"));
+ Scalar s (get_property ("fontsize", 0));
if (s.length_i () && s.isnum_b ())
{
--- /dev/null
+/*
+ g-staff-side.cc -- implement G_staff_side_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "g-staff-side.hh"
+
+void
+G_staff_side_item::do_pre_processing ()
+{
+ if (!dir_)
+ set_default_direction ();
+}
+
+void
+G_staff_side_item::set_default_direction ()
+{
+ dir_ = DOWN;
+}
+
+G_staff_side_item::G_staff_side_item ()
+{
+ dir_ = CENTER;
+ to_position_l_ = 0;
+ transparent_b_ = true;
+}
+
+void
+G_staff_side_item::set_victim (Score_element *e)
+{
+ add_dependency (e);
+ to_position_l_ = e;
+ to_position_l_->dim_cache_[Y_AXIS].parent_l_ = &dim_cache_[Y_AXIS];
+}
+
+void
+G_staff_side_item::add_support (Score_element*e)
+{
+ add_dependency (e);
+ support_l_arr_.push (e);
+}
+
+
+void
+G_staff_side_item::do_substitute_dependency (Score_element*o, Score_element*n)
+{
+ if (o == to_position_l_)
+ to_position_l_ = n;
+ else
+ support_l_arr_.unordered_substitute (o,n);
+}
+
+
+void
+G_staff_side_item::do_post_processing ()
+{
+ Dimension_cache *common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0),
+ Y_AXIS);
+
+ Interval dim;
+ for (int i=0; i < support_l_arr_.size (); i++)
+ {
+ Score_element * e = support_l_arr_ [i];
+ Real coord = e->relative_coordinate (common, Y_AXIS);
+ dim.unite (coord + e->extent (Y_AXIS));
+ }
+ if (!support_l_arr_.size ())
+ dim = Interval (0,0);
+
+ Interval sym_dim = to_position_l_->extent (Y_AXIS);
+ Real off = dim_cache_[Y_AXIS].relative_coordinate (common);
+
+ dim_cache_[Y_AXIS].set_offset (dim[dir_] - sym_dim[-dir_] - off);
+}
--- /dev/null
+/*
+ g-text-item.cc -- implement G_text_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "g-text-item.hh"
+#include "atom.hh"
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+
+Molecule*
+G_text_item::do_brew_molecule_p () const
+{
+ Atom a= paper ()->lookup_l(0)->text (style_str_,text_str_);
+ return new Molecule (a);
+}
+
+G_text_item::G_text_item ()
+{
+ style_str_ = "roman";
+}
Graphical_axis_group at one time. */
Graphical_axis_group::Graphical_axis_group (Graphical_axis_group const&s)
{
- axis1_ = s.axis1_;
- axis2_ = s.axis2_;
+ axes_[0] = s.axes_[0];
+ axes_[1] = s.axes_[1];
}
bool
void
Graphical_axis_group::add_element (Graphical_element*e)
{
- Graphical_axis_group *& g1 = e->axis_group_l_a_[axis1_];
- Graphical_axis_group *& g2 = e->axis_group_l_a_[axis2_];
-
- assert (!g1 || g1 == this);
- assert (!g2 || g2 == this);
- g1 = this;
- g2 = this;
+ for (int i = 0; i < 2; i++)
+ {
+ Axis a = axes_[i];
+ Dimension_cache * &d = e->dim_cache_[a].parent_l_;
+ assert (!d || d == &dim_cache_[a]);
+ d = &dim_cache_[a];
+ d->dependencies_l_arr_.push (&dim_cache_[a]);
+ }
+
elem_l_arr_.push (e);
}
assert (contains_b (e));
elem_l_arr_.unordered_substitute (e,0);
- e->axis_group_l_a_[axis1_] = 0;
- e->axis_group_l_a_[axis2_] = 0;
+ for (int i=0; i< 2; i++)
+ {
+ Axis a=axes_[i];
+ Dimension_cache * d = &e->dim_cache_[a];
+ d->parent_l_ = 0;
+ d->dependencies_l_arr_.unordered_substitute (&dim_cache_[a], 0);
+ }
}
void
for (int i=0; i < elem_l_arr_.size(); i++)
{
Graphical_element*e=elem_l_arr_[i];
- e->axis_group_l_a_[axis1_] = 0;
- e->axis_group_l_a_[axis2_] = 0;
+ for (int i=0; i< 2; i++)
+ {
+ Axis a=axes_[i];
+ Dimension_cache * d = &e->dim_cache_[a];
+ d->parent_l_ = 0;
+ d->dependencies_l_arr_.clear ();
+ }
+
}
elem_l_arr_.clear ();
}
Graphical_axis_group::Graphical_axis_group (Axis a1, Axis a2)
{
- axis1_ =a1;
- axis2_ = a2;
+ axes_[0] = a1;
+ axes_[1] = a2;
}
bool
Graphical_element::empty_b () const
{
- return empty_b_;
+ return dim_cache_[X_AXIS].empty_b () && dim_cache_[Y_AXIS].empty_b ();
}
Graphical_element::Graphical_element ()
}
Graphical_element::Graphical_element (Graphical_element const &s)
+ : dim_cache_ (s.dim_cache_)
{
init ();
- empty_b_ = s.empty_b_;
- axis_group_l_a_[0] = axis_group_l_a_[1] =0;
- offset_ = Offset (0,0); // Hmmmm.... Should copy?
}
void
Graphical_element::init ()
{
- empty_b_ = false;
- axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0;
- offset_ = Offset (0,0);
- cached_valid_b_a_ [X_AXIS] = cached_valid_b_a_[Y_AXIS] = false;
-}
-
-void
-Graphical_element::invalidate_cache (Axis a)
-{
- Graphical_element * g = this;
- while (g && g->cached_valid_b_a_[a])
- {
- g->cached_valid_b_a_ [a] = false;
- g = g->axis_group_l_a_[a];
- }
+ dim_cache_[X_AXIS].elt_l_ = dim_cache_[Y_AXIS].elt_l_ = this;
}
Real
Graphical_element::absolute_coordinate (Axis a) const
{
- Real r = offset_[a];
- for (Graphical_axis_group * axis_group_l = axis_group_l_a_[a];
- axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
-
- r += axis_group_l->offset_[a];
- return r;
+ return dim_cache_[a].absolute_coordinate ();
}
return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS));
}
+
+
void
Graphical_element::translate_axis (Real y, Axis a)
{
- if (axis_group_l_a_[a])
- axis_group_l_a_[a]->invalidate_cache (a);
- offset_[a] += y;
-}
+ dim_cache_[a].translate (y);
+}
Real
-Graphical_element::relative_coordinate (Graphical_axis_group*e, Axis a) const
+Graphical_element::relative_coordinate (Dimension_cache*e, Axis a) const
{
- Real r =0.0;
- for (Graphical_axis_group * axis_group_l = axis_group_l_a_[a];
- axis_group_l != e;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- r += axis_group_l->offset_[a];
-
- return r;
+ return dim_cache_[a].relative_coordinate (e);
}
-Graphical_axis_group*
+Dimension_cache *
Graphical_element::common_group (Graphical_element const* s, Axis a) const
{
- Link_array<Graphical_axis_group> my_groups;
- for (Graphical_axis_group * axis_group_l = axis_group_l_a_[a];
- axis_group_l;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- my_groups.push (axis_group_l);
-
- Graphical_axis_group* common_l=0;
- for (Graphical_axis_group * axis_group_l = s->axis_group_l_a_[a];
- !common_l && axis_group_l;
- axis_group_l = axis_group_l->axis_group_l_a_[a])
- common_l = my_groups.find_l (axis_group_l);
-
- return common_l;
+ return dim_cache_[a].common_group (&s->dim_cache_[a]);
}
-
-
void
Graphical_element::translate (Offset offset)
{
translate_axis (offset[X_AXIS], X_AXIS);
}
-Interval
-Graphical_element::width() const
-{
- return extent (X_AXIS);
-}
void
Graphical_element::set_empty (bool b)
{
- if (empty_b_ != b)
- {
- empty_b_ = b;
- if (!empty_b_)
- {
- invalidate_cache (X_AXIS);
- invalidate_cache (Y_AXIS);
- }
- }
-
+ dim_cache_[X_AXIS].set_empty (b);
+ dim_cache_[Y_AXIS].set_empty (b);
}
Interval
Graphical_element::extent (Axis a) const
{
- if (empty_b_)
+ Dimension_cache const * d = //(Dimension_cache*)
+ &dim_cache_[a];
+
+ if (d->empty_b ())
return Interval ();
- if (!cached_valid_b_a_[a])
- {
- Graphical_element *self = (Graphical_element*)this;
- self->cached_dimension_a_[a] = (a == X_AXIS)? do_width(): do_height ();
- self->cached_valid_b_a_[a] = true;
- }
+ if (!d->valid_b ())
+ ((Dimension_cache*)d)->set_dim ((a == X_AXIS)? do_width(): do_height ());
- Interval r(cached_dimension_a_[a]);
- if (!r.empty_b()) // float exception on DEC Alpha
- r+=offset_[a];
- return r;
-}
-
-Interval
-Graphical_element::height() const
-{
- return extent (Y_AXIS);
+ return d->get_dim ();
}
void
Graphical_element::unlink ()
{
- for (int j=0; j < 2; j++)
- if (axis_group_l_a_[j])
- axis_group_l_a_[j]->remove_element (this);
+ for (int a=X_AXIS; a < NO_AXES; a++)
+ if (Dimension_cache * d = dim_cache_[a].parent_l_)
+ {
+ if (Graphical_axis_group * eg
+ = dynamic_cast<Graphical_axis_group*> (d->elt_l_))
+ eg->remove_element (this);
+ }
}
void
Graphical_element::junk_links ()
{
- axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0;
}
void
Graphical_element::do_print () const
{
#ifndef NPRINT
- if (offset_.x() || offset_.y ())
- DOUT << "offset: " << offset_.str() ;
DOUT << '\n';
#endif
}
+void
+Graphical_element::invalidate_cache (Axis a)
+{
+ dim_cache_[a].invalidate ();
+}
+
+Graphical_element*
+Graphical_element::parent_l (Axis a) const
+{
+ Dimension_cache*d= dim_cache_[a].parent_l_;
+ return d ? d->elt_l_ : 0;
+}
+
+Graphical_element::~Graphical_element ()
+{
+}
+
+Dimension_cache *
+Graphical_element::common_group (Link_array<Graphical_element> gs, Axis a) const
+{
+ Dimension_cache * common = &dim_cache_[a];
+ for (int i=0; i < gs.size (); i++)
+ {
+ common = common->common_group (&gs[i]->dim_cache_[a]);
+ }
+
+ return common;
+}
+
+char const *
+Graphical_element::name () const
+{
+ return classname (this);
+}
Horizontal_group_item::Horizontal_group_item ()
{
- axis1_ = axis2_ = X_AXIS;
+ axes_[0] = axes_[1] = X_AXIS;
}
Horizontal_vertical_group_element::Horizontal_vertical_group_element()
{
- axis1_ = X_AXIS;
- axis2_ = Y_AXIS;
+ axes_[0] = X_AXIS;
+ axes_[1] = Y_AXIS;
}
Horizontal_vertical_group_item::Horizontal_vertical_group_item ()
{
- axis1_ = X_AXIS;
- axis2_ = Y_AXIS;
+ axes_[0] = X_AXIS;
+ axes_[1] = Y_AXIS;
}
Stem * stem_l_;
protected:
virtual void do_print () const;
- virtual Molecule *brew_molecule_p () const;
+ virtual Molecule *do_brew_molecule_p () const;
virtual void do_substitute_dependent (Score_element*, Score_element*);
public:
int abbrev_flags_i_;
protected:
virtual void do_print() const;
virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
- virtual Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
};
#endif // ABBREVIATION_BEAM_HH
#include "string.hh"
#include "box.hh"
#include "array.hh"
+#include "dictionary.hh"
struct Adobe_font_char_metric {
int C_;
String Notice_;
String EncodingScheme_;
Array<Adobe_font_char_metric> char_metrics_;
-
+ Array<int> ascii_to_metric_idx_;
+ Dictionary<int> name_to_metric_dict_;
+
Adobe_font_char_metric find_char (String name, bool warn=true) const;
+ Adobe_font_char_metric find_ascii (int ascii) const;
String str () const;
Adobe_font_metric ();
+ void read_char_metrics (Data_file &input);
};
-Adobe_font_metric read_afm (String fn);
+Adobe_font_metric read_afm_file (String fn);
--- /dev/null
+/*
+ all-fonts.hh -- declare All_font_metrics
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef ALL_FONTS_HH
+#define ALL_FONTS_HH
+
+#include "dictionary.hh"
+#include "file-path.hh"
+#include "lily-proto.hh"
+
+/**
+ Interface to all .afm files living in the filesystem.
+ */
+class All_font_metrics
+{
+ Dictionary<Adobe_font_metric*> afm_p_dict_;
+ File_path search_path_;
+public:
+
+ Adobe_font_metric *find_font (String name);
+ All_font_metrics (String search_path);
+};
+
+
+
+
+#endif /* ALL_FONTS_HH */
+
protected:
virtual void do_pre_processing ();
- Molecule* brew_molecule_p () const;
+ virtual Molecule* do_brew_molecule_p () const;
private:
void do_print () const;
-/*
- beam-engraver.hh -- declare Beam_engraver
-
+/*
+ cbeam-engraver.hh -- declare Beam_engraver
+
source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef BEAM_GRAV_HH
-#define BEAM_GRAV_HH
+#ifndef CBEAM_ENGRAVER_HH
+#define CBEAM_ENGRAVER_HH
#include "engraver.hh"
#include "drul-array.hh"
-/**
- Generate a beam. Eats stems.
- */
-class Beam_engraver : public Engraver
-{
- Drul_array<Beam_req *> span_reqs_drul_;
+class Beam_engraver : public Engraver {
+ Drul_array<Beam_req*> reqs_drul_;
+
+ Beam *finished_beam_p_;
Beam *beam_p_;
- Rhythmic_grouping *current_grouping_p_;
-public:
- VIRTUAL_COPY_CONS(Translator);
+ Rhythmic_grouping*grouping_p_;
+ Rhythmic_grouping*finished_grouping_p_;
- Beam_engraver();
+ void typeset_beam ();
protected:
- virtual void do_removal_processing();
- virtual void do_process_requests();
- virtual bool do_try_music (Music*);
+ virtual void do_pre_move_processing ();
+ virtual void do_post_move_processing ();
+ virtual void do_removal_processing ();
virtual void acknowledge_element (Score_element_info);
- virtual void do_pre_move_processing();
+ virtual bool do_try_music (Music*);
+ virtual void do_process_requests ();
+public:
+ Beam_engraver ();
+ VIRTUAL_COPY_CONS (Translator);
};
-#endif // BEAM_GRAV_HH
+#endif /* CBEAM_ENGRAVER_HH */
+
virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const;
virtual void solve_slope ();
virtual void quantise_dy ();
- virtual Molecule*brew_molecule_p () const;
+ virtual Molecule*do_brew_molecule_p () const;
};
#endif // BEAM_HH
int dash_i_;
protected:
- virtual Molecule* brew_molecule_p () const;
+ virtual Molecule* do_brew_molecule_p () const;
virtual Interval do_width () const;
Array<Offset> get_controls () const;
virtual Array<Offset> get_encompass_offset_arr () const;
private:
Array<Musical_pitch> pitch_arr_;
- Link_array<Text_item> text_p_arr_;
+ Link_array<Item> text_p_arr_;
};
#endif // CHORD_NAME_ENGRAVER_HH
class Clef_item : public Item {
protected:
virtual void do_pre_processing();
- virtual Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
public:
String symbol_;
REQUESTMETHODS(Command_script_req);
};
-class Command_tie_req : public Command_req {
-public:
- REQUESTMETHODS(Command_tie_req);
-};
/** Baseclass for time_signature/partial req. It has to be handled by
Staff_{walker,column} baseclass. */
Crescendo();
protected:
VIRTUAL_COPY_CONS(Score_element);
- virtual Molecule*brew_molecule_p() const;
+ virtual Molecule*do_brew_molecule_p() const;
virtual Interval symbol_height() const;
--- /dev/null
+/*
+ dimension-cache.hh -- declare Dimension_cache
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef DIMENSION_CACHE_HH
+#define DIMENSION_CACHE_HH
+#include "interval.hh"
+#include "real.hh"
+#include "lily-proto.hh"
+#include "parray.hh"
+
+
+
+class Dimension_cache
+{
+ bool valid_b_;
+ /** Is this element dimensionless?.
+ This is private to guarantee correctness of the cache
+ */
+ bool empty_b_;
+ Interval dim_;
+ Real offset_;
+ Graphical_element *elt_l_;
+ friend class Graphical_element;
+
+ void init ();
+public:
+ Dimension_cache * parent_l_;
+ Link_array<Dimension_cache> dependencies_l_arr_;
+
+ Real absolute_coordinate () const;
+ void invalidate ();
+ void invalidate_dependencies ();
+
+ Dimension_cache(Dimension_cache const&);
+ Dimension_cache ();
+ void set_group_l (Graphical_axis_group*);
+ Real relative_coordinate (Dimension_cache *d) const;
+ Dimension_cache*common_group (Dimension_cache const* s) const;
+ Dimension_cache*common_group (Link_array<Dimension_cache> caches) const;
+ void set_empty (bool);
+ void translate (Real);
+ void set_offset (Real);
+ bool valid_b () const { return valid_b_; }
+ bool empty_b() const { return empty_b_; }
+ void set_dim (Interval);
+ Interval get_dim () const;
+};
+
+
+#endif /* DIMENSION_CACHE_HH */
+
class Dots : public Item
{
protected:
- virtual Molecule * brew_molecule_p () const;
+ virtual Molecule * do_brew_molecule_p () const;
virtual void do_post_processing ();
public:
int no_dots_i_;
#ifndef DYNAMIC_GRAV_HH
#define DYNAMIC_GRAV_HH
-#include "engraver.hh"
-
-class Dynamic_engraver : public Engraver {
- Direction dir_;
- Text_item * dynamic_p_;
- Crescendo * to_end_cresc_p_;
- Crescendo * cresc_p_;
- Span_dynamic_req * cresc_req_l_;
- Array<Dynamic_req*> dynamic_req_l_arr_;
-public:
- VIRTUAL_COPY_CONS(Translator);
- Dynamic_engraver();
-
-protected:
- virtual void do_removal_processing ();
- virtual void acknowledge_element (Score_element_info);
- virtual bool do_try_music (Music *req_l);
- virtual void do_process_requests();
- virtual void do_pre_move_processing();
- virtual void do_post_move_processing();
-};
-
#endif // DYNAMIC_GRAV_HH
Drul_array<Text_item *> textitem_l_drul_;
protected:
- virtual Molecule* brew_molecule_p () const;
+ virtual Molecule* do_brew_molecule_p () const;
void do_add_processing ();
Interval do_height () const;
void do_substitute_dependency (Score_element* o, Score_element* n);
--- /dev/null
+/*
+ g-staff-side.hh -- declare G_staff_side_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef G_STAFF_SIDE_HH
+#define G_STAFF_SIDE_HH
+
+#include "item.hh"
+
+/*
+ DO NOT USE AS BREAKABLE ITEM!
+
+ (-> core dump!)
+ */
+class G_staff_side_item : public Item
+{
+public:
+ Score_element * to_position_l_;
+ Direction dir_;
+ Link_array<Score_element> support_l_arr_;
+
+ G_staff_side_item ();
+ void set_victim (Score_element*);
+ void add_support (Score_element*);
+
+ virtual void set_default_direction ();
+ VIRTUAL_COPY_CONS(Score_element);
+protected:
+ virtual void do_substitute_dependency (Score_element*,Score_element*);
+ virtual void do_pre_processing ();
+ virtual void do_post_processing ();
+};
+
+#endif /* G_STAFF_SIDE_HH */
+
--- /dev/null
+/*
+ g-text-item.hh -- declare G_text_item
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef G_TEXT_ITEM_HH
+#define G_TEXT_ITEM_HH
+
+#include "item.hh"
+
+class G_text_item : public Item
+{
+public:
+ String text_str_;
+ String style_str_;
+
+ G_text_item ();
+ VIRTUAL_COPY_CONS (Score_element);
+protected:
+ virtual Molecule *do_brew_molecule_p () const;
+};
+
+#endif /* G_TEXT_ITEM_HH */
+
class Graphical_axis_group : public virtual Graphical_element {
public:
Link_array<Graphical_element> elem_l_arr_;
- Axis axis1_, axis2_;
+ Axis axes_[2];
Interval extent (Axis) const;
virtual void do_print() const;
#include "lily-proto.hh"
#include "interval.hh"
#include "virtual-methods.hh"
+#include "dimension-cache.hh"
+
+
/** The 2d geometric aspects of a score-element. It was put in a
separate class, because Score_element got quite big.
-
*/
class Graphical_element
{
void init ();
- /** Is this element dimensionless?.
- This is private to guarantee correctness of the cache
- */
- bool empty_b_;
-
- Offset offset_;
- Interval cached_dimension_a_[NO_AXES];
- bool cached_valid_b_a_[NO_AXES];
public:
+ Dimension_cache dim_cache_[NO_AXES];
+ char const * name () const;
void set_empty (bool);
-
bool empty_b () const;
-
-
- Graphical_axis_group * axis_group_l_a_[NO_AXES];
-
Graphical_element ();
Graphical_element (Graphical_element const&);
+ virtual ~Graphical_element ();
void invalidate_cache (Axis);
Interval extent (Axis) const;
- Interval width() const;
- Interval height() const;
/**
translate the symbol. The symbol does not have to be created yet.
void translate_axis (Real, Axis);
- Real relative_coordinate (Graphical_axis_group*group, Axis) const;
+ Real relative_coordinate (Dimension_cache*group, Axis) const;
Offset absolute_offset() const;
Real absolute_coordinate (Axis) const;
/**
Find the group-element which has both #this# and #s#
*/
- Graphical_axis_group*common_group (Graphical_element const* s, Axis a) const;
+ Dimension_cache*common_group (Graphical_element const* s, Axis a) const;
+ Dimension_cache*common_group (Link_array<Graphical_element> elems, Axis a) const;
+
+ Graphical_element *parent_l (Axis a) const;
+
void unlink ();
void junk_links ();
virtual void do_print () const;
#include "matrix.hh"
-/// inequality constrained quadratic program
+/** inequality constrained quadratic program
+
+ It takes the form of
+
+ optimise for x : x*quad_ *x + lin_* x + const_term_
+
+ subject to for all i: cons_[i] * x >= consrhs_[i]
+
+
+ @usage:
+ instantiate Ineq_constrained_qp.
+
+ Modify quad_, lin_ and const_term_ directly. Use
+ add_inequality_cons () to add constraints. Call solve () with a
+ feasible solution
+
+
+ */
class Ineq_constrained_qp {
friend class Active_constraints;
protected:
virtual void do_pre_processing();
- Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
};
#endif // KEYITEM_HH
struct Abbreviation_beam;
struct Abbreviation_beam_req;
struct Abbreviation_beam_engraver;
+struct G_staff_side_item;
+struct G_text_item;
struct Abbreviation_req;
+struct Adobe_font_metric;
+struct Adobe_font_char_metric;
+struct All_font_metrics;
struct Atom;
struct Audio_element;
struct Audio_column;
protected:
virtual void do_pre_processing();
virtual void do_substitute_dependency (Score_element*,Score_element*);
- virtual Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
};
#endif // LOCALKEYITEM_HH
#include "scalar.hh"
#include "direction.hh"
#include "curve.hh"
-#include "afm.hh"
#include "symtable.hh"
#include "box.hh"
Paper_def * paper_l_;
Symtables *symtables_p_;
- String font_;
- String font_path_;
- Adobe_font_metric * afm_p_;
+
+ String font_name_;
+ Adobe_font_metric * afm_l_;
};
#endif // LOOKUP_HH
#include "lily-proto.hh"
-class Lyric_engraver : public Engraver
-{
-protected:
- virtual void do_pre_move_processing();
- virtual bool do_try_music (Music*);
- virtual void do_process_requests();
-
-public:
- Lyric_engraver();
- VIRTUAL_COPY_CONS(Translator);
-
-private:
- Link_array<Lyric_req> lyric_req_l_arr_;
- Link_array<Text_item> text_p_arr_;
-};
#endif // LYRIC_ENGRAVER_HH
extern String default_outname_base_global;
extern String default_outname_suffix_global;
extern int default_count_global;
+extern All_font_metrics *all_fonts_global_p;
+
+
#endif
protected:
virtual void do_print () const;
- virtual Molecule *brew_molecule_p () const;
+ virtual Molecule *do_brew_molecule_p () const;
};
#endif /* MULTI_MEASURE_REST_HH */
virtual bool ok () const;
protected:
- Music_list* music_list_l () const;
-
virtual void do_print () const;
virtual void do_process_and_next (Moment);
};
};
-/** Start / stop a beam at this note */
-class Beam_req : public Musical_span_req {
-public:
- REQUESTMETHODS(Beam_req);
-};
/**
Start / stop an abbreviation beam at this note.
int type_i_;
};
-/**
- Start a tie at this note, end it at the next
- */
-class Tie_req : public Musical_req {
-public:
- REQUESTMETHODS(Tie_req);
-};
+
/// a slur
class Slur_req : public Musical_span_req {
};
-/// a tuplet (bracket with) number
-class Plet_req : public Musical_span_req {
-public:
- int plet_i_;
-
- REQUESTMETHODS(Plet_req);
- Plet_req ();
-};
-
/// an extender line
class Extender_req : public Musical_span_req {
public:
Link_array<Rest> rest_l_arr_;
Interval_t<int> head_positions_interval() const;
- Interval width () const;
+ // Interval width () const;
void translate_rests(int dy);
protected:
virtual Interval do_width () const;
virtual void do_pre_processing();
- virtual Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
};
#endif // NOTEHEAD_HH
*/
class Paper_def : public Music_output_def
{
- Assoc<int, Lookup *> *lookup_p_assoc_p_;
+ Hash_table<int, Lookup *> *lookup_p_tab_p_;
static int default_count_i_;
protected:
Ineq_constrained_qp const *opt;
public:
-
+
+ /** This counts the number of errors the algorithms makes. The
+ optimum search should be abandoned if it becomes too high. */
int degenerate_count_i_;
String status() const;
Span_req();
};
+/**
+ Start a tie at this note, end it at the next
+ */
+class Tie_req : public Request {
+public:
+ REQUESTMETHODS(Tie_req);
+};
+
+/** Start / stop a beam at this note */
+class Beam_req : public Span_req {
+public:
+ REQUESTMETHODS(Beam_req);
+};
#endif
void add_dots (Dots*);
protected:
virtual void do_add_processing ();
- virtual Molecule * brew_molecule_p () const;
+ virtual Molecule * do_brew_molecule_p () const;
};
#endif // REST_HH
class Score_element : private Directed_graph_node, public virtual Graphical_element {
public:
Paper_score *pscore_l_;
-
+ Molecule * output_p_;
Score_element ();
Score_element (Score_element const&);
virtual void print () const;
int dependent_size () const;
int dependency_size () const;
- virtual void do_brew_molecule ();
+ virtual void output_processing ();
void junk_links ();
virtual Interval do_height () const;
virtual Interval do_width () const;
/// do printing of derived info.
virtual void do_print () const {}
/// generate the molecule
- virtual Molecule* brew_molecule_p () const;
+ virtual Molecule* do_brew_molecule_p () const;
///executed directly after the item is added to the Paper_score
virtual void do_add_processing ();
/// do calculations before determining horizontal spacing
#define SCOREF_ALIGN_GRAV_HH
#include "engraver.hh"
-#include "assoc.hh"
/**
Group a number of items across staffs
*/
class Score_priority_engraver : public Engraver
{
- Assoc<int, Horizontal_group_item *> align_p_assoc_;
+ Hash_table<int, Horizontal_group_item *> align_p_tab_;
public:
VIRTUAL_COPY_CONS(Translator);
Score_priority_engraver ();
Stem *stem_l_;
protected:
- Molecule *brew_molecule_p() const;
+ Molecule *do_brew_molecule_p() const;
virtual void do_substitute_dependency (Score_element*,Score_element*);
virtual void do_print() const;
virtual Interval symbol_height() const;
virtual bool ok () const;
protected:
- Sequential_music* sequential_music_l () const;
-
virtual void do_print() const;
virtual void do_process_and_next (Moment);
virtual bool ok () const;
protected:
- Simultaneous_music* simultaneous_music_l () const;
-
virtual void do_print () const;
virtual void do_process_and_next (Moment);
virtual void do_post_processing();
virtual void do_substitute_dependency (Score_element*,Score_element*);
- virtual Molecule * brew_molecule_p() const;
+ virtual Molecule * do_brew_molecule_p() const;
virtual Atom get_bar_sym (Real dy) const;
};
virtual void do_unlink ();
virtual void do_junk_links ();
- virtual void do_brew_molecule ();
+ virtual void output_processing ();
virtual void do_space_processing ();
virtual void do_break_processing ();
virtual Interval do_width () const;
protected:
VIRTUAL_COPY_CONS(Score_element);
virtual Interval do_height () const;
- virtual Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
virtual void do_print() const;
};
#endif // STAFFSYM_HH
*/
class Stem_engraver : public Engraver
{
- Direction dir_;
int default_abbrev_i_;
Stem *stem_p_;
Abbreviation *abbrev_p_;
virtual void do_substitute_dependency (Score_element*,Score_element*);
virtual void do_pre_processing();
virtual Interval do_width() const;
- Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
};
#endif
#include "atom.hh"
struct Symtable : public Dictionary<Atom> {
- String id_str;
+ String id_str;
- Atom lookup (String) const;
- void print() const;
+ Atom lookup (String) const;
+ void print() const;
};
void add (String, Symtable*);
void print() const;
- String font_;
- String font_path_;
+ String font_name_;
};
class Text_item : public Item ,public Staff_side
{
public:
-
/// do I have width?
bool fat_b_;
-
-
- Text_item (General_script_def* ,Direction dir=CENTER);
- virtual ~Text_item ();
-
-//protected:
- // ugh: so, are we a text-def, or can this vary?
+ Text_item (General_script_def* ,Direction dir=CENTER);
General_script_def* tdef_p_;
-protected:
+protected:
+ virtual ~Text_item ();
virtual Interval symbol_height () const;
-
- virtual Molecule* brew_molecule_p () const;
+ virtual Molecule* do_brew_molecule_p () const;
virtual void do_pre_processing ();
virtual Real get_position_f () const;
-
-private:
-// void init (Text_def* tdef_l);
};
virtual void do_pre_processing();
virtual void do_post_processing();
virtual Interval height() const ;
- virtual Molecule* brew_molecule_p() const;
+ virtual Molecule* do_brew_molecule_p() const;
virtual void do_print() const;
};
#endif // TEXTSPANNER_HH
--- /dev/null
+/*
+ ctie-engraver.hh -- declare Tie_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef CTIE_ENGRAVER_HH
+#define CTIE_ENGRAVER_HH
+
+#include "pqueue.hh"
+#include "engraver.hh"
+
+struct CHead_melodic_tuple {
+ Melodic_req *mel_l_ ;
+ Note_head *head_l_;
+ Moment end_;
+ CHead_melodic_tuple ();
+ CHead_melodic_tuple (Note_head*, Melodic_req*, Moment);
+ static int pitch_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &);
+ static int time_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &);
+};
+
+inline int compare (CHead_melodic_tuple const &a, CHead_melodic_tuple const &b)
+{
+ return CHead_melodic_tuple::time_compare (a,b);
+}
+
+
+class Tie_engraver : public Engraver
+{
+ PQueue<CHead_melodic_tuple> past_notes_pq_;
+ Tie_req *req_l_;
+ Array<CHead_melodic_tuple> now_heads_;
+ Array<CHead_melodic_tuple> stopped_heads_;
+ Link_array<Tie> tie_p_arr_;
+
+protected:
+ virtual void do_post_move_processing ();
+ virtual void do_pre_move_processing ();
+ virtual void acknowledge_element (Score_element_info);
+ virtual bool do_try_music (Music*);
+ virtual void do_process_requests ();
+ virtual void process_acknowledged ();
+public:
+ VIRTUAL_COPY_CONS(Translator);
+ Tie_engraver();
+
+};
+
+#endif /* CTIE_ENGRAVER_HH */
+
protected:
- virtual Molecule*brew_molecule_p() const;
+ virtual Molecule*do_brew_molecule_p() const;
public:
Time_signature () ;
Array<int> args_;
/**
ask daddy for a feature
*/
- Scalar get_property (String type_str);
+ Scalar get_property (String type_str, Translator const **where_found_l) const;
void set_property (String var_name, Scalar value);
Music_output_def *output_def_l () const;
Beam *beam_l_;
Link_array<Note_column> column_arr_;
- virtual Molecule* brew_molecule_p () const;
+ virtual Molecule* do_brew_molecule_p () const;
VIRTUAL_COPY_CONS(Score_element);
virtual void do_add_processing ();
bool last_b_;
protected:
- virtual Molecule* brew_molecule_p () const;
+ virtual Molecule* do_brew_molecule_p () const;
VIRTUAL_COPY_CONS(Score_element);
virtual void do_add_processing ();
while (iterations++ < MAXITER && act.degenerate_count_i_ < MAXDEGEN)
{
- //#ifdef PARANOID
if (experimental_features_global_b)
assert_solution (x);
- //#endif
Vector direction= - act.find_active_optimum (gradient);
for (Inactive_iter ia (act); ia.ok(); ia++)
{
Real dot = ia.vec() * direction;
- if (dot >= 0)
+ Real mindot = (experimental_features_global_b)
+ ? -EPS
+ : 0;
+
+ if (dot >= mindot)
continue;
-
+
Real numerator = ia.rhs () - ia.vec()*x;
if (numerator >= 0)
#include "debug.hh"
#include "item.hh"
#include "p-col.hh"
-// #include "elem-group.hh"
#include "spanner.hh"
Item::Item ()
Line_of_score *
Item::line_l() const
{
- Graphical_axis_group *ga = axis_group_l_a_[X_AXIS];
-
- if (!ga)
+ Graphical_element *g =parent_l (X_AXIS);
+ if (!g)
return 0;
-
- assert (dynamic_cast <Score_element *> (ga));
- return dynamic_cast <Score_element *> (ga)-> line_l ();
+ return dynamic_cast <Score_element *> (g)-> line_l ();
}
Direction
int
Item::left_right_compare(Item const *l, Item const *r)
{
- while (!(dynamic_cast<Paper_column const *> (l)))
- l = dynamic_cast<Item const*> (l->axis_group_l_a_[X_AXIS]);
- while (!(dynamic_cast<Paper_column const *> (r)))
- r = dynamic_cast<Item const*> (r->axis_group_l_a_[X_AXIS]);
-
- Paper_column *p1 = (Paper_column*)l;
- Paper_column* p2 = (Paper_column*)r;
+ Paper_column *p1 = l->column_l ();
+ Paper_column* p2 = r->column_l ();
return p1->rank_i () - p2->rank_i ();
}
Paper_column *
Item::column_l () const
{
- return dynamic_cast<Item*> (axis_group_l_a_[X_AXIS]) ->column_l ();
+ return dynamic_cast<Item*> (parent_l (X_AXIS))->column_l ();
}
Item::Item (Item const &s)
{
if (dynamic_cast <Clef_change_req *> (info.req_l_))
{
- int i= get_property ("createKeyOnClefChange").length_i ();
+ int i= get_property ("createKeyOnClefChange", 0).length_i ();
if (i)
create_key ();
}
{
old_accidental_idx_arr_ = accidental_idx_arr_;
key_.clear ();
- Scalar prop = get_property ("keyoctaviation");
+ Scalar prop = get_property ("keyoctaviation", 0);
if (prop.length_i () > 0)
{
key_.multi_octave_b_ = ! prop.to_bool ();
TODO space the `natural' signs wider
*/
Molecule*
-Key_item::brew_molecule_p() const
+Key_item::do_brew_molecule_p() const
{
Molecule*output = new Molecule;
Real inter = paper()->internote_f ();
void
Line_group_engraver_group::typeset_element (Score_element *elem)
{
- if (!elem->axis_group_l_a_[Y_AXIS])
+ if (!elem->parent_l (Y_AXIS))
staffline_p_->add_element (elem);
Engraver_group_engraver::typeset_element (elem);
}
Line_of_score::add_element (Score_element*e)
{
// avoid excess dependencies.
- if (!(e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
+ if (! (e->parent_l (X_AXIS) || e->parent_l (Y_AXIS)) )
add_dependency (e);
}
}
Molecule*
-Local_key_item::brew_molecule_p() const
+Local_key_item::do_brew_molecule_p() const
{
Molecule*output = new Molecule;
Interval x_int;
for (int i=0; i < support_items_.size(); i++)
{
- Graphical_axis_group *common =
+ Dimension_cache *common =
common_group (support_items_[i], X_AXIS);
- Real x = support_items_[i]->relative_coordinate (common, X_AXIS)
- -relative_coordinate (common, X_AXIS);
+ Real x = support_items_[i]->relative_coordinate (common, X_AXIS)
+ - relative_coordinate (common, X_AXIS);
- x_int.unite (x + support_items_[i]->width());
+ x_int.unite (x + support_items_[i]->extent (X_AXIS));
}
if (x_int.empty_b ())
x_int = Interval(0,0);
Jan Nieuwenhuizen <janneke@gnu.org>
TODO
- Read spacing info from AFMs
Glissando
*/
#include "file-path.hh"
#include "main.hh"
#include "lily-guile.hh"
+#include "all-fonts.hh"
+#include "afm.hh"
SCM
array_to_list (SCM *a , int l)
{
paper_l_ = 0;
symtables_p_ = new Symtables;
- afm_p_ =0;
+ afm_l_ = 0;
}
Lookup::Lookup (Lookup const& s)
{
- font_ = s.font_;
- font_path_ = s.font_path_;
+ font_name_ = s.font_name_;
paper_l_ = s.paper_l_;
symtables_p_ = new Symtables (*s.symtables_p_);
- afm_p_ = 0;
+ afm_l_ = 0;
}
Lookup::Lookup (Symtables const& s)
{
- font_ = s.font_;
- font_path_ = s.font_path_;
+ font_name_ = s.font_name_;
paper_l_ = 0;
symtables_p_ = new Symtables (s);
- afm_p_ = 0;
+ afm_l_ = 0;
}
Lookup::~Lookup ()
{
- delete afm_p_;
delete symtables_p_;
}
symtables_p_->add (s, p);
}
+
Atom
Lookup::afm_find (String s, bool warn) const
{
- if (!afm_p_)
- {
- *mlog << "[" << font_path_;
- ( (Lookup*)this)->afm_p_ = new Adobe_font_metric (read_afm (font_path_));
- *mlog << "]" << flush ;
- DOUT << this->afm_p_->str ();
- }
- Adobe_font_char_metric m = afm_p_->find_char (s, warn);
+ if (!afm_l_)
+ ((Lookup*)this)->afm_l_ = all_fonts_global_p->find_font (font_name_);
+
+ Adobe_font_char_metric m = afm_l_->find_char (s, warn);
Atom a;
if (m.code () < 0)
gh_int2scm (m.code ()),
SCM_UNDEFINED);
a.str_ = "afm_find: " + s;
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
a.dim_.y () = Interval (-h/2, h/2);
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
Real dy = d[Y_AXIS];
Atom a;
- a.font_ = font_;
+ a.font_ = font_name_;
a.dim_[X_AXIS] = Interval (0, dx);
a.dim_[Y_AXIS] = Interval (0 <? dy, 0 >? dy);
gh_double2scm (width),
SCM_UNDEFINED);
a.str_ = "extender";
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
gh_double2scm(-y1),
SCM_UNDEFINED);
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
return afm_find ("balls" + String ("-") +to_str (type) + "l");
}
-Dictionary<String> cmr_dict;
-Dictionary<Adobe_font_metric*> afm_p_dict;
+static Dict_initialiser<char const*> cmr_init[] = {
+ {"bold", "cmbx"},
+ {"dynamic", "feta-din"},
+ {"finger", "feta-nummer"},
+ {"italic", "cmti"},
+ {"roman", "cmr"},
+ {0,0}
+};
+
+static Dictionary<char const *> cmr_dict (cmr_init);
Atom
Lookup::text (String style, String text) const
Real font_w = a.dim_.x ().length ();
Real font_h = a.dim_.y ().length ();
- if (!cmr_dict.elem_b ("roman"))
- {
- //brrrr
- cmr_dict.elem ("bold") = "cmbx";
- cmr_dict.elem ("dynamic") = "feta-din";
- cmr_dict.elem ("finger") = "feta-nummer";
- cmr_dict.elem ("italic") = "cmti";
- cmr_dict.elem ("roman") = "cmr";
- }
-
- if (!afm_p_dict.elem_b (style))
+ if (cmr_dict.elem_b (style))
{
- Adobe_font_metric* afm_p = 0;
- String cmr_str = cmr_dict.elem (style) + to_str ((int) font_h) + ".afm";
- String font_path = global_path.find (cmr_str);
- if (!font_path.length_i ())
- {
- warning (_f("can't open file: `%s'", cmr_str.ch_C ()));
- warning (_f("guessing dimensions for font style: `%s'", style.ch_C ()));
- }
- else
- {
- *mlog << "[" << font_path;
- afm_p = new Adobe_font_metric (read_afm (font_path));
- DOUT << afm_p->str ();
- *mlog << "]" << flush ;
- }
- afm_p_dict.elem (style) = afm_p;
+ style = String (cmr_dict [style]) + to_str ((int)font_h); // ugh
}
Real w = 0;
- Adobe_font_metric* afm_p = afm_p_dict.elem (style);
+ Adobe_font_metric* afm_l = all_fonts_global_p->find_font (style);
DOUT << "\nChars: ";
+
for (int i = 0; i < text.length_i (); i++)
{
if (text[i]=='\\')
else
{
int c = text[i];
- if (afm_p && ((c >= 0) && (c < afm_p->char_metrics_.size ())))
+ int code = afm_l->ascii_to_metric_idx_[c];
+ if (code >=0)
{
- Adobe_font_char_metric m = afm_p->char_metrics_[c];
+ Adobe_font_char_metric m = afm_l->char_metrics_[code];
w += m.B_.x ().length ();
DOUT << to_str (m.B_.x ().length ()) << " ";
}
- else
- w += font_w;
}
}
DOUT << "\n" << to_str (w) << "\n";
a.dim_.x () = Interval (0, w);
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
SCM_UNDEFINED
);
a.dim_[Y_AXIS] = Interval (-y/2,y/2);
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
SCM_UNDEFINED);
a.dim_.x () = Interval (0, width);
a.dim_.y () = Interval (-2*height, 2*height);
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
a.dim_[X_AXIS] = Interval (0, dx);
a.dim_[Y_AXIS] = Interval (0 <? dy, 0 >? dy);
- a.font_ = font_;
+ a.font_ = font_name_;
return a;
}
Lookup::vbracket (Real &y) const
{
Atom a;
- Real min_y = paper_l_->staffheight_f ();
- if (y < min_y)
- {
- warning (_ ("bracket")
- + " " + _ ("too small") + " (" + print_dimen (y) + ")");
- // y = min_y;
- }
-
a.lambda_ = gh_list (ly_symbol ("bracket"),
gh_double2scm (y),
SCM_UNDEFINED);
SCM_UNDEFINED);
a.str_ = "volta";
Real interline_f = paper_l_->interline_f ();
-// a.dim_[Y_AXIS] = Interval (0, 2 * interline_f);
+
a.dim_[Y_AXIS] = Interval (-interline_f, interline_f);
a.dim_[X_AXIS] = Interval (0, w);
return a;
Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include "lyric-engraver.hh"
#include "musical-request.hh"
#include "text-item.hh"
#include "paper-def.hh"
#include "paper-def.hh"
#include "main.hh"
#include "dimensions.hh"
+#include "g-text-item.hh"
+
+
+#include "engraver.hh"
+#include "array.hh"
+#include "lily-proto.hh"
+
+class Lyric_engraver : public Engraver
+{
+protected:
+ virtual void do_pre_move_processing();
+ virtual bool do_try_music (Music*);
+ virtual void do_process_requests();
+
+public:
+ Lyric_engraver();
+ VIRTUAL_COPY_CONS(Translator);
+
+private:
+ Link_array<Lyric_req> lyric_req_l_arr_;
+ Link_array<Item> text_p_arr_;
+};
+
ADD_THIS_TRANSLATOR(Lyric_engraver);
+
Lyric_engraver::Lyric_engraver()
{
}
if (text_p_arr_.size ())
return;
- Scalar style = get_property ("textstyle");
- Scalar alignment = get_property ("textalignment");
for (int i=0; i < lyric_req_l_arr_.size (); i++)
{
Lyric_req* request_l = lyric_req_l_arr_[i];
- Text_def* text_p = new Text_def;
- text_p->text_str_ = request_l->text_str_;
- text_p->align_dir_ = LEFT;
+ G_text_item* item_p = new G_text_item;
+ item_p->text_str_ = request_l->text_str_;
+
+ Scalar style = get_property ("textstyle", 0);
if (style.length_i ())
- text_p->style_str_ = style;
- if (alignment.isnum_b())
- text_p->align_dir_= (Direction)(int)alignment;
+ item_p->style_str_ = style;
- Text_item* item_p = new Text_item (text_p);
- item_p->dir_ = DOWN;
- item_p->fat_b_ = true;
- // urg
- // item_p->translate (Offset (0, (i - 1) * item_p->height ().length_i ()));
-// if (i && ((Text_def*)text_p_arr_[i - 1]->tdef_p_)->text_str_.length_i ())
- // urg, when/how can one get the heigt of this thing?
- item_p->translate (Offset (0, - i * 12 PT));
text_p_arr_.push (item_p);
announce_element (Score_element_info (item_p, request_l));
}
#include <locale.h>
#include "lily-guile.hh"
+#include "all-fonts.hh"
#include "proto.hh"
#include "dimensions.hh"
#include "plist.hh"
bool find_old_relative_b = false;
char const* output_global_ch = "tex";
+All_font_metrics *all_fonts_global_p;
String default_outname_base_global = "lelie";
String outname_str_global;
main_prog (int argc, char **argv)
{
default_outname_base_global = "lelie";
-
+ all_fonts_global_p = new All_font_metrics (global_path.str ());
+
int p=0;
const char *arg ;
while ((arg= oparser_global_p->get_next_arg ()))
}
}
+#ifdef WINNT
+ gh_enter (argc, argv, main_prog);
+#else
gh_enter (argc, argv, (void(*)())main_prog);
+#endif
+
return 0; // unreachable
}
script_p_->specs_p_ = td_p->clone ();
script_p_->postbreak_only_b_ = true;
- Scalar padding = get_property ("markScriptPadding");
+ Scalar padding = get_property ("markScriptPadding", 0);
if (padding.length_i() && padding.isnum_b ())
{
script_p_->padding_f_ = Real(padding);
}
- Scalar break_priority = get_property ("markBreakPriority");
+ Scalar break_priority = get_property ("markBreakPriority", 0);
if (break_priority.length_i() && break_priority.isnum_b ())
{
script_p_->break_priority_i_ = int(break_priority);
#include "midi-def.hh"
#include "translator.hh"
#include "performance.hh"
-#include "assoc-iter.hh"
#include "score-performer.hh"
#include "debug.hh"
#endif
}
-
-
-
int Midi_def::default_count_i_=0;
+
int
Midi_def::get_next_default_count () const
{
for (int j =0; j < its.size(); j++)
{
- iv.unite (its[j]->width());
+ iv.unite (its[j]->extent (X_AXIS));
}
return iv;
}
Molecule*
-Multi_measure_rest::brew_molecule_p () const
+Multi_measure_rest::do_brew_molecule_p () const
{
/*
[TODO] 3
{
}
-Music_list*
-Music_list_iterator::music_list_l () const
-{
- return (Music_list *) music_l_;
-}
-
Moment
Music_list_iterator::next_moment () const
{
-Plet_req::Plet_req ()
-{
- plet_i_ = 0;
-}
-void
-Plet_req::do_print () const
-{
-}
Extender_req::Extender_req ()
{
#include "notename-table.hh"
#include "interval.hh"
#include "identifier.hh"
-#include "assoc-iter.hh"
#include "parser.hh"
#include "keyword.hh"
-#include "assoc.hh"
#include "my-lily-lexer.hh"
#include "debug.hh"
#include "source-file.hh"
Note_column::head_positions_interval() const
{
((Note_column*)this)->sort();
- Interval_t<int> iv;
+ Interval_t<int> iv;
- iv.set_empty ();
+ iv.set_empty ();
- if (head_l_arr_.size ())
- iv = Interval_t<int>(head_l_arr_[0]->position_i_,
- head_l_arr_.top()->position_i_);
+ if (head_l_arr_.size ())
+ iv = Interval_t<int>(head_l_arr_[0]->position_i_,
+ head_l_arr_.top()->position_i_);
return iv;
}
+/*
Interval
-Note_column::width () const
+Note_column::do_width () const
{
if (head_l_arr_.size ())
- return head_l_arr_[0]->width ();
+ return head_l_arr_[0]->extent (X_AXIS);
else
return Interval (0,0);
}
-
+*/
void
Note_column::do_pre_processing()
{
-
if (!dir_)
{
if (stem_l_)
dir_ = stem_l_->dir_;
else if (head_l_arr_.size ())
{
- dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP;
+ assert (false); // looks obsolete?
+ dir_ = sign (head_positions_interval().center ());
}
}
Script_column::do_pre_processing();
stem_l_ = stem_l;
/*
don't add stem to support; mostly invisible for rest-columns (and possibly taken . .)
- */
+ */
Score_element::add_dependency (stem_l);
for (int i=0; i < script_l_arr_.size(); i++)
script_l_arr_[i]->set_stem (stem_l);
}
Molecule*
-Note_head::brew_molecule_p() const
+Note_head::do_brew_molecule_p() const
{
Molecule*out = 0;
Paper_def *p = paper();
{
int transposing_i = 0;
//urg
- Scalar prop = get_property ("transposing");
+ Scalar prop = get_property ("transposing", 0);
if (!prop.empty_b () && prop.isnum_b ())
transposing_i = prop;
Item const*r=r_item_l;
// huh? see Item::left_right_compare ()
+ /*
while (! (dynamic_cast<Paper_column const *> (l)))
l = dynamic_cast<Item*> (l->axis_group_l_a_[X_AXIS]);
while (! (dynamic_cast<Paper_column const *> (r)))
r = dynamic_cast<Item*>(r->axis_group_l_a_[X_AXIS]);
-
+ */
+ l = l->column_l ();
+ r = r->column_l ();
+
PCursor<Paper_column*> start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ());
PCursor<Paper_column*> stop (r ? find_col ((Paper_column*)r) : col_p_list_.bottom ());
#include <math.h>
#include "string.hh"
-#include "assoc.hh"
#include "misc.hh"
#include "paper-def.hh"
#include "debug.hh"
#include "lookup.hh"
-#include "assoc-iter.hh"
#include "score-engraver.hh"
#include "p-score.hh"
#include "identifier.hh"
Paper_def::Paper_def ()
{
- lookup_p_assoc_p_ = new Assoc<int, Lookup*>;
+ lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
}
Paper_def::~Paper_def ()
{
- for (Assoc_iter<int, Lookup*> ai(*lookup_p_assoc_p_); ai.ok (); ai++)
+ for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
{
delete ai.val ();
}
- delete lookup_p_assoc_p_;
+ delete lookup_p_tab_p_;
}
Paper_def::Paper_def (Paper_def const&s)
: Music_output_def (s)
{
- lookup_p_assoc_p_ = new Assoc<int, Lookup*>;
- for (Assoc_iter<int, Lookup*> ai(*s.lookup_p_assoc_p_); ai.ok (); ai++)
+ lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
+ for (Hash_table_iter<int, Lookup*> ai(*s.lookup_p_tab_p_); ai.ok (); ai++)
{
Lookup * l = new Lookup (*ai.val ());
l->paper_l_ = this;
void
Paper_def::set_lookup (int i, Lookup*l)
{
- if (lookup_p_assoc_p_->elem_b (i))
+ if (lookup_p_tab_p_->elem_b (i))
{
- delete lookup_p_assoc_p_->elem (i);
+ delete lookup_p_tab_p_->elem (i);
}
l ->paper_l_ = this;
- (*lookup_p_assoc_p_)[i] = l;
+ (*lookup_p_tab_p_)[i] = l;
}
Real
Music_output_def::print ();
DOUT << "Paper {";
- for (Assoc_iter<int, Lookup*> ai(*lookup_p_assoc_p_); ai.ok (); ai++)
+ for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
{
DOUT << "Lookup: " << ai.key () ;
ai.val ()->print ();
Lookup const *
Paper_def::lookup_l (int i) const
{
- return (*lookup_p_assoc_p_)[i];
+ return (*lookup_p_tab_p_)[i];
}
if (safe_global_b)
{
ly_set_scm ("security-paranoia", SCM_BOOL_T);
- gh_eval_str ("(set! security-paranoia #t)");
+ // gh_eval_str ("(set! security-paranoia #t)");
}
String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))";
gh_eval_str (s.ch_C());
$$ = $1->access_content_Request (true);
}
| '~' {
- $$ = new Command_tie_req;
+ $$ = new Tie_req;
}
| '[' {
Beam_req*b= new Beam_req;
$$ = $1->access_content_Symtables (true);
}
| symtables_body FONT STRING {
- $$->font_ = *$3;
- $$->font_path_ = global_path.find (*$3);
- if (!$$->font_path_.length_i ())
- THIS->here_input ().error (_f("can't open file: `%s'", $3->ch_C()));
-
+ $$->font_name_ = *$3;
delete $3;
}
| symtables_body STRING '=' symtable {
{
if (Repeated_music* r = dynamic_cast<Repeated_music *> (m))
{
- r->unfold_b_ = get_property ("unfoldRepeats").to_bool ();
+ r->unfold_b_ = get_property ("unfoldRepeats", 0).to_bool ();
if (r->unfold_b_)
return true;
}
Molecule *
-Rest::brew_molecule_p () const
+Rest::do_brew_molecule_p () const
{
int staff_size_i_ = 8;
bool streepjes_b = abs(position_i_) > staff_size_i_ /2 &&
{
if (! ncol_p_->h_shift_b_)
// egcs
- ncol_p_->h_shift_b_ = get_property ("hshift").operator bool ();
+ ncol_p_->h_shift_b_ = get_property ("hshift", 0).operator bool ();
if (! ncol_p_->dir_)
- ncol_p_->dir_ =(Direction) int(get_property ("ydirection"));
+ ncol_p_->dir_ =(Direction) int(get_property ("ydirection", 0));
typeset_element (ncol_p_);
ncol_p_ =0;
{
if (dots_i_ && !dots_l_)
{
- Dots *d = new Dots;
+ assert (false);
+ /* Dots *d = new Dots;
add_dots (d);
pscore_l_->typeset_element (d);
+
+
+
axis_group_l_a_[Y_AXIS]->add_element (d);
- axis_group_l_a_[X_AXIS]->add_element (d);
+ axis_group_l_a_[X_AXIS]->add_element (d);*/
}
if (dots_l_)
{
#include "misc.hh"
#include "paper-outputter.hh"
-#define PARANOID
-
Score_element::Score_element()
{
+ output_p_ =0;
transparent_b_ = false;
size_i_ = 0;
pscore_l_=0;
dependents.
*/
copy_edges_out (s);
+ output_p_ =0;
transparent_b_ = s.transparent_b_;
status_i_ = s.status_i_;
pscore_l_ = s.pscore_l_;
Score_element::~Score_element()
{
+ delete output_p_;
assert (status_i_ >=0);
}
{
Interval r;
- Molecule*m = brew_molecule_p();
+ Molecule*m = output_p_ ? output_p_ : do_brew_molecule_p();
r = m->extent().x ();
- delete m;
+
+ if (!output_p_)
+ delete m;
return r;
}
Score_element::do_height() const
{
Interval r;
- Molecule*m = brew_molecule_p();
+ Molecule*m = output_p_ ? output_p_ : do_brew_molecule_p();
r = m->extent().y ();
- delete m;
+ if (!output_p_)
+ delete m;
+
return r;
}
}
void
-Score_element::do_brew_molecule ()
+Score_element::output_processing ()
{
if (transparent_b_)
return;
- Molecule *output= brew_molecule_p ();
- for (PCursor<Atom*> i(output->atoms_); i.ok(); i++)
+ if (output_p_)
+ delete output_p_;
+
+ output_p_ = do_brew_molecule_p ();
+ for (PCursor<Atom*> i(output_p_->atoms_); i.ok(); i++)
{
i->origin_l_ = this;
}
- pscore_l_->outputter_l_->output_molecule (output, absolute_offset (), classname(this));
- delete output;
+ pscore_l_->outputter_l_->output_molecule (output_p_,
+ absolute_offset (),
+ classname(this));
}
/*
Molecule*
-Score_element::brew_molecule_p() const
+Score_element::do_brew_molecule_p() const
{
Atom a (lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
return new Molecule (a);
{
Item *item_p = dynamic_cast <Item *> (elem_p);
pscore_p_->typeset_element (item_p);
- if (!item_p->axis_group_l_a_[X_AXIS]) {
- if (item_p->breakable_b_)
- command_column_l_->add_element(item_p);
- else
- musical_column_l_->add_element(item_p);
- }
+ if (!item_p->parent_l (X_AXIS))
+ {
+ if (item_p->breakable_b_)
+ command_column_l_->add_element(item_p);
+ else
+ musical_column_l_->add_element(item_p);
+ }
}
scoreline_l_->add_element (elem_p);
}
#include "horizontal-group-item.hh"
#include "score-priority-engraver.hh"
#include "item.hh"
-#include "assoc-iter.hh"
+#include "dictionary-iter.hh"
#include "break-align-item.hh"
void
Score_priority_engraver::do_pre_move_processing()
{
- for (Assoc_iter<int, Horizontal_group_item*> i(align_p_assoc_); i.ok() ; i++)
+ for (Hash_table_iter<int, Horizontal_group_item*> i(align_p_tab_);
+ i.ok() ; i++)
{
if (i.val ())
{
typeset_element (i.val ());
- i.val () = 0;
+ i.val_ref () = 0;
}
}
- align_p_assoc_.clear ();
+ align_p_tab_.clear ();
}
void
int priority =item_l->break_priority_i_;
Horizontal_group_item * hg =0;
- if (!align_p_assoc_.elem_b(priority))
+ if (!align_p_tab_.elem_b(priority))
{
hg = new Horizontal_group_item;
announce_element (Score_element_info (hg,0));
- align_p_assoc_[priority] = hg;
+ align_p_tab_[priority] = hg;
hg->break_priority_i_ = priority;
hg->breakable_b_ = true;
}
else
- hg = align_p_assoc_[priority];
+ hg = align_p_tab_[priority];
Score_element * unbound_elem = inf.elem_l_;
- while (unbound_elem->axis_group_l_a_[X_AXIS])
+ /*
+ ugh
+ */
+ while (unbound_elem->parent_l (X_AXIS))
{
/* We might have added inf.elem_l_ earlier because we added one
of its children. We don't want to add ourselves to ourself
*/
- if (unbound_elem->axis_group_l_a_[X_AXIS] == hg)
+ Graphical_element * e = unbound_elem->parent_l (X_AXIS);
+ if (e == hg)
return;
- unbound_elem = dynamic_cast<Score_element*> (unbound_elem->axis_group_l_a_[X_AXIS]);
+ unbound_elem = dynamic_cast<Score_element*> (e);
}
hg->add_element (unbound_elem);
Text_def * td_l = (Text_def*)script_p->specs_p_;
if (!td_l->style_str_.length_i ())
{
- Scalar style = get_property ("textstyle");
+ Scalar style = get_property ("textstyle", 0);
if (style.to_bool ())
td_l->style_str_= style;
}
// urg, what if this is already set? in-band signaling...
- Scalar alignment = get_property ("textalignment");
+ Scalar alignment = get_property ("textalignment", 0);
if (alignment.isnum_b())
{
td_l->align_dir_= (Direction)(int)alignment;
}
Molecule*
-Script::brew_molecule_p () const
+Script::do_brew_molecule_p () const
{
Real dx =0.;
Separating_line_group_engraver::acknowledge_element (Score_element_info i)
{
Item * it = dynamic_cast <Item *> (i.elem_l_);
- if (it && !it->axis_group_l_a_[X_AXIS])
+ if (it && !it->parent_l (X_AXIS))
{
Single_malt_grouping_item *&p_ref_ (it->breakable_b_
? break_malt_p_ : nobreak_malt_p_);
#include "sequential-music-iterator.hh"
#include "music-list.hh"
-
void
Sequential_music_iterator::do_print() const
{
iter_p_ =0;
}
-Sequential_music*
-Sequential_music_iterator::sequential_music_l () const
-{
- return (Sequential_music *)music_l_;
-}
-
void
Sequential_music_iterator::construct_children()
{
- cursor_p_ = new PCursor<Music*> (sequential_music_l ()->music_p_list_p_->top ());
+ cursor_p_ = new PCursor<Music*> (dynamic_cast<Sequential_music const*> (music_l_)->music_p_list_p_->top ());
while (cursor_p_->ok())
{
Simultaneous_music_iterator::construct_children()
{
int j = 0;
- for (PCursor<Music*> i (simultaneous_music_l ()->music_p_list_p_->top());
+ Simultaneous_music const *sim = dynamic_cast<Simultaneous_music const*> (music_l_);
+ for (PCursor<Music*> i (sim->music_p_list_p_->top());
i.ok(); j++, i++)
{
Music_iterator * mi = get_iterator_p (i.ptr());
if (mi->ok())
{
- if (simultaneous_music_l ()->translator_type_str_.empty_b ())
- set_translator (mi->report_to_l()->ancestor_l (0));
+ if (sim->translator_type_str_.empty_b ())
+ set_translator (mi->report_to_l()->ancestor_l (0)); // huh?
children_p_list_.bottom().add (mi);
}
else
return children_p_list_.size();
}
-Simultaneous_music*
-Simultaneous_music_iterator::simultaneous_music_l ()const
-{
- return ( Simultaneous_music *) music_l_;
-}
{
Item *il = item_l_arr_[i];
assert (pc == il->column_l ());
- w.unite (il->width () + il->relative_coordinate (pc, X_AXIS));
+ w.unite (il->extent (X_AXIS) + il->relative_coordinate (&pc->dim_cache_[X_AXIS], X_AXIS));
}
return w;
// push a new slur onto stack.
//(use temp. array to wait for all slur STOPs)
Slur * s_p =new Slur;
- Scalar prop = get_property ("slurdash");
+ Scalar prop = get_property ("slurdash", 0);
if (prop.isnum_b ())
s_p->dash_i_ = prop;
requests_arr_.push (slur_req_l);
void
Slur_engraver::do_pre_move_processing()
{
- Scalar dir (get_property ("slurydirection"));
- Scalar dir2 (get_property ("ydirection"));
+ Scalar dir (get_property ("slurydirection", 0));
+ Scalar dir2 (get_property ("ydirection", 0));
Direction slurdir = CENTER;
if (dir.length_i () && dir.isnum_b ())
{
// ugh -- check if needed
dx_f_drul_[d] = -d
- *(spanned_drul_[d]->width ().length () - 0.5 * notewidth_f);
+ *(spanned_drul_[d]->extent (X_AXIS).length () - 0.5 * notewidth_f);
// prebreak
if (d == RIGHT)
{
- dx_f_drul_[LEFT] = spanned_drul_[LEFT]->width ().length ();
+ dx_f_drul_[LEFT] = spanned_drul_[LEFT]->extent (X_AXIS).length ();
// urg -- check if needed
if (encompass_arr_.size () > 1)
else if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_
&& extrema[d]->head_l_arr_.size ())
{
- Real notewidth_f = extrema[d]->width ().length ();
- dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height ()[dir_]);
+ Real notewidth_f = extrema[d]->extent (X_AXIS).length ();
+ dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_-> extent (Y_AXIS)[dir_]);
dx_f_drul_[d] += 0.5 * notewidth_f - d * gap_f;
if (dir_ == extrema[d]->stem_l_->dir_)
{
}
else
{
- Real notewidth_f = extrema[d]->width ().length ();
+ Real notewidth_f = extrema[d]->extent (X_AXIS).length ();
dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval ()
[dir_]) * internote_f;
dx_f_drul_[d] += 0.5 * notewidth_f - d * gap_f;
Real damp_f = paper ()->get_var ("slur_slope_damping");
Offset d_off = Offset (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT],
dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]);
- d_off.x () += width ().length ();
+ d_off.x () += extent (X_AXIS).length ();
Real ratio_f = abs (d_off.y () / d_off.x ());
if (ratio_f > damp_f)
Offset d = Offset (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT],
dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]);
- d.x () += width ().length ();
+ d.x () += extent (X_AXIS).length ();
int first = 1;
int last = encompass_arr_.size () - 1;
/*
- use a property? get_property ("singleStaffBracket") ?
+ use a property? get_property ("singleStaffBracket", 0) ?
--hwn
*/
}
Molecule*
-Span_bar::brew_molecule_p () const
+Span_bar::do_brew_molecule_p () const
{
Interval y_int;
for (int i=0; i < spanning_l_arr_.size (); i++)
{
- Graphical_axis_group *common =
+ Dimension_cache*common =
common_group (spanning_l_arr_[i], Y_AXIS);
- Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS)
- -relative_coordinate (common,Y_AXIS);
+ Real y = spanning_l_arr_[i]->dim_cache_[Y_AXIS].relative_coordinate (common)
+ -dim_cache_[Y_AXIS].relative_coordinate (common);
- y_int.unite (y + spanning_l_arr_[i]->height ());
+ y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
}
Atom s = get_bar_sym (y_int.length ());
}
void
-Spanner::do_brew_molecule ()
+Spanner::output_processing ()
{
if (transparent_b_)
return ;
- Molecule *output= brew_molecule_p ();
+ output_p_ = do_brew_molecule_p ();
Offset left_off (spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), 0);
Offset o = absolute_offset() + left_off;
- pscore_l_->outputter_l_->output_molecule (output, o, classname (this));
- delete output;
+ pscore_l_->outputter_l_->output_molecule (output_p_, o, classname (this));
}
Interval
/*
TODO: take out the refs to width
+
*/
/**
generate springs between columns.
- TODO: This needs rethinking.
+ TODO: This needs rethinking.......
* Spacing should take optical
effects into account
Real interline_f = paper_l ()->interline_f ();
- Array<Real> ideal_arr_;
- Array<Real> hooke_arr_;
+ Array<Real> ideal_arr;
+ Array<Real> hooke_arr;
for (int i=0; i < cols_.size() - 1; i++){
- ideal_arr_.push (-1.0);
- hooke_arr_.push (1.0);
+ ideal_arr.push (-1.0);
+ hooke_arr.push (1.0);
}
/*
{
Real symbol_distance =cols_[i].width_[RIGHT] + 2 PT;
Real durational_distance = 0;
-
-
Moment delta_t = scol_l (i+1)->when() - scol_l (i)->when () ;
-
/*
ugh should use shortest_playing distance
*/
symbol_distance += -cols_[i+1].width_[LEFT];
- ideal_arr_[i] = symbol_distance >? durational_distance;
- hooke_arr_[i] = 1; //2.0;
+ ideal_arr[i] = symbol_distance >? durational_distance;
+ hooke_arr[i] = 1; //2.0;
}
}
* whitespace at the begin of the bar should be fixed at
(about) one interline.
+
[Ross]:
when spacing gets real tight, a smaller fixed value may be
used, so that there are two discrete amounts of whitespace
* whitespace at the end of the bar is the normal amount of
"hinterfleish" that would have been used, had there been
yet another note in the bar.
+
[Ross]:
some editors argue that the bar line should not take any
space, not to hinder the flow of music spaced around a bar
line.
+
[Ross] and [Wanske] do not suggest this, however. Further,
- it introduces some spacing problems and think that it is ugly
+ it introduces some spacing problems and I think that it is ugly
too.
+
[jcn]
*/
// fixed: probably should set minimum (rod/spring)?
cols_[i-1].width_[RIGHT] += interline_f;
// should adjust dist too?
- ideal_arr_[i-1] = ideal_arr_[i-1] >? (2 * interline_f);
+ ideal_arr[i-1] = ideal_arr[i-1] >? (2 * interline_f);
}
/*
+ interline_f / 2;
dist = dist >? minimum;
}
- ideal_arr_[i] = dist;
+ ideal_arr[i] = dist;
}
}
- for (int i=0; i < ideal_arr_.size(); i++)
+ /*
+ shorter distances should stretch less.
+
+ (and how bout
+
+ hooke[i] = 2 * max_ideal_space - ideal[i]
+
+ ?)
+ */
+ for (int i=0; i < ideal_arr.size(); i++)
+ hooke_arr[i] = 1/ideal_arr[i];
+
+ for (int i=0; i < ideal_arr.size(); i++)
{
- assert (ideal_arr_[i] >=0 && hooke_arr_[i] >=0);
- connect (i, i+1, ideal_arr_[i], hooke_arr_[i]);
+ assert (ideal_arr[i] >=0 && hooke_arr[i] >=0);
+ connect (i, i+1, ideal_arr[i], hooke_arr[i]);
}
}
|| (i.origin_grav_l_arr_.size() != 1))
return;
- String string = get_property ("instrument");
- String str = get_property ("instr");
+ String string = get_property ("instrument", 0);
+ String str = get_property ("instr", 0);
if (now_moment () > Moment (0))
string = str;
script_p_->breakable_b_ = true;
- Scalar pri = get_property ("marginBreakPriority");
+ Scalar pri = get_property ("marginBreakPriority", 0);
if (pri.length_i () && pri.isnum_b ())
{
script_p_->break_priority_i_ = int (pri);
Staff_performer::new_instrument_str ()
{
// mustn't ask Score for instrument: it will return piano!
- String str = get_property ("midi_instrument");
+ String str = get_property ("midi_instrument", 0);
if (!str.length_i ())
- str = get_property ("instrument");
+ str = get_property ("instrument", 0);
if (str == instrument_str_)
return "";
Interval y_int;
for (int i=0; i < support_l_arr_.size(); i++)
{
- Graphical_axis_group *common =
+ Dimension_cache *common =
common_group (support_l_arr_[i], axis_);
Real y = support_l_arr_[i]->relative_coordinate (common, axis_)
void
Staff_symbol_engraver::do_removal_processing()
{
- Scalar l (get_property ("numberOfStaffLines"));
+ Scalar l (get_property ("numberOfStaffLines", 0));
if (l.isnum_b ())
{
span_p_->no_lines_i_ = l;
}
Molecule*
-Staff_symbol::brew_molecule_p() const
+Staff_symbol::do_brew_molecule_p() const
{
- Real w = width ().length ();
+ Real w = extent (X_AXIS).length ();
Real left_dx = -spanned_drul_[LEFT]->extent (X_AXIS)[LEFT];
Real right_dx = spanned_drul_[RIGHT]->extent (X_AXIS)[RIGHT];
// w += right_dx+ left_dx;
stem_p_ = 0;
abbrev_p_ = 0;
default_abbrev_i_ = 16;
- dir_ = CENTER;
}
void
Stem_engraver::do_creation_processing ()
{
- Scalar prop = get_property ("abbrev");
+ Scalar prop = get_property ("abbrev", 0);
if (prop.isnum_b ())
{
default_abbrev_i_ = prop;
typeset_element (abbrev_p_);
abbrev_p_ = 0;
}
+
if (stem_p_)
{
- Scalar prop = get_property ("ydirection");
- dir_ = prop.isnum_b () ? (Direction)int(prop) : CENTER;
- if (dir_)
+ Scalar prop = get_property ("ydirection", 0);
+ Direction dir = prop.isnum_b () ? (Direction)int(prop) : CENTER;
+ if (dir)
{
- stem_p_->dir_ = dir_;
+ stem_p_->dir_ = dir;
stem_p_->dir_forced_b_ = true;
}
+ Translator const *which;
+ prop = get_property ("stemLeftBeamCount", &which);
+ if (prop.isnum_b ())
+ {
+ stem_p_->beams_i_drul_[LEFT] = prop;
+ ((Translator*)which)->set_property ("stemLeftBeamCount", "");
+ }
+ prop = get_property ("stemRightBeamCount", &which);
+ if (prop.isnum_b ())
+ {
+ stem_p_->beams_i_drul_[RIGHT] = prop;
+ ((Translator*)which)->set_property ("stemRightBeamCount", "");
+ }
+
+
typeset_element(stem_p_);
stem_p_ = 0;
}
bool
Stem_engraver::do_try_music (Music* r)
{
- Musical_req* mus_l = dynamic_cast <Musical_req *> (r);
- if (!mus_l)
- return false;
-
- Abbreviation_req* a = dynamic_cast <Abbreviation_req *> (mus_l);
- if (!a)
- return false;
-
- abbrev_req_l_ = a;
-
- return true;
+ if (Abbreviation_req* a = dynamic_cast <Abbreviation_req *> (r))
+ {
+ abbrev_req_l_ = a;
+ return true;
+ }
+ return false;
}
/*
TODO: staff-size
*/
- beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = 0;
+ beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = -1;
mult_i_ = 0;
yextent_drul_[DOWN] = yextent_drul_[UP] = 0;
const Real ANGLE = 20* (2.0*M_PI/360.0); // ugh!
Molecule*
-Stem::brew_molecule_p () const
+Stem::do_brew_molecule_p () const
{
Molecule *mol_p =new Molecule;
Drul_array<Real> stem_y = yextent_drul_;
Real head_wid = 0;
if (head_l_arr_.size ())
- head_wid = head_l_arr_[0]->width ().length ();
+ head_wid = head_l_arr_[0]->extent (X_AXIS).length ();
stem_y[Direction(-dir_)] += dir_ * head_wid * tan(ANGLE)/(2*dy);
if (!invisible_b ())
Real r=0;
if (head_l_arr_.size())
{
- Interval head_wid(0, head_l_arr_[0]->width ().length ());
+ Interval head_wid(0, head_l_arr_[0]->extent (X_AXIS).length ());
Real rule_thick(paper ()->rule_thickness ());
Interval stem_wid(-rule_thick/2, rule_thick/2);
if (stem_xdir_ == CENTER)
TODO: head_l_arr_/rest_l_arr_ in do_substitute_dependent ()
*/
void
- Stem::do_substitute_dependency (Score_element*o,Score_element*n)
+Stem::do_substitute_dependency (Score_element*o,Score_element*n)
{
- Item * o_l = dynamic_cast <Item *> (o);
- Item * n_l = n? dynamic_cast <Item *> (n) : 0;
- head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
- rest_l_arr_.substitute ((Rest*)o_l, (Rest*)n_l);
+ if (Note_head*h=dynamic_cast<Note_head*> (o))
+ head_l_arr_.substitute (h, dynamic_cast<Note_head*>(n));
+ if (Rest *r=dynamic_cast<Rest*> (o))
+ rest_l_arr_.substitute (r, dynamic_cast<Rest*>(n));
}
Super_element::output_all ()
{
pscore_l_->outputter_l_->start_line ();
- calculate_dependencies (BREWING, BREWED, &Score_element::do_brew_molecule);
+ calculate_dependencies (BREWING, BREWED, &Score_element::output_processing);
pscore_l_->outputter_l_->stop_line ();
}
Symtables::Symtables (Symtables const &s)
: Dictionary<Symtable*> (s)
{
- font_ = s.font_;
- font_path_ = s.font_path_;
+ font_name_ = s.font_name_;
+
for (Dictionary_iter< Symtable*> i (s); i.ok(); i++)
{
add (i.key(), new Symtable (*i.val ()));
#include "pcursor.tcc"
#include "plist.tcc"
-POINTERLIST_INSTANTIATE(Audio_item);
-POINTERLIST_INSTANTIATE(Audio_staff);
-POINTERLIST_INSTANTIATE(Paper_column);
-POINTERLIST_INSTANTIATE(Paper_score);
#endif
#include "proto.hh"
#include "plist.hh"
-#include "audio-item.hh"
+#include "audio-element.hh"
#include "audio-column.hh"
#include "midi-item.hh"
#include "cursor.tcc"
--- /dev/null
+/*
+ text-engraver.cc -- implement Text_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "engraver.hh"
+#include "g-staff-side.hh"
+#include "g-text-item.hh"
+#include "text-def.hh"
+#include "note-head.hh"
+#include "stem.hh"
+
+class Text_engraver : public Engraver
+{
+ Link_array<Script_req> reqs_;
+ Link_array<G_staff_side_item> positionings_;
+ Link_array<G_text_item> texts_;
+public:
+ Text_engraver();
+ VIRTUAL_COPY_CONS(Translator);
+protected:
+ virtual bool do_try_music (Music* m);
+ virtual void do_pre_move_processing ();
+ virtual void do_post_move_processing ();
+ virtual void do_process_requests ();
+ virtual void acknowledge_element (Score_element_info);
+};
+
+Text_engraver::Text_engraver ()
+{
+
+}
+
+bool
+Text_engraver::do_try_music (Music *m)
+{
+ if (Script_req *r = dynamic_cast<Script_req*> (m))
+ {
+ Text_def * t = dynamic_cast<Text_def*> (r->scriptdef_p_);
+ if (!t)
+ return false;
+ reqs_.push (r);
+ return true;
+ }
+ return false;
+}
+
+
+void
+Text_engraver::acknowledge_element (Score_element_info i)
+{
+ if (Note_head *n = dynamic_cast<Note_head*> (i.elem_l_))
+ {
+ for (int i=0; i < positionings_.size (); i++)
+ {
+ positionings_[i]->add_support (n);
+ }
+ }
+ if (Stem *n = dynamic_cast<Stem*> (i.elem_l_))
+ {
+ for (int i=0; i < positionings_.size (); i++)
+ {
+ positionings_[i]->add_support (n);
+ }
+ }
+}
+
+void
+Text_engraver::do_process_requests ()
+{
+ for (int i=0; i < reqs_.size (); i++)
+ {
+ Script_req * r = reqs_[i];
+ Text_def * t= dynamic_cast<Text_def*> (r->scriptdef_p_);
+
+ G_text_item *text = new G_text_item;
+ G_staff_side_item *ss = new G_staff_side_item;
+ ss->set_victim (text);
+
+ text->text_str_ = t->text_str_;
+
+ announce_element (Score_element_info (text, r));
+ announce_element (Score_element_info (ss, r));
+
+ texts_.push (text);
+ positionings_.push (ss);
+ }
+}
+
+void
+Text_engraver::do_pre_move_processing ()
+{
+ for (int i=0; i < texts_.size (); i++)
+ {
+ typeset_element (texts_[i]);
+ typeset_element (positionings_[i]);
+ }
+ texts_.clear ();
+ positionings_.clear ();
+}
+
+void
+Text_engraver::do_post_move_processing ()
+{
+ reqs_.clear ();
+}
+
+ADD_THIS_TRANSLATOR(Text_engraver);
}
Molecule*
-Text_item::brew_molecule_p () const
+Text_item::do_brew_molecule_p () const
{
Atom a (tdef_p_->get_atom (paper (), dir_));
}
Molecule*
-Text_spanner::brew_molecule_p() const
+Text_spanner::do_brew_molecule_p() const
{
Atom tsym (spec_p_->get_atom (paper(),CENTER));
tsym.translate (text_off_);
Interval
Text_spanner::height() const
{
- return brew_molecule_p()->extent ().y ();
+ return do_brew_molecule_p()->extent ().y ();
}
void
--- /dev/null
+/*
+ ctie-engraver.cc -- implement Tie_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "tie-engraver.hh"
+#include "command-request.hh"
+#include "note-head.hh"
+#include "musical-request.hh"
+#include "tie.hh"
+
+Tie_engraver::Tie_engraver()
+{
+ req_l_ = 0;
+}
+
+
+bool
+Tie_engraver::do_try_music (Music *m)
+{
+ if (Tie_req * c = dynamic_cast<Tie_req*> (m))
+ {
+ req_l_ = c;
+ return true;
+ }
+ return false;
+}
+
+void
+Tie_engraver::acknowledge_element (Score_element_info i)
+{
+ if (Note_head *nh = dynamic_cast<Note_head *> (i.elem_l_))
+ {
+ Note_req * m = dynamic_cast<Note_req* > (i.req_l_);
+ now_heads_.push (CHead_melodic_tuple (nh, m, now_moment()+ m->duration ()));
+ }
+}
+
+void
+Tie_engraver::do_process_requests ()
+{
+ if (req_l_)
+ {
+ Moment now = now_moment ();
+ Link_array<Note_head> nharr;
+
+ stopped_heads_.clear ();
+ while (past_notes_pq_.size ()
+ && past_notes_pq_.front ().end_ == now)
+ stopped_heads_.push (past_notes_pq_.get ());
+
+ }
+}
+
+void
+Tie_engraver::process_acknowledged ()
+{
+ if (req_l_)
+ {
+ if (now_heads_.size () != stopped_heads_.size ())
+ {
+ req_l_->warning ("Unequal number of note heads for tie");
+ }
+ int sz = now_heads_.size () <? stopped_heads_.size ();
+
+ // hmm. Should do something more sensible.
+ // because, we assume no more noteheads come along after the 1st pass.
+ if (sz > tie_p_arr_.size ())
+ {
+ now_heads_.sort (CHead_melodic_tuple::pitch_compare);
+ stopped_heads_.sort(CHead_melodic_tuple::pitch_compare);
+
+ for (int i=0; i < sz; i++)
+ {
+ Tie * p = new Tie;
+ p->set_head (LEFT, stopped_heads_[i].head_l_);
+ p->set_head (RIGHT, now_heads_[i].head_l_);
+ tie_p_arr_.push (p);
+ announce_element (Score_element_info (p, req_l_));
+ }
+ }
+ }
+}
+
+void
+Tie_engraver::do_pre_move_processing ()
+{
+ for (int i=0; i < now_heads_.size (); i++)
+ {
+ past_notes_pq_.insert (now_heads_[i]);
+ }
+ now_heads_.clear( );
+
+ for (int i=0; i< tie_p_arr_.size (); i++)
+ {
+ typeset_element (tie_p_arr_[i]);
+ }
+ tie_p_arr_.clear ();
+}
+
+void
+Tie_engraver::do_post_move_processing ()
+{
+ req_l_ =0;
+ Moment now = now_moment ();
+ while (past_notes_pq_.size () && past_notes_pq_.front ().end_ < now)
+ past_notes_pq_.delmin ();
+}
+
+
+
+ADD_THIS_TRANSLATOR(Tie_engraver);
+
+
+CHead_melodic_tuple::CHead_melodic_tuple ()
+{
+ head_l_ =0;
+ mel_l_ =0;
+ end_ = 0;
+}
+
+CHead_melodic_tuple::CHead_melodic_tuple (Note_head *h, Melodic_req*m, Moment mom)
+{
+ head_l_ = h;
+ mel_l_ = m;
+ end_ = mom;
+}
+
+int
+CHead_melodic_tuple::pitch_compare (CHead_melodic_tuple const&h1,
+ CHead_melodic_tuple const &h2)
+{
+ return Melodic_req::compare (*h1.mel_l_, *h2.mel_l_);
+}
+
+int
+CHead_melodic_tuple::time_compare (CHead_melodic_tuple const&h1,
+ CHead_melodic_tuple const &h2)
+{
+ return (h1.end_ - h2.end_ ).sign ();
+}
// uhm? loose end of tie // tie attached to stem
else
{
- dx_f_drul_[d] = -d * (spanned_drul_[d]->width ().length ()
+ dx_f_drul_[d] = -d * (spanned_drul_[d]->extent (X_AXIS).length ()
-0.5 * notewidth);
}
}
Real damp_f = paper ()->get_var ("tie_slope_damping");
Offset d_off = Offset (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT],
dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]);
- d_off.x () += width ().length ();
+ d_off.x () += extent (X_AXIS).length ();
Real ratio_f = abs (d_off.y () / d_off.x ());
if (ratio_f > damp_f)
{
if (time_signature_p_)
{
- Scalar sigstyle = get_property ("timeSignatureStyle");
+ Scalar sigstyle = get_property ("timeSignatureStyle", 0);
if (sigstyle.length_i ())
{
time_signature_p_->time_sig_type_str_ = sigstyle;
}
Molecule*
-Time_signature::brew_molecule_p () const
+Time_signature::do_brew_molecule_p () const
{
Atom s;
if (time_sig_type_str_.length_i ())
/* allbars == ! skipbars */
- bool allbars = ! get_property ("SkipBars").to_bool ();
+ bool allbars = ! get_property ("SkipBars", 0).to_bool ();
if (!time_.cadenza_b_ && allbars)
}
Scalar
-Translator::get_property (String id)
+Translator::get_property (String id, Translator const **where_l) const
{
if (properties_dict_.elem_b (id))
{
+ if (where_l)
+ *where_l = this;
return properties_dict_[id];
}
if (daddy_trans_l_)
- return daddy_trans_l_->get_property (id);
+ return daddy_trans_l_->get_property (id, where_l);
+ if (where_l)
+ *where_l = 0;
return "";
}
}
Molecule*
-Plet_spanner::brew_molecule_p () const
+Plet_spanner::do_brew_molecule_p () const
{
Molecule* mol_p = new Molecule;
{
Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_]
- column_arr_[0]->extent (Y_AXIS) [dir_];
- Real w = width ().length () + ncw;
+ Real w = extent (X_AXIS).length () + ncw;
num.translate (Offset (w/2, dy/2));
mol_p->add_atom (lookup_l ()->plet (dy, w, dir_));
void
Vertical_align_engraver::do_removal_processing()
{
- Scalar dist (get_property ("maxVerticalAlign"));
+ Scalar dist (get_property ("maxVerticalAlign", 0));
if (dist.length_i () && dist.isnum_b ())
{
valign_p_->threshold_interval_[BIGGER] = Real (dist);
}
- dist = get_property ("minVerticalAlign");
+ dist = get_property ("minVerticalAlign", 0);
if (dist.length_i () && dist.isnum_b ())
{
valign_p_->threshold_interval_[SMALLER] = Real (dist);
void
Vertical_align_engraver::acknowledge_element (Score_element_info i)
{
- if (i.origin_grav_l_arr_.size() == 1 &&
- dynamic_cast<Vertical_group_spanner *> (i.elem_l_) &&
- !i.elem_l_->axis_group_l_a_[Y_AXIS])
+ if (i.origin_grav_l_arr_.size() == 1
+ && dynamic_cast<Vertical_group_spanner *> (i.elem_l_)
+ && !i.elem_l_->parent_l (Y_AXIS))
{
assert (!valign_p_->contains_b (i.elem_l_));
#include "item.hh"
#include "p-col.hh"
-
-
-
Vertical_group_spanner::Vertical_group_spanner ()
{
- axis1_ = axis2_ = Y_AXIS;
+ axes_[0] = axes_[1] = Y_AXIS;
}
}
Molecule*
-Volta_spanner::brew_molecule_p () const
+Volta_spanner::do_brew_molecule_p () const
{
Molecule* mol_p = new Molecule;
{
Real internote_f = paper ()->internote_f ();
Real dx = internote_f;
- Real w = width ().length () - 2 * dx;
+ Real w = extent (X_AXIS).length () - 2 * dx;
Atom volta (lookup_l ()->volta (w, last_b_));
Real h = volta.dim_.y ().length ();
Atom num (number_p_->get_atom (paper (), LEFT));
Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_] >
column_arr_[0]->extent (Y_AXIS) [dir_];
dy += 2 * h;
+
+ /*
+ UGH. Must use extent ()[dir_]
+ */
for (int i = 0; i < note_column_arr_.size (); i++)
- dy = dy >? note_column_arr_[i]->height ().max ();
+ dy = dy >? note_column_arr_[i]->extent (Y_AXIS).max ();
dy -= h;
Real gap = num.dim_.x ().length () / 2;
--- /dev/null
+% The base file for Computer Modern (a supplement to {\tt plain.mf})
+
+cmbase:=1; % when |cmbase| is known, this file has been input
+
+let cmchar=\; % `|cmchar|' should precede each character
+let generate=input; % `|generate|' should follow the parameters
+
+autorounding:=0; smoothing:=0; % we do our own rounding
+def autorounded = interim autorounding:=2 enddef;
+
+newinternal slant,fudge,math_spread,superness,superpull,beak_darkness,ligs;
+boolean square_dots,hefty,serifs,
+ monospace,variant_g,low_asterisk,math_fitting;
+
+boolean dark,dark.dark,skewed,skewed.skewed; % for fast option testing
+dark=skewed=false; dark.dark=skewed.skewed=true;
+
+vardef Vround primary y = y_:=vround y;
+ if y_<min_Vround: min_Vround else: y_ fi enddef;
+newinternal y_,min_Vround;
+
+vardef serif(suffix $,$$,@) % serif at |z$| for stroke from |z$$|
+ (expr darkness,jut) suffix modifier =
+ pickup crisp.nib; numeric bracket_height; pair downward;
+ bracket_height=if dark.modifier: 1.5 fi\\ bracket;
+ if y$<y$$: y@2=min(y$+bracket_height,y$$);
+ top y@1-slab=bot y@0+eps=tiny.bot y$; downward=z$-z$$;
+ if y@1>y@2: y@2:=y@1; fi
+ else: y@2=max(y$-bracket_height,y$$);
+ bot y@1+slab=top y@0-eps=tiny.top y$; downward=z$$-z$;
+ if y@1<y@2: y@2:=y@1; fi fi
+ y@3=y@2; z@3=whatever[z$,z$$];
+ if jut<0: z@2+penoffset downward of currentpen =
+ z$l+penoffset downward of pen_[tiny.nib]+whatever*downward;
+ lft x@0=lft x@1=tiny.lft x$l+jut;
+ if x@3<x@2+eps: x@3:=x@2+eps; fi
+ else: z@2-penoffset downward of currentpen =
+ z$r-penoffset downward of pen_[tiny.nib]+whatever*downward;
+ rt x@0=rt x@1=tiny.rt x$r+jut;
+ if x@3>x@2-eps: x@3:=x@2-eps; fi fi
+ pair corner; ypart corner=y@1; corner=z@2+whatever*downward;
+ filldraw z@2{z$-z$$}
+ ...darkness[corner,.5[z@1,z@2] ]{z@1-z@2}
+ ...{jut,0}z@1--z@0--(x$,y@0)--z@3--cycle; % the serif
+ labels (@1,@2); enddef;
+
+def dish_serif(suffix $,$$,@)(expr left_darkness,left_jut)
+ (suffix @@)(expr right_darkness,right_jut) suffix modifier =
+ serif($,$$,@,left_darkness,-left_jut) modifier;
+ serif($,$$,@@,right_darkness,right_jut) modifier;
+ if dish>0: pickup tiny.nib; numeric dish_out,dish_in;
+ if y$<y$$: dish_out=bot y$; dish_in=dish_out+dish; let rev_=reverse;
+ else: dish_out=top y$; dish_in=dish_out-dish; let rev_=relax; fi
+ erase fill rev_
+ ((x@1,dish_out)..(x$,dish_in){right}..(x@@1,dish_out)--cycle);
+ fi enddef;
+
+def nodish_serif(suffix $,$$,@)(expr left_darkness,left_jut)
+ (suffix @@)(expr right_darkness,right_jut) suffix modifier =
+ serif($,$$,@,left_darkness,-left_jut) modifier;
+ serif($,$$,@@,right_darkness,right_jut) modifier; enddef;
+
+vardef sloped_serif.l(suffix $,$$,@)(expr darkness,jut,drop) =
+ pickup crisp.nib; pos@2(slab,90);
+ lft x@0=tiny.lft x$l; rt x@1=tiny.rt x$r; top y@1=tiny.top y$r;
+ lft x@2=lft x@0-jut; y@2r=y@1-drop;
+ y@0=max(y@2l-bracket,y$$)-eps;
+ if drop>0: erase fill z@1--top z@1
+ --(x@2r,top y@1)--z@2r--cycle; fi % erase excess at top
+ filldraw z@1--z@2r--z@2l{right}
+ ...darkness[(x@0,y@2l),.5[z@2l,z@0] ]{z@0-z@2l}
+ ...{down}z@0--(x@1,y@0)--cycle; % sloped serif
+ labels(@0,@1,@2); enddef;
+
+vardef sloped_serif.r(suffix $,$$,@)(expr darkness,jut,drop) =
+ pickup crisp.nib; pos@2(slab,-90);
+ rt x@0=tiny.rt x$r; lft x@1=tiny.lft x$l; bot y@1=tiny.bot y$l;
+ rt x@2=rt x@0+jut; y@2r=y@1+drop;
+ y@0=min(y@2l+bracket,y$$)+eps;
+if drop>0: erase fill z@1--bot z@1
+ --(x@2r,bot y@1)--z@2r--cycle; fi % erase excess at bottom
+ filldraw z@1--z@2r--z@2l{left}
+ ...darkness[(x@0,y@2l),.5[z@2l,z@0] ]{z@0-z@2l}
+ ...{up}z@0--(x@1,y@0)--cycle; % sloped serif
+ labels(@0,@1,@2); enddef;
+
+vardef term.l(suffix $,$$)(expr d,t,s)= % ``robust'' sans-serif terminal
+ path p_; p_=z$l{d}..tension t..z$$l;
+ pair d_; d_=(x$$l-x$l,s*(y$$l-y$l));
+ if (abs angle direction 1 of p_ < abs angle d_)<>(x$l<x$$l):
+ p_:=z$l{d}..tension atleast t..{d_}z$$l; fi
+ p_ enddef;
+vardef term.r(suffix $,$$)(expr d,t,s)=
+ path p_; p_=z$r{d}..tension t..z$$r;
+ pair d_; d_=(x$$r-x$r,s*(y$$r-y$r));
+ if (abs angle direction 1 of p_ < abs angle d_)<>(x$r<x$$r):
+ p_:=z$r{d}..tension atleast t..{d_}z$$r; fi
+ p_ enddef;
+def rterm=reverse term enddef;
+
+vardef arm(suffix $,$$,@)(expr darkness,jut) = % arm from |z$| to |z$$|
+ x@0=good.x(x$$r-jut); y@0=y$r;
+ if serifs: y@1=y$l; z@1=z$$l+whatever*(z$$r-z@0);
+ z@2=.5[z$l,z@1];
+ filldraw z$$l{z@1-z$$l}...darkness[z@1,.5[z@2,z$$l] ]...z@2
+ ---z$l--z$r--z@0--z$$r--cycle; % arm and beak
+ else: filldraw z$l--z$r--z@0--z$$r--cycle; fi % sans-serif arm
+ penlabels(@0,@1,@2); enddef;
+
+def pi_stroke = pickup fine.nib;
+ pos1(hair,0); pos2(vstem,-90); pos3(vstem,-90);
+ x1-.5hair=hround -.5hair; x2=2u; x3=w-1.5u;
+ y1=x_height-x_height/3.141592653589793; y2=y3; top y3l=x_height;
+ filldraw circ_stroke z3e---z2e...{x1-x2,3.14159(y1-y2)}z1e enddef;
+
+def bulb(suffix $,$$,$$$) =
+ z$$$r=z$$r;
+ path_.l:=z$l{x$$r-x$r,0}...{0,y$$r-y$r}z$$l;
+ filldraw path_.l--z$$r{0,y$r-y$$r}...{x$r-x$$r,0}z$r--cycle; % link
+ path_.r:=z$$$l{0,y$r-y$$r}..z$$$r{0,y$$r-y$r}; % near-circle
+ filldraw subpath(0,xpart(path_.r intersectiontimes path_.l)) of path_.r
+ --z$$r{0,y$$r-y$r}..cycle; % bulb
+ enddef;
+
+def v_bulb(suffix $,$$)= % |pos$| is known
+ y$$+.5curve=x_height+oo; x$$+.5curve=w-u;
+ numeric theta; theta=angle(4(x$-x$$),y$-y$$); pos$$(curve,theta+90);
+ filldraw z$$l{dir theta}..tension atleast 1 and 1..{down}z$l
+ --z$r{up}...{-dir theta}z$$r..cycle; % bulb
+ enddef;
+
+def dot(suffix $,$$) =
+ filldraw if square_dots: (x$l,y$$l)--(x$r,y$$l)
+ --(x$r,y$$r)--(x$l,y$$r)--cycle % squarish dot
+ else: z$l...z$$l...z$r...z$$r...cycle fi % roundish dot
+ enddef;
+
+def comma(suffix $,@)(expr dot_size,jut,depth) =
+ pickup fine.nib; pos$(dot_size,90);
+ if square_dots: pos$'(dot_size,0); z$'=z$; dot($',$); % squarish dot
+ comma_join_:=max(fine.breadth,floor .7dot_size);
+ comma_bot_:=max(fine.breadth,floor .5dot_size);
+ pos@0(comma_join_,0); pos@1(comma_join_,0);
+ pos@2(comma_bot_,0); y@0=y$; y@1=y$l; y@2=y@1-depth;
+ x@0r=x@1r=x$'r; rt x@2r=good.x(x$-eps);
+ filldraw stroke z@0e--z@1e..z@2e; % tail
+ else: pos@1(vair,90); pos@2(vair,0); pos@3(vair,-45);
+ z@1r=z$r; rt x@2r=hround(x$+.5dot_size+jut)+2eps; x@3=x$-.5u;
+ y@2=1/3[y@1,y@3]; bot y@3r=vround(y$-.5dot_size-depth);
+ y_:=ypart((z@1{right}...z@2{down}...z@3)
+ intersectiontimes (z$l{right}..{left}z$r)); if y_<0: y_:=1; fi
+ filldraw z$r{left}..subpath (0,y_) of (z$l{right}..{left}z$r)--cycle; % dot
+ filldraw stroke z@1e{right}...z@2e{down}...z@3e; fi % tail
+ penlabels(@1,@2,@3); enddef;
+
+def ammoc(suffix $,@)(expr dot_size,jut,depth) = % reversed comma
+ pickup fine.nib; pos$(dot_size,90);
+ if square_dots: pos$'(dot_size,0); z$'=z$; dot($',$); % squarish dot
+ comma_join_:=max(fine.breadth,floor .7dot_size);
+ comma_top_:=max(fine.breadth,floor .5dot_size);
+ pos@0(comma_join_,0); pos@1(comma_join_,0);
+ pos@2(comma_top_,0); y@0=y$; y@1=y$r; y@2=y@1+depth;
+ x@0l=x@1l=x$'l; lft x@2l=good.x(x$+eps);
+ filldraw stroke z@0e--z@1e..z@2e; % tail
+ else: pos@1(vair,90); pos@2(vair,0); pos@3(vair,-45);
+ z@1l=z$l; lft x@2l=hround(x$-.5dot_size-jut)-2eps; x@3=x$+.5u;
+ y@2=1/3[y@1,y@3]; top y@3l=vround(y$+.5dot_size+depth);
+ y_:=ypart((z@1{left}...z@2{up}...z@3)
+ intersectiontimes (z$r{left}..{right}z$l)); if y_<0: y_:=1; fi
+ filldraw z$l{right}..subpath (0,y_) of (z$r{left}..{right}z$l)--cycle; % dot
+ filldraw stroke z@1e{left}...z@2e{up}...z@3e; fi % tail
+ penlabels(@1,@2,@3); enddef;
+
+%%% @ from to %%%% temporary formatting change
+vardef diag_in(suffix from,$)(expr sharpness)(suffix $$) =
+ pickup tiny.nib; save from_x,y_;
+ if y.from>y$: bot else: top fi\\ y_=y$;
+ (from_x,y_)=whatever[z.from,z$];
+ sharpness[z$,(from_x,y_)]{z$-z.from}
+ ...{z$$-z$}z$+sharpness*length(z$-(from_x,y_))*unitvector(z$$-z$) enddef;
+
+vardef diag_out(suffix $)(expr sharpness)(suffix $$,to) =
+ pickup tiny.nib; save to_x,y_;
+ if y.to>y$: bot else: top fi\\ y_=y$;
+ (to_x,y_)=whatever[z$$,z.to];
+ z$$-sharpness*length(z$$-(to_x,y_))*unitvector(z$$-z$){z$$-z$}
+ ...{z.to-z$$}sharpness[z$$,(to_x,y_)] enddef;
+
+vardef diag_end(suffix from,$)(expr sharpness_in,sharpness_out)(suffix $$,to)=
+ save from_x,to_x,y_,x_,xx_;
+ if y.from>y$: tiny.bot else: tiny.top fi\\ y_=y$; % we assume that |y$=y$$|
+ (from_x,y_)=whatever[z.from,z$]; (to_x,y_)=whatever[z$$,z.to];
+ if x$$>x$: x_=x$+sharpness_in*length(z$-(from_x,y_));
+ xx_=x$$-sharpness_out*length(z$$-(to_x,y_));
+ if xx_<x_: xx_:=x_:=.5[xx_,x_]; fi
+ else: x_=x$-sharpness_in*length(z$-(from_x,y_));
+ xx_=x$$+sharpness_out*length(z$$-(to_x,y_));
+ if xx_>x_: xx_:=x_:=.5[xx_,x_]; fi fi
+ sharpness_in[z$,(from_x,y_)]{z$-z.from}
+ ...{z$$-z$}(x_,y$)..(xx_,y$){z$$-z$}
+ ...{z.to-z$$}sharpness_out[z$$,(to_x,y_)] enddef;
+%%% at from to %%%% restore normal formatting
+
+vardef special_diag_end(suffix $$,$,@,@@) = % for top middle of w's
+ if x@r<=x$r: diag_end($$r,$r,1,1,@l,@@l)
+ else: z0=whatever[z$$l,z$l]=whatever[z@l,z@@l];
+ diag_end($$r,$r,1,1,$l,0)--z0 fi enddef;
+
+def prime_points_inside(suffix $,$$) =
+ theta_:=angle(z$r-z$l);
+ penpos$'(whatever,theta_);
+ if y$$>y$: z$'=(0,pen_top) rotated theta_ + whatever[z$l,z$r];
+ theta_:=angle(z$$-z$)-90;
+ else: z$'=(0,pen_bot) rotated theta_ + whatever[z$l,z$r];
+ theta_:=angle(z$$-z$)+90; fi
+ z$'l+(pen_lft,0) rotated theta_=z$l+whatever*(z$-z$$);
+ z$'r+(pen_rt,0) rotated theta_=z$r+whatever*(z$-z$$);
+ enddef;
+
+def ellipse_set(suffix $,@,@@,$$) = % given |z$,x@,z$$|, find |y@| and |z@@|
+% such that the path |z${x@-x$,0}..z@{0,y@-y$}..{z$$-z@@}z@@|
+% is consistent with an ellipse
+% and such that the line |z@@--z$$| has a given |slope|
+ alpha_:=slope*(x@-x$); beta_:=y$$-y$-slope*(x$$-x$);
+ gamma_:=alpha_/beta_;
+ y@-y$=.5(beta_-alpha_*gamma_);
+ x@@-x$=-2gamma_*(x@-x$)/(1+gamma_*gamma_);
+ y@@-y$$=slope*(x@@-x$$) enddef;
+
+vardef diag_ratio(expr a,b,y,c) = % assuming that $a>\vert b/y\vert$,
+% compute the value $\alpha=(x\6{++}y)/y$ such that $ax+b\alpha=c$
+ numeric a_,b_,c_; b_=b/y; c_=c/y; a_=a*a-b_*b_;
+ (a*(c_++sqrt a_)-b_*c_)/a_ enddef;
+
+def f_stroke(suffix $,$$,@,left_serif,right_serif)(expr left_jut,right_jut)=
+ pickup tiny.nib; bot y$=0;
+ penpos@0(x$r-x$l,0); x@0l=x$l; top y@0=x_height;
+ filldraw stroke z$e--z@0e; % stem
+ pickup fine.nib; pos@0'(x$r-x$l-(hround stem_corr)+tiny,180);
+ y@0'=y@0; lft x@0'r=tiny.lft x$l;
+ penpos@1(x@0'l-x@0'r,180); x@1=x@0'; y@1+.5vair=.5[x_height,h];
+ pos@2(vair,90); top y@2r=h+oo;
+ if serifs: x@2=.6[x@1,x$$r]; (x@,y@2r)=whatever[z@2l,z@1l];
+ x@2r:=min(x@,.5[x@2,x$$r]); pos@3(hair,0); bulb(@2,@3,$$); % bulb
+ filldraw stroke z@0'e--z@1e & super_arc.e(@1,@2); % arc
+ dish_serif($,@0,left_serif,1/3,left_jut,right_serif,1/3,right_jut); % serif
+ else: x@2=.6[x@1,x$$]; y@1l:=1/3[y@1l,y@2l];
+ filldraw stroke z@0'e--z@1e & super_arc.e(@1,@2)
+ & term.e(@2,$$,right,.9,4); fi % arc and terminal
+ penlabels(@0,@1,@2); enddef;
+
+def h_stroke(suffix $,@,@@,$$) =
+ penpos$$(x@@r-x@@l,0); x$$=x@@; bot y$$=0;
+ y@@=1/3[bar_height,x_height];
+ penpos$''(x$r-x$l,0); x$''=x$; y$''=1/8[bar_height,x_height];
+ filldraw stroke z$''e--z$e; % thicken the lower left stem
+ penpos@0(min(rt x$r-lft x$l,thin_join)-fine,180); pickup fine.nib;
+ rt x@0l=tiny.rt x$r; y@0=y$'';
+ pos@1(vair,90); pos@@'(x@@r-x@@l+tiny,0); z@@'=z@@;
+ x@1=.5[rt x@0l,rt x@@'r]; top y@1r=x_height+oo;
+ (x@,y@1l)=whatever[z@1r,z@0l]; x@1l:=x@;
+ filldraw stroke z@0e{up}...{right}z@1e
+ &{{interim superness:=hein_super; super_arc.e(@1,@@')}}; % arch
+ pickup tiny.nib; filldraw stroke z@@e--z$$e; % right stem
+ labels(@0); penlabels(@1); enddef;
+
+def hook_out(suffix $,$$,$$$)suffix modifier= % |x$| and |x$$$| (only) are known
+ pos$(stem,0); pos$$(vair,90);
+ x$$$:=hround(x$$$+.5hair-eps)-.5hair; pos$$$(hair,180);
+ y$=1/4x_height; bot y$$l=-oo; y$$$=1/3x_height;
+ if skewed.modifier: x$$=x$+1.25u;
+ filldraw stroke z$e{-u,-x_height}...z$$e{right}...{up}z$$$e; % hook
+ else: x$$=x$+1.5u;
+ filldraw stroke z$e{down}...z$$e{right}
+ ...{x$$$-(x$+2.5u),x_height}z$$$e; fi enddef; % hook
+
+def hook_in(suffix $,$$,$$$)suffix modifier= % |x$| and |x$$$| (only) are known
+ x$:=hround(x$-.5hair)+.5hair; pos$(hair,180);
+ pos$$(vair,90); pos$$$(stem,0);
+ y$=2/3x_height; top y$$r=x_height+oo; y$$$=3/4x_height;
+ if skewed.modifier: x$$=x$$$-1.25u;
+ filldraw stroke z$e{up}...z$$e{right}...{-u,-x_height}z$$$e; % hook
+ else: x$$=x$$$-1.5u;
+ filldraw stroke z$e{x$$$-2.5u-x$,x_height}
+ ...z$$e{right}...{down}z$$$e; fi enddef; % hook
+
+def ital_arch(suffix $,$$,$$$) = % |z$| and |z$$$| (only) are known
+ pos$'(hair,180); z$'=z$;
+ pos$$(vair,90); pos$$$(stem,0);
+ {{interim superness := more_super; x$$=.6[x$,x$$$];
+ top y$$r=x_height+oo; y$$$=.65x_height;
+ filldraw stroke z$'e{up}...super_arc.e($$,$$$);}} enddef; % stroke
+
+def compute_spread(expr normal_spread,big_spread)=
+ spread#:=math_spread[normal_spread,big_spread];
+ spread:=2ceiling(spread#*hppp/2)+eps; enddef;
+
+def v_center(expr h_sharp) =
+ .5h_sharp+math_axis#, .5h_sharp-math_axis# enddef;
+
+def circle_points =
+ x4=x8=.5[x2,x6]; x1=x3=superness[x4,x2]; x5=x7=superness[x4,x6];
+ y2=y6=.5[y4,y8]; y1=y7=superness[y2,y8]; y3=y5=superness[y2,y4];
+ enddef;
+def draw_circle =
+ draw z8{right}...z1{z2-z8}...z2{down}...z3{z4-z2}...z4{left}
+ ...z5{z6-z4}...z6{up}...z7{z8-z6}...cycle enddef;
+
+def left_paren(expr min_breadth, max_breadth) =
+ pickup fine.nib; pos1(hround min_breadth,0);
+ pos2(hround max_breadth,0); pos3(hround min_breadth,0);
+ rt x1r=rt x3r=hround(w-1.25u+.5min_breadth); lft x2l=hround 1.25u;
+ top y1=h; y2=.5[y1,y3]; bot y3=1-d;
+ filldraw stroke z1e{3(x2e-x1e),y2-y1}...z2e
+ ...{3(x3e-x2e),y3-y2}z3e; % arc
+ penlabels(1,2,3); enddef;
+
+def right_paren(expr min_breadth, max_breadth) =
+ pickup fine.nib; pos1(hround min_breadth,0);
+ pos2(hround max_breadth,0); pos3(hround min_breadth,0);
+ lft x1l=lft x3l=hround(1.25u-.5min_breadth); rt x2r=hround(w-1.25u);
+ top y1=h; y2=.5[y1,y3]; bot y3=1-d;
+ filldraw stroke z1e{3(x2e-x1e),y2-y1}...z2e
+ ...{3(x3e-x2e),y3-y2}z3e; % arc
+ penlabels(1,2,3); enddef;
+
+def left_bracket(expr breadth,do_top,do_bot) =
+ pickup crisp.nib;
+ numeric thickness; thickness=hround breadth;
+ pos1(thickness,0); pos2(thickness,0);
+ top y1=h; bot y2=1-d; lft x1l=lft x2l=hround(2.5u-.5thickness);
+ filldraw stroke z1e--z2e; % stem
+ pos3(thickness,90); pos4(thickness,90);
+ pos5(thickness,90); pos6(thickness,90);
+ x3=x5=x1l; rt x4=rt x6=hround(w-.75u+.5thickness);
+ y3r=y4r=y1; y5l=y6l=y2;
+ if do_top: filldraw stroke z3e--z4e; fi % upper bar
+ if do_bot: filldraw stroke z5e--z6e; fi % lower bar
+ penlabels(1,2,3,4,5,6); enddef;
+
+def right_bracket(expr breadth,do_top,do_bot) =
+ pickup crisp.nib;
+ numeric thickness; thickness=hround breadth;
+ pos1(thickness,0); pos2(thickness,0);
+ top y1=h; bot y2=1-d; rt x1r=rt x2r=hround(w-2.5u+.5thickness);
+ filldraw stroke z1e--z2e; % stem
+ pos3(thickness,90); pos4(thickness,90);
+ pos5(thickness,90); pos6(thickness,90);
+ x3=x5=x1r; lft x4=lft x6=hround(.75u-.5thickness);
+ y3r=y4r=y1; y5l=y6l=y2;
+ if do_top: filldraw stroke z3e--z4e; fi % upper bar
+ if do_bot: filldraw stroke z5e--z6e; fi % lower bar
+ penlabels(1,2,3,4,5,6); enddef;
+
+def left_curly(expr min_breadth, max_breadth) =
+ pickup fine.nib;
+ forsuffixes $=1,1',4,4',7,7': pos$(hround min_breadth,0); endfor
+ forsuffixes $=2,3,5,6: pos$(hround max_breadth,0); endfor
+ x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
+ lft x4l=hround(1.5u-.5min_breadth); lft x2l=hround(.5w-.5max_breadth);
+ top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
+ y1-y2=y3-y4=(y1-y4)/4;
+ y1-y1'=y4-y4'=y7'-y7=vround(min_breadth-fine);
+ filldraw z1l{3(x2l-x1l),y2-y1}...z2l---z3l...{3(x4l-x3l),y4-y3}z4l
+ --z4'l{3(x5l-x4l),y5-y4'}...z5l---z6l...{3(x7l-x6l),y7-y6}z7l
+ --z7r--z7'r{3(x6r-x7r),y6-y7'}...z6r---z5r
+ ...{3(x4r-x5r),.5[y4,y4']-y5}.5[z4r,z4'r]{3(x3r-x4r),y3-.5[y4,y4']}
+ ...z3r---z2r...{3(x1r-x2r),y1'-y2}z1'r--z1r--cycle; % stroke
+ penlabels(1,2,3,4,5,6,7); enddef;
+
+def right_curly(expr min_breadth, max_breadth) =
+ pickup fine.nib;
+ forsuffixes $=1,1',4,4',7,7': pos$(hround min_breadth,0); endfor
+ forsuffixes $=2,3,5,6: pos$(hround max_breadth,0); endfor
+ x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
+ lft x1l=hround(1.5u-.5min_breadth); lft x2l=hround(.5w-.5max_breadth);
+ top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
+ y1-y2=y3-y4=(y1-y4)/4;
+ y1-y1'=y4-y4'=y7'-y7=vround(min_breadth-fine);
+ filldraw z1r{3(x2r-x1r),y2-y1}...z2r---z3r...{3(x4r-x3r),y4-y3}z4r
+ --z4'r{3(x5r-x4r),y5-y4'}...z5r---z6r...{3(x7r-x6r),y7-y6}z7r
+ --z7l--z7'l{3(x6l-x7l),y6-y7'}...z6l---z5l
+ ...{3(x4l-x5l),.5[y4,y4']-y5}.5[z4l,z4'l]{3(x3l-x4l),y3-.5[y4,y4']}
+ ...z3l---z2l...{3(x1l-x2l),y1'-y2}z1'l--z1l--cycle; % stroke
+ penlabels(1,2,3,4,5,6,7); enddef;
+
+def left_angle(expr breadth) =
+ pickup pencircle scaled breadth;
+ x1=x3=good.x(w-u)+eps; lft x2=hround u-eps;
+ top y1=h+eps; .5[y1,y3]=y2=good.y .5[-d+eps,h];
+ draw z1--z2--z3; % diagonals
+ labels(1,2,3); enddef;
+
+def right_angle(expr breadth) =
+ pickup pencircle scaled breadth;
+ x1=x3=good.x u-eps; rt x2=hround(w-u)+eps;
+ top y1=h+eps; .5[y1,y3]=y2=good.y .5[-d+eps,h];
+ draw z1--z2--z3; % diagonals
+ labels(1,2,3); enddef;
+
+def big_slash(expr breadth) =
+ adjust_fit(-letter_fit#,-letter_fit#); pickup pencircle scaled breadth;
+ rt x1=hround(w-u); lft x2=hround u; top y1=h+eps; bot y2=1-d-eps;
+ draw z1--z2; % diagonal
+ labels(1,2); enddef;
+
+def big_blash(expr breadth) =
+ adjust_fit(-letter_fit#,-letter_fit#); pickup pencircle scaled breadth;
+ lft x1=hround u; rt x2=hround(w-u); top y1=h+eps; bot y2=1-d-eps;
+ draw z1--z2; % diagonal
+ labels(1,2); enddef;
+
+def big_sqrt =
+ adjust_fit(0,-letter_fit#); pickup rule.nib;
+ x1=good.x 4/9w; x2=good.x(w+.5); bot y1=-d; bot y2=0;
+ draw z1--z2; % diagonal
+ pickup crisp.nib; pos3(max(curve,rule_thickness),0);
+ x3l=1.5[x2,x1]; y3=.5[y1,y2];
+ pos4(rule_thickness,0); x4=x1; bot y4=-d;
+ pos5(vair,-45); x5l=good.x(x3l-u); z5l=whatever[z3r,z2];
+ z6=z5r+whatever*(z2-z3r)=whatever[z3l,z4l];
+ z7=whatever[z1,z2]=z3r+whatever*(z4l-z3l);
+ filldraw z5r--z6--z4l--z4--z7--z3r--z5l--cycle; % left diagonal and serif
+ penlabels(1,2,3,4,5,6,7); enddef;
+
+def big_hat =
+ adjust_fit(0,0);
+ pickup crisp.nib; pos2(.6[vair,curve],90); top y2r=h+o; x2=.5w;
+ x1=w-x3=good.x -eps; y1=y3=.5[x_height,y2];
+ pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90);
+ filldraw stroke z1e--z2e--z3e; % diagonals
+ penlabels(1,2,3); enddef;
+
+def big_tilde =
+ adjust_fit(0,0); pickup crisp.nib;
+ numeric theta; theta=angle(1/6(w-vair),1/4(h-x_height));
+ numeric mid_width; mid_width=.4[vair,stem];
+ pos1(vair,theta+90); pos2(vair,theta+90);
+ pos3(vair,theta+90); pos4(vair,theta+90);
+ z2-z1=z4-z3=(mid_width-crisp)*dir theta;
+ lft x1r=w-rt x4l=0; top y4r=h;
+ bot y1l=vround(bot y1l+min(2/3[x_height,h],y3l-.25vair)-top y1r);
+ pair delta; ypart delta=3(y3l-y1l); delta=whatever*dir theta;
+ filldraw z1l..controls(z1l+delta)and(z3l-delta)..z3l..z4l
+ --z4r..controls(z4r-delta)and(z2r+delta)..z2r..z1r--cycle; % stroke
+ penlabels(1,2,3,4); enddef;
+
+def beginarithchar(expr c) = % ensure consistent dimensions for $+$, $-$, etc.
+ if monospace: beginchar(c,14u#,27/7u#+math_axis#,27/7u#-math_axis#);
+ else: beginchar(c,14u#,6u#+math_axis#,6u#-math_axis#); fi
+ italcorr math_axis#*slant-.5u#;
+ adjust_fit(0,0); enddef;
+
+newinternal l,r,shrink_fit; % adjustments to spacing
+
+def do_expansion(expr expansion_factor) =
+ forsuffixes $=u,jut,cap_jut,beak_jut,apex_corr:
+ $:=$.#*expansion_factor*hppp; endfor
+enddef;
+
+def normal_adjust_fit(expr left_adjustment,right_adjustment) =
+ numeric charwd_in; charwd_in=charwd;
+ l:=-hround(left_adjustment*hppp)-letter_fit;
+ interim xoffset:=-l;
+ charwd:=charwd+2letter_fit#+left_adjustment+right_adjustment;
+ r:=l+hround(charwd*hppp)-shrink_fit;
+ w:=r-hround(right_adjustment*hppp)-letter_fit;
+ do_expansion(w/(charwd_in*hppp));
+ enddef;
+
+def mono_adjust_fit(expr left_adjustment,right_adjustment) =
+ numeric charwd_in; charwd_in=charwd;
+ numeric expansion_factor;
+ mono_charwd#=2letter_fit#
+ +expansion_factor*(charwd+left_adjustment+right_adjustment);
+ l:=-hround(left_adjustment*expansion_factor*hppp)-letter_fit;
+ interim xoffset:=-l;
+ r:=l+mono_charwd-shrink_fit;
+ w:=r-hround(right_adjustment*expansion_factor*hppp)-letter_fit;
+ charwd:=mono_charwd#; charic:=mono_charic#;
+ do_expansion(w/(charwd_in*hppp));
+ enddef;
+
+extra_endchar:=extra_endchar&"r:=r+shrink_fit;w:=r-l;";
+
+def ignore_math_fit(expr left_adjustment,right_adjustment) = enddef;
+def do_math_fit(expr left_adjustment,right_adjustment) =
+ l:=l-hround(left_adjustment*hppp); interim xoffset:=-l;
+ charwd:=charwd+left_adjustment+right_adjustment;
+ r:=l+hround(charwd*hppp)-shrink_fit;
+ charic:=charic-right_adjustment;
+ if charic<0: charic:=0; fi enddef;
+def zero_width = charwd:=0; r:=l-shrink_fit enddef;
+def change_width = if not monospace: % change width by $\pm1$
+ if r+shrink_fit-l=floor(charwd*hppp): w:=w+1; r:=r+1;
+ else: w:=w-1; r:=r-1; fi fi enddef;
+def center_on(expr x) = if not monospace: % change width for symmetric fit
+ r:=r+2x-w; w:=2x; fi enddef;
+def padded expr del_sharp =
+ charht:=charht+del_sharp; chardp:=chardp+del_sharp enddef;
+
+def font_setup =
+ if monospace: let adjust_fit=mono_adjust_fit;
+ def mfudged=fudged enddef;
+ mono_charic#:=body_height#*slant;
+ if mono_charic#<0: mono_charic#:=0; fi
+ mono_charwd#:=9u#; define_whole_pixels(mono_charwd);
+ else: let adjust_fit=normal_adjust_fit;
+ def mfudged= enddef; fi
+ if math_fitting: let math_fit=do_math_fit
+ else: let math_fit=ignore_math_fit fi;
+ define_pixels(u,width_adj,serif_fit,cap_serif_fit,jut,cap_jut,beak,
+ bar_height,dish,bracket,beak_jut,stem_corr,vair_corr,apex_corr);
+ define_blacker_pixels(notch_cut,cap_notch_cut);
+ forsuffixes $=notch_cut,cap_notch_cut: if $<3: $:=3; fi endfor
+ define_whole_pixels(letter_fit,fine,crisp,tiny);
+ define_whole_vertical_pixels(body_height,asc_height,
+ cap_height,fig_height,x_height,comma_depth,desc_depth,serif_drop);
+ define_whole_blacker_pixels(thin_join,hair,stem,curve,flare,
+ dot_size,cap_hair,cap_stem,cap_curve);
+ define_whole_vertical_blacker_pixels(vair,bar,slab,cap_bar,cap_band);
+ define_corrected_pixels(o,apex_o);
+ forsuffixes $=hair,stem,cap_stem:
+ fudged$.#:=fudge*$.#; fudged$:=hround(fudged$.#*hppp+blacker);
+ forever: exitif fudged$>.9fudge*$; fudged$:=fudged$+1; endfor endfor
+ rule_thickness:=ceiling(rule_thickness#*hppp);
+ heavy_rule_thickness:=ceiling(3rule_thickness#*hppp);
+ oo:=vround(.5o#*hppp*o_correction)+eps;
+ apex_oo:=vround(.5apex_o#*hppp*o_correction)+eps;
+ lowres_fix(stem,curve,flare) 1.3;
+ lowres_fix(stem,curve) 1.2;
+ lowres_fix(cap_stem,cap_curve) 1.2;
+ lowres_fix(hair,cap_hair) 1.2;
+ lowres_fix(cap_band,cap_bar,bar,slab) 1.2;
+ stem':=hround(stem-stem_corr); cap_stem':=hround(cap_stem-stem_corr);
+ vair':=vround(vair+vair_corr);
+ vstem:=vround .8[vair,stem]; cap_vstem:=vround .8[vair,cap_stem];
+ ess:=(ess#/stem#)*stem; cap_ess:=(cap_ess#/cap_stem#)*cap_stem;
+ dw:=(curve#-stem#)*hppp; bold:=curve#*hppp+blacker;
+ dh#:=.6designsize;
+ stem_shift#:=if serifs: 2stem_corr# else: 0 fi;
+ more_super:=max(superness,sqrt .77superness);
+ hein_super:=max(superness,sqrt .81225258superness); % that's $2^{-.3}$
+ clear_pen_memory;
+ if fine=0: fine:=1; fi
+ forsuffixes $=fine,crisp,tiny:
+%%% fine $ %%%% temporary formatting convention for MFT
+ if $>fudged.hair: $:=fudged.hair; fi
+ $.breadth:=$;
+ pickup if $=0: nullpen else: pencircle scaled $; $:=$-eps fi;
+ $.nib:=savepen; breadth_[$.nib]:=$;
+ forsuffixes $$=lft,rt,top,bot: shiftdef($.$$,$$ 0); endfor endfor
+%%% @ $ %%%% restore ordinary formatting for $
+ min_Vround:=max(fine.breadth,crisp.breadth,tiny.breadth);
+ if min_Vround<vround min_Vround: min_Vround:=vround min_Vround; fi
+ if flare<vround flare: flare:=vround flare; fi
+ forsuffixes $=vair,bar,slab,cap_bar,cap_band,vair',vstem,cap_vstem,bold:
+ if $<min_Vround: $:=min_Vround; fi endfor
+ pickup pencircle scaled rule_thickness; rule.nib:=savepen;
+ math_axis:=good.y(math_axis#*hppp);
+ pickup pencircle scaled if hefty:(.6[vair,fudged.hair]) else:fudged.hair fi;
+ light_rule.nib:=savepen;
+ pickup pencircle xscaled cap_curve yscaled cap_hair rotated 30;
+ cal.nib:=savepen;
+ pair cal.extension; cal.extension:=(.75cap_curve,0) rotated 30;
+ pickup pencircle xscaled cap_curve yscaled cap_hair rotated 70;
+ tilted.nib:=savepen;
+ pickup pencircle xscaled curve yscaled cap_hair rotated 70;
+ med_tilted.nib:=savepen;
+ pickup pencircle xscaled cap_stem yscaled cap_hair rotated 30;
+ med_cal.nib:=savepen;
+ pickup pencircle xscaled stem yscaled cap_hair rotated 30;
+ light_cal.nib:=savepen;
+ pickup pencircle xscaled(cap_curve+dw) yscaled cap_hair rotated 30;
+ heavy_cal.nib:=savepen;
+ bot_flourish_line:=-.5u-o;
+ pair bend; bend=(.5u,0);
+ pair flourish_change; flourish_change=(4u,.2asc_height);
+ join_radius:=u;
+ currenttransform:=identity slanted slant
+ yscaled aspect_ratio scaled granularity;
+ if currenttransform=identity: let t_=relax
+ else: def t_ = transformed currenttransform enddef fi;
+ numeric paren_depth#; .5[body_height#,-paren_depth#]=math_axis#;
+ numeric asc_depth#; .5[asc_height#,-asc_depth#]=math_axis#;
+ body_depth:=desc_depth+body_height-asc_height;
+ shrink_fit:=1+hround(2letter_fit#*hppp)-2letter_fit;
+ if not string mode: if mode<=smoke: shrink_fit:=0; fi fi
+ enddef;
+
+def shiftdef(suffix $)(expr delta) =
+ vardef $ primary x = x+delta enddef enddef;
+
+def makebox(text rule) =
+ for y=0,asc_height,body_height,x_height,bar_height,-desc_depth,-body_depth:
+ rule((l,y)t_,(r,y)t_); endfor % horizontals
+ for x=l,r: rule((x,-body_depth)t_,(x,body_height)t_); endfor % verticals
+ for x=u*(1+floor(l/u)) step u until r-1:
+ rule((x,-body_depth)t_,(x,body_height)t_); endfor % more verticals
+ if charic<>0:
+ rule((r+charic*pt,h.o_),(r+charic*pt,.5h.o_)); fi % italic correction
+ enddef;
+def maketicks(text rule) =
+ for y=0,h.o_,-d.o_:
+ rule((l,y),(l+10,y)); rule((r-10,y),(r,y)); endfor % horizontals
+ for x=l,r:
+ rule((x,10-d.o_),(x,-d.o_)); rule((x,h.o_-10),(x,h.o_)); endfor % verticals
+ if charic<>0:
+ rule((r+charic*pt,h.o_-10),(r+charic*pt,h.o_)); fi % italic correction
+ enddef;
+rulepen:=pensquare;
+
+vardef stroke text t =
+ forsuffixes e = l,r: path_.e:=t; endfor
+ if cycle path_.l:
+ errmessage "Beware: `stroke' isn't intended for cycles"; fi
+ path_.l -- reverse path_.r -- cycle enddef;
+
+vardef circ_stroke text t =
+ forsuffixes e = l,r: path_.e:=t; endfor
+ if cycle path_.l:
+ errmessage "Beware: `stroke' isn't intended for cycles"; fi
+ path_.l -- reverse path_.r .. cycle enddef;
+
+vardef super_arc.r(suffix $,$$) = % outside of super-ellipse
+ pair center,corner;
+ if y$=y$r: center=(x$$r,y$r); corner=(x$r,y$$r);
+ else: center=(x$r,y$$r); corner=(x$$r,y$r); fi
+ z$.r{corner-z$.r}...superness[center,corner]{z$$.r-z$.r}
+ ...{z$$.r-corner}z$$.r enddef;
+
+vardef super_arc.l(suffix $,$$) = % inside of super-ellipse
+ pair center,corner;
+ if y$=y$r: center=(x$$l,y$l); corner=(x$l,y$$l);
+ else: center=(x$l,y$$l); corner=(x$$l,y$l); fi
+ z$l{corner-z$l}...superness[center,corner]{z$$l-z$l}
+ ...{z$$l-corner}z$$l enddef;
+
+vardef pulled_super_arc.r(suffix $,$$)(expr superpull) =
+ pair center,corner;
+ if y$=y$r: center=(x$$r,y$r); corner=(x$r,y$$r);
+ else: center=(x$r,y$$r); corner=(x$$r,y$r); fi
+ z$r{corner-z$r}...superness[center,corner]{z$$r-z$r}
+ ...{z$$r-corner}z$$r enddef;
+
+vardef pulled_super_arc.l(suffix $,$$)(expr superpull) =
+ pair center,corner,outer_point;
+ if y$=y$r: center=(x$$l,y$l); corner=(x$l,y$$l);
+ outer_point=superness[(x$$r,y$r),(x$r,y$$r)];
+ else: center=(x$l,y$$l); corner=(x$$l,y$l);
+ outer_point=superness[(x$r,y$$r),(x$$r,y$r)]; fi
+ z$l{corner-z$l}
+ ...superpull[superness[center,corner],outer_point]{z$$l-z$l}
+ ...{z$$l-corner}z$$l enddef;
+
+vardef pulled_arc@#(suffix $,$$) =
+ pulled_super_arc@#($,$$)(superpull) enddef;
+
+vardef serif_arc(suffix $,$$) =
+ z${x$$-x$,0}...(.75[x$,x$$],.25[y$,y$$]){z$$-z$}...{0,y$$-y$}z$$ enddef;
+
+vardef penpos@#(expr b,d) =
+ if known b: if b<=0: errmessage "bad penpos"; fi fi
+ (x@#r-x@#l,y@#r-y@#l)=(b,0) rotated d;
+ x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef;
+
+newinternal currentbreadth;
+vardef pos@#(expr b,d) =
+ if known b: if b<=currentbreadth: errmessage "bad pos"; fi fi
+ (x@#r-x@#l,y@#r-y@#l)=(b-currentbreadth,0) rotated d;
+ x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef;
+def numeric_pickup_ primary q =
+ currentpen:=pen_[q];
+ pen_lft:=pen_lft_[q]; pen_rt:=pen_rt_[q];
+ pen_top:=pen_top_[q]; pen_bot:=pen_bot_[q];
+ currentpen_path:=pen_path_[q];
+ if known breadth_[q]: currentbreadth:=breadth_[q]; fi enddef;
+
+vardef ic# = charic enddef;
+vardef h# = charht enddef;
+vardef w# = charwd enddef;
+vardef d# = chardp enddef;
+
+let {{=begingroup; let }}=endgroup;
+def .... = .. tension atleast .9 .. enddef;
+def less_tense = save ...; let ...=.... enddef;
+def ?? = hide(showvariable x,y) enddef;
+
+let semi_ =;; let colon_ = :; let endchar_ = endchar;
+def iff expr b = if b:let next_=use_it else:let next_=lose_it fi; next_ enddef;
+def use_it = let : = restore_colon; enddef;
+def restore_colon = let : = colon_; enddef;
+def lose_it = let endchar=fi; inner cmchar; let ;=fix_ semi_ if false enddef;
+def fix_=let ;=semi_; let endchar=endchar_; outer cmchar; enddef;
+def always_iff = let : = endgroup; killboolean enddef;
+def killboolean text t = use_it enddef;
+outer cmchar;
return name_str + Duration_convert::dur2_str (dur) + " ";
String str;
+
//ugh
if (dur.plet_b ())
str += String ("\\[")
void
Mudela_staff::output (Mudela_stream& mudela_stream_r)
{
- mudela_stream_r << id_str() << " = \\melodic";
+ mudela_stream_r << id_str() << " = \\notes";
mudela_stream_r << (mudela_voice_p_list_.size() > 1 ? "<" : "{");
mudela_stream_r << '\n';
mudela_stream_r << _ ("% midi copyright:") << copyright_str_ << '\n';
\notes {
\time 4/4; % should be \time C
}
-
+
+
+beamkludge = \property Voice. stemLeftBeamCount = "1"
+
tenor =
\notes \relative c' {
\clef "violin";
\stemdown
- r8 [c8 d e] [f. g32 f] [e8 a] |
+ r8 [c8 d e] [f. \beamkludge g32 f] [e8 a] |
[d, g] ~ [g16 a g f] [e f e d] [c d c b ] |
[a 8 fis'] g4 ~ [g8 fis16 e] [f8 d] |
[g f! e d] c r r g' ~ |
[c8 f] r16 [g f e] [f8 d] g4 ~ |
g4 r4 r2 |
r1 |
- r8 [g8 a b] [c . d 32 c ] [b8 e ]
+ r8 [g8 a b] [c . \beamkludge d 32 c ] [b8 e ]
%% 10
[a, d ] ~ [d 16 e d c ] b8 r8 r d, |
- [e fis] [g. a32 g] [fis8 b e, a] ~ |
+ [e fis] [g. \beamkludge a32 g] [fis8 b e, a] ~ |
[a16 b a gis] [fis8 f!] [e d] ~ [d16 e fis gis] |
[a gis a b] [gis fis gis a] b8 r8 r4 |
- r8 [c,8 d e] \stemup [f. g32 f] [e8 a] |
+ r8 [c,8 d e] \stemup [f. \beamkludge g32 f] [e8 a] |
%% 15
[d, g] ~ [g16 a g f] e8 \stemdown [e fis g] ~ |
[g8 fis] [gis8 a] ~ [a g! a b] |
\stemboth
- [c . d 32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] |
+ [c . \beamkludge d32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] |
[b8 g' cis, d ] [e cis d e ] |
- \stemdown a,8 r8 r e [fis g] \stemboth [a. b32 a] |
+ \stemdown a,8 r8 r e [fis g] \stemboth [a. \beamkludge b32 a] |
%% 20
[g8 c fis, b] ~ [b16 c b a] \stemdown [g fis e d] \stemboth |
e4 \stemdown d ~ [d16 a' g f!] [e g f! a] |
\stemboth g4. f8 ~ [f e] d4 |
\stemdown e8 a4 g8 ~ [g8 f g a] |
%% 25
- [bes8. c 32 b] [a8 d ] [g, c ] ~ [c 16 d c bes] |
+ [bes8. \beamkludge c32 b] [a8 d ] [g, c ] ~ [c 16 d c bes] |
[a bes a g] [f g f e] d4 ~ [d8. g16] |
a4 r16 [f' 16 d 8] e 2 |
}
\stemup
r1 |
r2 r8 [g'8 a b] |
- [c . d 32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] |
+ [c . \beamkludge d32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] |
[b g a b] [c b c d ] [e d e fis ] [g 8 b,] |
%% 5
[c a] [d 16 c b a] [g8. g16] [f e f g] |
[a g a b] c 2 b4 |
- r8 [c8 d e] [f. g32 f] [e8 a] |
+ r8 [c8 d e] [f. \beamkludge g32 f] [e8 a] |
[d, g] ~ [g16 a g f] [e8 a] ~ [a16 b a g] |
f2 [e8. fis16] g4 ~
%% 10
a 4 r4 r2 |
%% 15
r2 r8 [g 8 a b ] |
- [c8. d32 c] [b 8 c] [d e] [f!. g32 f!] |
+ [c8. \beamkludge d32 c] [b 8 c] [d e] [f!. \beamkludge g32 f!] |
[e8 a d, g] ~ [g16 a g f] [e8 a] |
- [d,8 bes'] [a g16 f] [g f g e] [f g g f32 g] |
+ [d,8 bes'] [a g16 f] [g f g e] [f g g \beamkludge f32 g] |
[a16 cis, d g] [e8. d16] d8 r8 r4 |
%% 20
r2 r4 r8 g, |
- [a b ] [c. d32 c] [b 8 e a, d] ~ |
+ [a b ] [c. \beamkludge d32 c] [b 8 e a, d] ~ |
[e16 e d c] [b c d e] [f g a g] [f e d c] |
b 4 [c,8 d] g c4 b 8 |
c4 [b 8 bes 8] a d4 c8 |
%% 25
[d8 e] f4 ~ [f16 a g f] [e f e d] |
- c2 r16 [g 32 a b !16 c] [d e f8] ~ |
+ c2 r16 [g32 a b !16 c] [d e f8] ~ |
[f32 c d e f16 g] [a8. b16] <g2 c 2> |
}
r1 |
r |
r |
- r8 [g'8 a b] [c . d 32 c ] [b8 e ] |
+ r8 [g'8 a b] [c . \beamkludge d32 c ] [b8 e ] |
%% 5
[a, d ] ~ [d 16 e d c ] [b8 c ~ c bes8] |
[a d g, c ] r16 [a16 b c ] d 4 |
- g,4 r8 g8 [a b] [c . d 32 c ] |
+ g,4 r8 g8 [a b] [c . \beamkludge d32 c ] |
[b8 e a, d ] ~ [d 16 e d c !] [b!8 e ] ~ |
e 4 d 4 [c 16 b c a] [e' d c b] |
%% 10
[c 16 a b c ] [d c b a] g4 r4 |
r1 |
- r8 [e8 fis gis] [a. b32 a] [gis8 c ] |
+ r8 [e8 fis gis] [a. \beamkludge b32 a] [gis8 c ] |
[fis, b] ~ [b16 c b a] gis8 a4 gis8 |
- a4 r8 g8 [a b] c . [d 32 c ] |
+ a4 r8 g8 [a b] c . [d32 c ] |
%% 15
[b8 e a, d ] ~ [d' g,] d 4 |
[c 8 a] e' 4 d 8 r8 r4 |
- r8 [a8 b cis ] [d . e 32 d ] [c !8 f ] |
+ r8 [a8 b cis ] [d . \beamkludge e32 d ] [c !8 f ] |
[b,8 e ] ~ [e 16 f e d ] cis 8 r8 r4 |
- r8 [a8 b cis ] [d . e 32 d ] [c !8 fis ] |
+ r8 [a8 b cis ] [d . \beamkludge e32 d ] [c !8 fis ] |
%% 20
[b, e ] ~ [e 16 fis e d ] c 2 ~ |
[c 16 d c b] [a g a fis] [g8 b c d ] |
- [e . f 32 e ] [d 8 g ] [c, f ] ~ [f 16 g f e ] |
+ [e . \beamkludge f32 e ] [d 8 g ] [c, f ] ~ [f 16 g f e ] |
d 4 [e 8 d ] ~ [d g,] g4 ~
- [g8 c, d e] [f. g32 f] [e8 a] |
+ [g8 c, d e] [f. \beamkludge g32 f] [e8 a] |
%% 25
[d, g] ~ [g16 a g f] [e d e f] [g a bes g] |
[a e f g] [a b c a] b2 |
r |
%% 5
r2 r8 [c8 d e] |
- [f. g32 f] [e8 a] [d, g] ~ [g16 a g f] |
+ [f. \beamkludge g32 f] [e8 a] [d, g] ~ [g16 a g f] |
[e f e d] [c d c b ] [a' 8 d a fis] |
[g16 a bes g] [cis,8 d] a'4 e4 |
[a16 b c d ] [c b a g] c 8 r8 r4 |
%% 10
r2 r8 [g, 8 a b ] |
- [c. d32 c] [b 8 e] [a, d] ~ [d16 e d c] |
+ [c. \beamkludge d32 c] [b 8 e] [a, d] ~ [d16 e d c] |
b 8 e4 d8 c f!4 e8 ~ |
e d4 e8 [f! e16 d] e4 |
a, 4 r4 r2 |
%% 15
- r8 [g 8 a b ] [c. d32 c] [b 8 e] |
+ r8 [g 8 a b ] [c. \beamkludge d32 c] [b 8 e] |
[a, 8 d] ~ [d16 e d c] [b 8 bes a g'' ] |
[a,, 8 fis' g e] d4 [e8 f!] |
- [g8. a32 g] [f8 bes] [e, a] ~ [a16 bes a g] |
+ [g8. \beamkludge a32 g] [f8 bes] [e, a] ~ [a16 bes a g] |
[f e f d] [g8 a] d,2 ~ |
%% 20
[d16 e d c] [b a g fis ] [e' 8 e fis g] ~ |
\paper{
gourlay_maxmeasures =5.;
- castingalgorithme = \Wordwrap
+ castingalgorithme = \Wordwrap;
}
% \midi { \tempo 4 = 84; }
}
dux = \notes \relative c'' {
\clef violin;
- \stemdown
+ \property Voice.ydirection = "-1"
+
r8 [c16 b] [c8 g] [as c16 b] [c8 d ] |
[g, c16 b] [c8 d ] [f,16 g] as4 [g16 f] |
[es c' b a] [g f! es d] [c8 es' d c ] |
#: main.cc:94
msgid ""
" -d, --dependencies write Makefile dependencies for every input file\n"
-msstr ""
+msgstr ""
" -d, --dependencies schrijf Makefile afhankelijkheden voor elk\n"
" invoerbestand\n"
(define (invoke-dim1 s d)
(string-append
"\n\\" s "{" (number->dim d) "}"))
-
+ (define (pt->sp x)
+ (* 65536 x))
+
;;
;; need to do something to make this really safe.
;;
(define (number->dim x)
(string-append
- (number->string (chop-decimal x)) "pt "))
+ (number->string (chop-decimal x)) "pt "))
(define (placebox x y s)
(string-append
"""
name = 'ly2dvi'
-version = '0.0.7'
+version = '0.0.9'
errorlog = ''
import sys
# init Initial default values
# file The values found in the lilypond generated TeX files
# environment Envrionment variables LILYINCLUDE, LILYPONDPREFIX
- # rcfile $LILYPONDPREFIX/share/lilypond/.lilyrc
+ # rcfile $LILYPONDPREFIX/.lilyrc
# rcfile $HOME/.lilyrc
# rcfile ./.lilyrc
# commandline command line arguments
p=os.path.split(p[0])
# bit silly. for ly2dvi, overrules compiled-in datadir...
# how to do this better (without running lily, of course?
- this.setRoot(p[0] + '/share/lilypond', 'init')
+ this.setRoot(os.path.join(p[0],'share','lilypond'), 'init')
if not os.environ.has_key('HOME'):
if os.environ.has_key('HOMEDRIVE') and \
t=''
if os.environ.has_key ('TEXINPUTS'):
- t = os.pathsep + os.environ['TEXINPUTS']
- os.environ['TEXINPUTS'] = os.path.join(this.get('root'), 'share',
- 'lilypond', 'tex' ) + t
+ t = os.environ['TEXINPUTS'] + os.pathsep
+ os.environ['TEXINPUTS'] = t + \
+ os.path.join(this.get('root'), 'tex' ) + \
+ os.pathsep + os.path.join(this.get('root'), 'ps' )
t=''
if os.environ.has_key ('MFINPUTS'):
- t = os.pathsep + os.environ['MFINPUTS']
- os.environ['MFINPUTS'] = os.path.join(this.get('root'), 'share',
- 'lilypond', 'mf' ) + t
+ t = os.environ['MFINPUTS'] + os.pathsep
+ os.environ['MFINPUTS'] = t + os.path.join(this.get('root'), 'mf' )
if os.environ.has_key('TMP'):
this.__set('tmp',os.environ['TMP'],'environment')
"""
if os.name == 'nt':
- path = os.path.join(this.get('root'), 'share', 'lilypond',
- 'tex', var)
+ path = os.path.join(this.get('root'), 'tex', var)
else:
path =''
cmd =('kpsewhich tex %s %s' % (var,errorlog))
path = pipe.readline ()[:-1] # chop off \n
return_status = pipe.close()
if return_status and not path:
- path = os.path.join(this.get('root'), 'share', 'lilypond',
- 'tex', var)
+ path = os.path.join(this.get('root'), 'tex', var)
fd = open(path, 'r')
return fd
else: # Windows apps like edit choke on .lilyrc
dotFilename='_lilyrc'
- for d in [os.path.join(this.get('root'),'share','lilypond','ly'), \
+ for d in [os.path.join(this.get('root'),'ly'), \
os.environ['HOME'], os.curdir ]:
file=os.path.join(d,dotFilename)
try:
+dnl WARNING WARNING WARNING WARNING
+dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
+dnl WARNING WARNING WARNING WARNING
+dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
dnl aclocal.m4 -*-shell-script-*-
dnl StepMake subroutines for configure.in
AC_DEFUN(AC_STEPMAKE_GXX, [
# ugh autoconf
changequote(<<, >>)dnl
- if $CXX --version | grep '2\.[78]' > /dev/null ||
+ if $CXX --version | grep '2\.8' > /dev/null ||
$CXX --version | grep 'egcs' > /dev/null
changequote([, ])dnl
then
true
else
- AC_STEPMAKE_WARN(can\'t find g++ 2.7, 2.8 or egcs)
+ AC_STEPMAKE_WARN(can\'t find g++ 2.8 or egcs)
fi
])
# others need readline, dl (or even more)
# urg, must check for different functions in libguile
# to force new check iso reading from cache
- AC_CHECK_LIB(guile, scm_shell, \
+
+ # gh_scm2doubles,gh_doubles2scm are new in 1.3
+ AC_CHECK_LIB(guile, gh_scm2doubles, \
LIBS="-lguile $LIBS"; AC_DEFINE(HAVE_LIBGUILE), \
AC_CHECK_LIB(readline, readline) \
AC_CHECK_LIB(dl, dlopen) \
AC_CHECK_LIB(socket, socket)\
AC_CHECK_LIB(termcap,tgetent)\
AC_CHECK_LIB(m, fabs)\
- AC_CHECK_LIB(guile, scm_boot_guile)\
+ AC_CHECK_LIB(guile, gh_doubles2scm)\
)
- if test "$ac_cv_lib_guile_scm_shell" != yes -a \
- "$ac_cv_lib_guile_scm_boot_guile" != yes ; then
+ if test "$ac_cv_lib_guile_gh_scm2doubles" != yes -a \
+ "$ac_cv_lib_guile_gh_doubles2scm" != yes ; then
AC_STEPMAKE_WARN(You should install guile 1.3 or newer)
fi
])
#
# Post install clean up
#
-CYGWIN_LIB=$PACKAGE_ROOTDIR/distfiles/winnt/cygwinb19.dll
+CYGWIN_LIB=$PACKAGE_ROOTDIR/distfiles/winnt/cygwin1.dll
if [ ! -e $CYGWIN_LIB ]; then
echo "Unable to locate $CYGWIN_LIB"
exit 1
# should this be in Rules?
configure: configure.in aclocal.m4
- autoconf - < $<> $@
+ autoconf
chmod +x configure
localclean: