{
}
+int
+Font_metric::count () const
+{
+ return 0;
+}
Box
Font_metric::get_char (int)const
Real lt = sp->paper_l ()->get_var ("stafflinethickness");
Real th = gh_scm2double (sp->get_grob_property ("thickness")) * lt ;
Real h = gh_scm2double (sp->get_grob_property ("height"));
+
+ // interval?
Real l = gh_scm2double (sp->get_grob_property ("minimum-length"));
+ Real x = gh_scm2double (sp->get_grob_property ("maximum-length"));
// The hyphen can exist in the word space of the left lyric ...
SCM space = sp->get_bound (LEFT)->get_grob_property ("word-space");
if (gh_number_p (space))
bounds[LEFT] -= gh_scm2double (space);
}
Real w = bounds.length ();
+
+
/* for length, use a geometric mean of the available space and some minimum
- */
+ */
if (l < w)
- l = sqrt (l*w);
+ {
+ l = sqrt (l*w);
+ if (l > x)
+ l = x;
+ }
else
{
/* OK, we have a problem. Usually this means that we're on the
{
AFM_Font_info * font_inf_;
+ virtual int count () const;
virtual Box get_char (int) const;
AFM_CharMetricInfo const *find_char_metric (String name, bool warn=true) const;
AFM_CharMetricInfo const *find_ascii_metric (int, bool warn=true) const;
public:
SCM description_;
String path_;
+
+ virtual int count () const;
virtual Box get_char (int ascii) const;
virtual Box text_dimension (String) const;
virtual Molecule find_by_name (String) const;
public:
static SCM make_tfm (String filename);
- Box get_char (int) const;
+ virtual int count () const;
+ virtual Box get_char (int) const;
Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const;
String str () const;
}
Molecule
-System_start_delimiter::staff_brace (Grob*me,Real y)
+System_start_delimiter::staff_brace (Grob*me, Real y)
{
-
- /*
- FIXME:
- * should look at afm/tfm file for dimensions.
- (This breaks ascii-art output: it hasn't got 255 symbols)
-
- * more glyphs (or maybe just better sized (fixed # of staff-spaces)),
- the size mismatches with the staffs are very ugly
-
- */
-
- // ugrhn
- int lo = 0;
- int hi = 255;
-
Font_metric *fm = Font_interface::get_default_font (me);
Box b;
+ int lo = 0;
+ int hi = 255; //arg, urg == 0: fm->count () >? 2;
+
+ int big = 1;
+ SCM bigger = gh_list (me->mutable_property_alist_,
+ me->immutable_property_alist_,
+ SCM_UNDEFINED);
/* do a binary search for each Y, not very efficient, but passable? */
do
b = fm->get_char (cmp);
if (b[Y_AXIS].empty_b () || b[Y_AXIS].length () > y)
- hi = cmp;
+ {
+ hi = cmp;
+ }
else
- lo = cmp;
+ {
+ /*
+ ugh: 7
+ We have four fonts: feta-braces0-3.mf
+
+ In the style-sheet, all paper relative sizes need to start
+ looking at the feta-braces0 font.
+
+ The smallest paper size, feta11 or -3, has to make 5 steps
+ to get to feta26 or +2. Only after that, from +3 to +5 are
+ the real bigger sizes, so worst case we need 8 steps to get
+ to the font we need. */
+ if (big < 8)
+ {
+ bigger = gh_cons (gh_cons (ly_symbol2scm ("font-relative-size"),
+ gh_int2scm (big++)),
+ bigger);
+ me->set_grob_property ("font", bigger);
+ fm = Font_interface::get_default_font (me);
+ lo = 0;
+ hi = 255; //fm->count () >? 2;
+ }
+ else
+ lo = cmp;
+ }
}
while (hi - lo > 1);
return &dummy_static_char_metric;
}
+int
+Tex_font_metric::count () const
+{
+ return ascii_to_metric_idx_.size ();
+}
+
Box
Tex_font_metric::get_char (int a) const
{
define_pixels (height, width);
thin = 2 stafflinethickness;
- thick = .5 staff_space;
+ thick = .5 width;
z2 = .5 [z1, z3];
y3 = y1 + height/2;
endchar;
enddef;
-
-for x := 1 step 1 until 160:
- % note: define_pixels (x) multiplies x by hppp,
- % we must never get bigger than infinity
- draw_brace (min (x * pt#, infinity/hppp - 1), staff_space#);
+for i := font_count * 256 step 1 until (font_count + 1) * 256 - 1:
+ % note: define_pixels (x) multiplies x by hppp,
+ % we must never get bigger than infinity
+ y := min ((i + 1) * 0.25pt#, infinity/hppp - 1);
+ x := y / 12;
+ draw_brace (y, x);
endfor
--- /dev/null
+%
+% feta-braces0.mf -- 256 smallest braces
+%
+% source file of the Feta (Font-En-Tja) music font
+%
+% (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+%
+
+font_identifier:="feta-braces0";
+font_size 16;
+mode_setup;
+
+staffsize#:=16pt#;
+font_count := 0;
+input feta-beugel;
+end.
+
--- /dev/null
+%
+% feta-braces1.mf -- next 256 braces
+%
+% source file of the Feta (Font-En-Tja) music font
+%
+% (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+%
+
+font_identifier:="feta-braces1";
+font_size 16;
+mode_setup;
+
+staffsize#:=16pt#;
+font_count := 1;
+input feta-beugel;
+end.
+
--- /dev/null
+%
+% feta-braces2.mf -- next 256 braces
+%
+% source file of the Feta (Font-En-Tja) music font
+%
+% (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+%
+
+font_identifier:="feta-braces2";
+font_size 16;
+mode_setup;
+
+staffsize#:=16pt#;
+font_count := 2;
+input feta-beugel;
+end.
+
--- /dev/null
+%
+% feta-braces3.mf -- next 256 braces
+%
+% source file of the Feta (Font-En-Tja) music font
+%
+% (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+%
+
+font_identifier:="feta-braces3";
+font_size 16;
+mode_setup;
+
+staffsize#:=16pt#;
+font_count := 3;
+input feta-beugel;
+end.
+
mutopiaopus = "BWV847"
style = "baroque"
copyright = "Public Domain"
- tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by Han-Wen Nienhuys.\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"
maintainer = "hanwen@cs.uu.nl"
+ mutopiapublicdomain = "\\parbox{\\hsize}{\\thefooter\\quad\\small
+ \\\\This music is part of the Mutopia project,
+ \\texttt{http://www.mutopiaproject.org/}\\\\It has been typeset
+ and placed in the public domain by " + \maintainer +
+ ".\\\\Unrestricted modification and redistribution is permitted
+ and encouraged---copy this music and share it.}"
+ tagline = \mutopiapublicdomain
lastupdated = "2000/Feb/14"
}
\score {
\notes \context PianoStaff <
+ \property Score.TimeSignature \override #'style = #'C
\context Staff = treble <
\key c \minor
% \key es \major
\paper {
linewidth = 18.0 \cm
- \translator{ \OrchestralScoreContext
- timeSignatureStyle \override #'style = #"C"
-
- }
-
}
\header{
opus = "BWV 847"
((-2 medium caps roman cmcsc 7) . "cmcsc7")
((-3 medium caps roman cmcsc 7) . "cmcsc7")
-
- ;; should use the same brace font every where and fix C++ code.
- ((2 * * braces feta-braces 26) . "feta-braces26")
- ((1 * * braces feta-braces 23) . "feta-braces23")
- ((0 * * braces feta-braces 20) . "feta-braces20")
- ((-1 * * braces feta-braces 16) . "feta-braces16")
- ((-2 * * braces feta-braces 13) . "feta-braces13")
- ((-3 * * braces feta-braces 11) . "feta-braces11")
+ ;; smallest needs 8 steps: -3 to +5, so
+ ;; biggest also needs 8 available steps: +2 to + 10
+ ((10 * * braces feta-braces 3) . "feta-braces3")
+ ((9 * * braces feta-braces 3) . "feta-braces3")
+ ((8 * * braces feta-braces 3) . "feta-braces3")
+ ((7 * * braces feta-braces 3) . "feta-braces3")
+ ((6 * * braces feta-braces 3) . "feta-braces3")
+ ((5 * * braces feta-braces 3) . "feta-braces3")
+ ((4 * * braces feta-braces 2) . "feta-braces2")
+ ((3 * * braces feta-braces 1) . "feta-braces1")
+ ((2 * * braces feta-braces 0) . "feta-braces0")
+ ((1 * * braces feta-braces 0) . "feta-braces0")
+ ((0 * * braces feta-braces 0) . "feta-braces0")
+ ((-1 * * braces feta-braces 0) . "feta-braces0")
+ ((-2 * * braces feta-braces 0) . "feta-braces0")
+ ((-3 * * braces feta-braces 0) . "feta-braces0")
((3 * * dynamic feta-din 19) . "feta-din19")
((2 * * dynamic feta-din 19) . "feta-din19")
(thickness . 1.0)
(height . 0.4)
(minimum-length . 0.5)
+ (maximum-length . 100)
(molecule-callback . ,Hyphen_spanner::brew_molecule)
(Y-extent-callback . ,Grob::point_dimension_callback)
(meta . ,(grob-description "LyricHyphen" lyric-hyphen-interface ))
(grob-property-description 'lookup symbol? "lookup method: 'value for plain text, 'name for character-name.")
(grob-property-description 'magnify number? "the magnification factor. FIXME: doesn't work for feta fonts.")
(grob-property-description 'maximum-duration-for-spacing moment? "space as if a duration of this type is available in this measure.")
+(grob-property-description 'maximum-length number? "don't make Grob longer than this")
(grob-property-description 'maximum-rest-count integer? "kill off rests so we don't more than this number left.")
(grob-property-description 'merge-differently-dotted boolean? " Merge noteheads in collisions, even if they have a different number of dots. This normal notation for some types of polyphonic music. The value of this setting is used by @ref{note-collision-interface} .")
(grob-property-description 'minimum-distance number? "minimum distance between notes and rests.")
# sys.stdout.flush ()
# handy emacs testing
-if not files:
- files = ['template.mup']
+# if not files:
+# files = ['template.mup']
+if not files:
+ files = ['-']
+
for f in files:
- if f == '-':
- f = ''
- if f and not os.path.isfile (f):
+ if f == '-':
+ h = sys.stdin
+ elif f and not os.path.isfile (f):
f = strip_extension (f, '.mup') + '.mup'
+ h = open (f)
progress ( _("Processing %s..." % f))
- raw_lines = open (f).readlines ()
+ raw_lines = h.readlines ()
p = Pre_processor (raw_lines)
if only_pre_process_p:
if not output:
output = os.path.basename (re.sub ('(?i).mup$', '.ly', f))
if output == f:
output = os.path.basename (f + '.ly')
-
+
+ if f == '-':
+ output = '-'
+ out_h = sys.stdout
+ else:
+ out_h = open (output, 'w')
+
progress (_ ("Writing %s...") % output)
tag = '%% Lily was here -- automatically converted by %s from %s' % ( program_name, f)
else:
ly = tag + '\n\n' + e.dump ()
- o = open (output, 'w')
- o.write (ly)
- o.close ()
+ out_h.write (ly)
+ out_h.close ()
if debug_p:
print (ly)