Package: abcm2ps Followup-For: Bug #994618 Hello. The attached patch updates abcm2ps from 8.14.11 to 8.14.13. It replaces the previous ones.
Would you be OK with a repository on salsa and myself in Uploaders, so that next routine updates do not require a formal NMU process?
From: Nicolas Boulenguez <nico...@debian.org> Subject: Package 8.14.13 diff --git a/abcm2ps.h b/abcm2ps.h index 4df918f..e22c9f3 100644 --- a/abcm2ps.h +++ b/abcm2ps.h @@ -526,6 +526,7 @@ struct FORMAT { /* struct for page layout */ float breaklimit, maxshrink, lineskipfac, parskipfac, stemheight; float gutter, indent, infospace, slurheight, tieheight, notespacingfactor, scale; float staffsep, sysstaffsep, maxstaffsep, maxsysstaffsep, stretchlast; + float staffscale; // (treated in parse.c) int abc2pscompat, alignbars, aligncomposer, autoclef; int barsperstaff, breakoneoln, bstemdown, cancelkey, capo; int combinevoices, contbarnb, continueall, custos; diff --git a/abcparse.c b/abcparse.c index 07ee3e4..1b9bedf 100644 --- a/abcparse.c +++ b/abcparse.c @@ -3,7 +3,7 @@ * * This file is part of abcm2ps. * - * Copyright (C) 1998-2020 Jean-François Moine (http://moinejf.free.fr) + * Copyright (C) 1998-2021 Jean-François Moine (http://moinejf.free.fr) * Adapted from abc2ps, Copyright (C) 1996-1998 Michael Methfessel * * This program is free software; you can redistribute it and/or modify it @@ -1006,6 +1006,8 @@ static char top_err[] = "Cannot identify meter top"; wmeasure = m1 * BASE_LEN / m2; s->u.meter.expdur = 1; } + if (wmeasure > BASE_LEN * 16 || wmeasure < 0) + return "Too big meter value"; s->u.meter.wmeasure = wmeasure; s->u.meter.nmeter = nm; @@ -1804,16 +1806,9 @@ static char *parse_len(char *p, len = dur_u; if (isdigit((unsigned char) *p)) { len *= strtol(p, &q, 10); - if (len <= 0 || len > 10000) { - syntax("Bad length", p); - len = dur_u; - } p = q; } - if (*p != '/') { - *p_len = len; - return p; - } + if (*p == '/') { if (isdigit((unsigned char) p[1])) { fac = strtol(p + 1, &q, 10); p = q; @@ -1833,6 +1828,11 @@ static char *parse_len(char *p, syntax("Bad length divisor", p - 1); len = dur_u; } + } + if (len <= 0 || len > 10000) { + syntax("Bad length", p); + len = dur_u; + } *p_len = len; return p; } @@ -2040,10 +2040,10 @@ static int parse_line(char *p) case CHAR_NOTE: p = parse_note(p - 1, flags); flags &= ABC_F_GRACE; - parse.last_sym->u.note.slur_st = slur; - slur = 0; - if (parse.last_sym->u.note.notes[0].len > 0) /* if not space */ - curvoice->last_note = parse.last_sym; + if (slur && parse.last_sym->u.note.notes[0].len) { + parse.last_sym->u.note.slur_st = slur; + slur = 0; + } break; case CHAR_SLASH: /* '/' */ if (flags & ABC_F_GRACE) @@ -2078,9 +2078,10 @@ static int parse_line(char *p) if (p[1] != ':') { p = parse_note(p - 1, flags); /* chord */ flags &= ABC_F_GRACE; - parse.last_sym->u.note.slur_st = slur; - slur = 0; - curvoice->last_note = parse.last_sym; + if (slur && parse.last_sym->u.note.notes[0].len) { + parse.last_sym->u.note.slur_st = slur; + slur = 0; + } break; } @@ -2271,7 +2272,6 @@ static int parse_line(char *p) } if (p[-1] == '<') i = -i; - broken_rhythm(curvoice->last_note, i); curvoice->last_note->u.note.brhythm = i; break; case CHAR_IGN: /* '*' & '`' */ @@ -2360,11 +2360,16 @@ static char *parse_note(char *p, p++; if (isdigit((unsigned char) *p) /* number of points */ || *p == '-') { /* accept negative offset... */ - s->u.note.notes[0].shhd = strtol(p, &q, 10); + len = strtol(p, &q, 10); + if (len < -100 || len > 100) { + syntax("Bad width of y (space)", p); + len = 10; + } p = q; } else { - s->u.note.notes[0].shhd = 10; // default + len = 10; // default } + s->u.note.notes[0].shhd = len; goto add_deco; case 'x': /* invisible rest */ s->flags |= ABC_F_INVIS; @@ -2496,8 +2501,11 @@ static char *parse_note(char *p, do_brhythm: if (curvoice->last_note - && curvoice->last_note->u.note.brhythm != 0) + && curvoice->last_note->u.note.brhythm != 0) { + broken_rhythm(curvoice->last_note, + curvoice->last_note->u.note.brhythm); broken_rhythm(s, -curvoice->last_note->u.note.brhythm); + } add_deco: if (dc.n > 0) { memcpy(s->abc_type != ABC_T_MREST ? &s->u.note.dc @@ -2511,6 +2519,8 @@ add_deco: syntax("Not a note in grace note sequence", p); goto err; } + if (s->u.note.notes[0].len > 0) /* if not space */ + curvoice->last_note = s; return p; err: diff --git a/buffer.c b/buffer.c index 5566a38..0493828 100644 --- a/buffer.c +++ b/buffer.c @@ -29,7 +29,7 @@ static float ln_lmarg[BUFFLN]; /* left margin of buffered lines */ static float ln_scale[BUFFLN]; /* scale of buffered lines */ static signed char ln_font[BUFFLN]; /* font of buffered lines */ static float cur_lmarg = 0; /* current left margin */ -static float min_lmarg, max_rmarg; /* margins for -E/-g */ +static float max_rmarg; /* margins for -E/-g */ static float cur_scale = 1.0; /* current scale */ static float maxy; /* usable vertical space in page */ static float remy; /* remaining vertical space in page */ @@ -129,8 +129,7 @@ static void cnv_date(time_t *ltime) /* (used only with eps -E and svg -g) */ void marg_init(void) { - min_lmarg = cfmt.pagewidth; - max_rmarg = cfmt.pagewidth; + cur_lmarg = max_rmarg = 0; } /* -- initialize the postscript file (PS or EPS) -- */ @@ -141,11 +140,10 @@ static void init_ps(char *str) char version[] = "/creator [(abcm2ps) " VERSION "] def"; if (epsf) { - cur_lmarg = min_lmarg - 10; fprintf(fout, "%%!PS-Adobe-2.0 EPSF-2.0\n" "%%%%BoundingBox: 0 0 %.0f %.0f\n", ((p_fmt->landscape ? p_fmt->pageheight : p_fmt->pagewidth) - - cur_lmarg - max_rmarg + 10) * PPI_96_72, + - cur_lmarg - max_rmarg) * PPI_96_72, -bposy * PPI_96_72); marg_init(); } else { @@ -233,7 +231,6 @@ static void init_ps(char *str) /* -- initialize the svg file (option '-g') -- */ static void init_svg(char *str) { - cur_lmarg = min_lmarg - 10; output = svg_output; #if 1 //fixme:test if (file_initialized > 0) @@ -241,7 +238,7 @@ static void init_svg(char *str) #endif define_svg_symbols(str, nepsf, (p_fmt->landscape ? p_fmt->pageheight : p_fmt->pagewidth) - - cur_lmarg - max_rmarg + 10, + - cur_lmarg - max_rmarg, -bposy); file_initialized = 1; user_ps_write(); @@ -732,7 +729,6 @@ void write_eps(void) close_fout(); else file_initialized = 0; - cur_lmarg = 0; cur_scale = 1.0; } @@ -937,12 +933,6 @@ void block_put(void) ln_buf[ln_num] = mbf; ln_pos[ln_num] = multicol_start == 0 ? bposy : 1; ln_lmarg[ln_num] = cfmt.leftmargin; - if (epsf) { - if (cfmt.leftmargin < min_lmarg) - min_lmarg = cfmt.leftmargin; - if (cfmt.rightmargin < max_rmarg) - max_rmarg = cfmt.rightmargin; - } ln_scale[ln_num] = cfmt.scale; ln_font[ln_num] = outft; ln_num++; diff --git a/configure b/configure index 14fc48b..2d6a7b2 100755 --- a/configure +++ b/configure @@ -1,17 +1,17 @@ #! /bin/sh # (automatic update) -VERSION=8.14.11 -VDATE=2020-12-05 +VERSION=8.14.13 +VDATE=2022-01-29 -CC=gcc -PKG_CONFIG=pkg-config -CFLAGS="-g -O2 -Wall -pipe" +: "${CC:=gcc}" +: "${PKG_CONFIG:=pkg-config}" +CFLAGS="-g -O2 -Wall -pipe $CFLAGS" srcdir=. -prefix=/usr/local +: "${prefix=/usr/local}" -INSTALL="/usr/bin/install -c" +: "${INSTALL:=/usr/bin/install -c}" if test -f ./custom; then . ./custom @@ -58,19 +58,13 @@ if test "x$DEFAULT_FDIR" = x; then DEFAULT_FDIR="$prefix/share/abcm2ps" fi -if which $PKG_CONFIG > /dev/null ; then - if $PKG_CONFIG --exists freetype2 ; then - if $PKG_CONFIG --exists pangocairo ; then - CPPFLAGS="$CPPFLAGS -DHAVE_PANGO=1 `$PKG_CONFIG pango cairo freetype2 --cflags`" - LDLIBS="$LDLIBS `$PKG_CONFIG pangocairo pangoft2 freetype2 --libs`" - else - echo "pangocairo not found - no pango support" - fi - else - echo "freetype2 not found - no pango support" - fi +if ! $PKG_CONFIG --exists freetype2 ; then + echo "pkg-config/freetype2 not found - no pango support" +elif ! $PKG_CONFIG --exists pangocairo ; then + echo "pangocairo not found - no pango support" else - echo "pkg-config not found - no pango support" + CPPFLAGS="$CPPFLAGS -DHAVE_PANGO=1 `$PKG_CONFIG pango cairo freetype2 --cflags`" + LDLIBS="`$PKG_CONFIG pangocairo pangoft2 freetype2 --libs` $LDLIBS" fi CPPFLAGS="$CPPFLAGS -I." diff --git a/debian/changelog b/debian/changelog index f5a70f3..cb90997 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +abcm2ps (8.14.13-0.1) unstable; urgency=medium + + * Non-maintainer upload. + * New upstream release. Closes: #994618. + * Update Standards-Version and copyright dates. + * Upstream ./configure now reads build flags from the environment. + * Only force debhelper build system for the affected command. + * Update watch file and metadata with new upstream github repository. + * Remove obsolete Homepage field from upstream metadata. + + -- Nicolas Boulenguez <nico...@debian.org> Sat, 05 Mar 2022 11:42:56 +0000 + abcm2ps (8.14.11-0.1) unstable; urgency=medium * Non-maintainer upload. diff --git a/debian/control b/debian/control index d075aab..5d695a8 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Build-Depends: libpango1.0-dev, pkg-config, python3-docutils, -Standards-Version: 4.5.1 +Standards-Version: 4.6.0 Rules-Requires-Root: no Homepage: http://moinejf.free.fr/ diff --git a/debian/copyright b/debian/copyright index 37fb011..ebfb35d 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: Jean-François Moine <moin...@free.fr> Source: http://moinejf.free.fr/ Files: * -Copyright: 1998-2020 Jean-François Moine (http://moinejf.free.fr) +Copyright: 1998-2021 Jean-François Moine (http://moinejf.free.fr) 1996-1998 Michael Methfessel <m...@ihp-ffo.de> License: GPL-3+ This program is free software: you can redistribute it and/or modify @@ -23,7 +23,7 @@ License: GPL-3+ Files: debian/* Copyright: 2004-2018 Anselm Lingnau <ling...@debian.org> - 2018-2020 Nicolas Boulenguez <nico...@debian.org» + 2018-2022 Nicolas Boulenguez <nico...@debian.org» License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public diff --git a/debian/rules b/debian/rules index 7a8a8d6..07afa8f 100755 --- a/debian/rules +++ b/debian/rules @@ -1,14 +1,10 @@ #!/usr/bin/make -f -DEB_BUILD_MAINT_OPTIONS := hardening=+all -DEB_CFLAGS_MAINT_APPEND := -Wall -include /usr/share/dpkg/buildtools.mk -include /usr/share/dpkg/buildflags.mk +export DEB_BUILD_MAINT_OPTIONS := hardening=+all %: - dh $@ --buildsystem=autoconf + dh $@ .PHONY: override_dh_auto_configure override_dh_auto_configure: - dh_auto_configure -- \ - $(foreach v,CC PKG_CONFIG CFLAGS CPPFLAGS LDFLAGS,'--$(v)=$($(v))') + dh_auto_configure --buildsystem=autoconf diff --git a/debian/upstream/metadata b/debian/upstream/metadata index 3384778..105a49d 100644 --- a/debian/upstream/metadata +++ b/debian/upstream/metadata @@ -1,6 +1,5 @@ Contact: moin...@free.fr Name: abcm2ps -Homepage: http://moinejf.free.fr/ -Repository: https://github.com/leesavide/abcm2ps.git -Repository-Browse: https://github.com/leesavide/abcm2ps/ -Bug-Submit: https://github.com/leesavide/abcm2ps/issues +Repository: https://github.com/lewdlime/abcm2ps.git +Repository-Browse: https://github.com/lewdlime/abcm2ps/ +Bug-Submit: https://github.com/lewdlime/abcm2ps/issues diff --git a/debian/watch b/debian/watch index 1731513..3fbd88b 100644 --- a/debian/watch +++ b/debian/watch @@ -1,2 +1,4 @@ version=4 -https://github.com/leesavide/@PACKAGE@/releases .*/v?@ANY_VERSION@@ARCHIVE_EXT@ + +https://github.com/lewdlime/@PACKAGE@/tags \ +.*/v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/deco.c b/deco.c index 0774502..9b944ef 100644 --- a/deco.c +++ b/deco.c @@ -3,7 +3,7 @@ * * This file is part of abcm2ps. * - * Copyright (C) 2000-2019 Jean-François Moine (http://moinejf.free.fr) + * Copyright (C) 2000-2021 Jean-François Moine (http://moinejf.free.fr) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -1182,7 +1182,8 @@ void deco_cnv(struct decos *dc, case 34: /* trem1..trem4 */ if (s->abc_type != ABC_T_NOTE || !prev - || prev->abc_type != ABC_T_NOTE) { + || prev->abc_type != ABC_T_NOTE + || s->dur != prev->dur) { error(1, s, "!%s! must be on the last of a couple of notes", dd->name); diff --git a/draw.c b/draw.c index a601ac5..6220b69 100644 --- a/draw.c +++ b/draw.c @@ -2097,12 +2097,11 @@ if (two_staves) error(0, k1, "*** multi-staves slurs not treated yet"); } else { y1 = k1->ys - 6; } -// don't clash with decorations -// } else { -// y1 = k1->ys + 3; + } else { + y1 = k1->ys + 3; } -// } else { -// y1 = k1->y + 8; + } else { + y1 = k1->y + 8; } } else { if (k1->stem < 0) { @@ -2117,11 +2116,11 @@ if (two_staves) error(0, k1, "*** multi-staves slurs not treated yet"); } else { y1 = k1->ys + 6; } -// } else { -// y1 = k1->ys - 3; + } else { + y1 = k1->ys - 3; } -// } else { -// y1 = k1->y - 8; + } else { + y1 = k1->y - 8; } } } @@ -2139,10 +2138,10 @@ if (two_staves) error(0, k1, "*** multi-staves slurs not treated yet"); && (!(k2->sflags & S_IN_TUPLET))) // || k2->ys > y2 - 3)) y2 = k2->ys - 6; -// else -// y2 = k2->ys + 3; -// } else { -// y2 = k2->y + 8; + else + y2 = k2->ys + 3; + } else { + y2 = k2->y + 8; } } else { if (k2->stem < 0) { @@ -2152,10 +2151,10 @@ if (two_staves) error(0, k1, "*** multi-staves slurs not treated yet"); && (!(k2->sflags & S_IN_TUPLET))) // || k2->ys < y2 + 3)) y2 = k2->ys + 6; -// else -// y2 = k2->ys - 3; -// } else { -// y2 = k2->y - 8; + else + y2 = k2->ys - 3; + } else { + y2 = k2->y - 8; } } } @@ -4387,9 +4386,10 @@ static float set_staff(void) staff_tb[staff].empty = 1; } y = 0; - if (staff > nstaff) { + if (staff > nstaff) staff--; /* one staff, empty */ - } else { + + { for (i = 0; i < YSTEP; i++) { v = staff_tb[staff].top[i]; if (y < v) @@ -4400,9 +4400,6 @@ static float set_staff(void) /* draw the parts and tempo indications if any */ y += draw_partempo(staff, y); - if (empty[staff]) - return y; - y *= staff_tb[staff].staffscale; staffsep = cfmt.staffsep * 0.5 + staff_tb[staff].topbar * staff_tb[staff].staffscale; diff --git a/format.c b/format.c index 2667656..8e20b6f 100644 --- a/format.c +++ b/format.c @@ -1140,6 +1140,8 @@ void interpret_fmt_line(char *w, /* keyword */ f = strtod(p, &q); if (*q != '\0' && *q != ' ') goto bad; + if (f < .1 || f > 10.) + goto bad; cfmt.scale = f / 0.75; // old -> new scale return; } diff --git a/front.c b/front.c index a5722cb..7ed0497 100644 --- a/front.c +++ b/front.c @@ -582,13 +582,14 @@ void frontend(unsigned char *s, goto next_eol; } } - if (strncmp("ps", (char *) begin_end, end_len) == 0) { - if (*s == '%') - goto ignore; /* comment */ - } else { - if (*s == '%' && strchr(prefix, s[1])) { - s += 2; - l -= 2; + + // ignore '%' or '%%' at start of line + if (*s == '%') { + s++; + l--; + if (*s == '%') { + s++; + l--; } } goto next; diff --git a/music.c b/music.c index e20fbd7..8dc7292 100644 --- a/music.c +++ b/music.c @@ -3,7 +3,7 @@ * * This file is part of abcm2ps. * - * Copyright (C) 1998-2019 Jean-François Moine (http://moinejf.free.fr) + * Copyright (C) 1998-2021 Jean-François Moine (http://moinejf.free.fr) * Adapted from abc2ps, Copyright (C) 1996-1998 Michael Methfessel * * This program is free software; you can redistribute it and/or modify it @@ -1975,7 +1975,7 @@ normal: break; goto cut_here; } - if (s->extra) { + if (s->extra && s->type != GRACE) { if (!extra) extra = s; else @@ -2139,8 +2139,10 @@ static struct SYMBOL *set_lines(struct SYMBOL *first, /* first symbol */ s2 = s3; if (s2) s = s2; - while (s->x == 0 || s->x + s->shrink * 2 >= xmax) + while (s && (s->x == 0 || s->x + s->shrink * 2 >= xmax)) s = s->ts_prev; + if (!s) + break; cut_here: if (s->sflags & S_NL) { /* already set here - advance */ error(0, s, "Line split problem - " @@ -2917,7 +2919,8 @@ if (staff > nst) { if (u->ymn < stb[staff].st[i].ymn) stb[staff].st[i].ymn = u->ymn; if (u->sflags & S_XSTEM) { - if (u->ts_prev->staff != staff - 1 + if (!u->ts_prev + || u->ts_prev->staff != staff - 1 || u->ts_prev->abc_type != ABC_T_NOTE) { error(1, s, "Bad !xstem!"); u->sflags &= ~S_XSTEM; @@ -3201,9 +3204,10 @@ static void init_music_line(void) /* move the voice to a non empty staff */ staff = cursys->voice[voice].staff; - while (staff < nstaff && cursys->staff[staff].empty) + while (staff <= nstaff && cursys->staff[staff].empty) staff++; - p_voice->staff = staff; + if (staff <= nstaff) + p_voice->staff = staff; } /* add a clef at start of the main voices */ diff --git a/parse.c b/parse.c index f4539cb..0aa11a6 100644 --- a/parse.c +++ b/parse.c @@ -3,7 +3,7 @@ * * This file is part of abcm2ps. * - * Copyright (C) 1998-2020 Jean-François Moine (http://moinejf.free.fr) + * Copyright (C) 1998-2021 Jean-François Moine (http://moinejf.free.fr) * Adapted from abc2ps, Copyright (C) 1996-1998 Michael Methfessel * * This program is free software; you can redistribute it and/or modify it @@ -214,7 +214,7 @@ static void sort_all(void) struct SYMBOL *s, *prev, *s2; struct VOICE_S *p_voice; int fl, voice, time, w, wmin, multi, mrest_time; - int nb, r, set_sy, new_sy; // nv + int nb, r, r2, v2, set_sy, new_sy; // nv struct SYMBOL *vtb[MAXVOICE]; signed char vn[MAXVOICE]; /* voice indexed by range */ @@ -233,8 +233,7 @@ static void sort_all(void) for (;;) { if (set_sy) { fl = 1; // start a new sequence -// if (!new_sy) { - if (1) { + if (!new_sy) { set_sy = 0; multi = -1; memset(vn, -1, sizeof vn); @@ -354,7 +353,6 @@ static void sort_all(void) || w_tb[s->type] != wmin) continue; if (s->type == STAVES) { // change STAVES to a flag - sy = sy->next; set_sy = new_sy = 1; if (s->prev) s->prev->next = s->next; @@ -362,6 +360,20 @@ static void sort_all(void) voice_tb[voice].sym = s->next; if (s->next) s->next->prev = s->prev; + + // set all voices of previous and next staff systems + // as reachable + for (r2 = 0; r2 < MAXVOICE; r2++) { + if (vn[r2] < 0) + break; + } + for (v2 = 0; v2 < MAXVOICE; v2++) { + if (sy->next->voice[v2].range < 0 + || sy->voice[v2].range >= 0) + continue; + vn[r2++] = v2; + } + sy = sy->next; // new staff system } else { if (fl) { fl = 0; @@ -468,25 +480,6 @@ static void voice_compress(void) } break; #endif - case FMTCHG: - s2 = s->extra; - if (s2) { /* dummy format */ - if (!ns) - ns = s2; - if (s->prev) { - s->prev->next = s2; - s2->prev = s->prev; - } - if (!s->next) { - ns = NULL; - break; - } - while (s2->next) - s2 = s2->next; - s->next->prev = s2; - s2->next = s->next; - } - /* fall thru */ case TEMPO: case PART: case TUPLET: @@ -554,8 +547,11 @@ static void voice_compress(void) } if (!ns) continue; + s2 = s->extra; // old compression s->extra = ns; - s->prev->next = NULL; + s->prev->next = s2; + if (s2) + s2->prev = s->prev; s->prev = ns->prev; if (s->prev) s->prev->next = s; @@ -717,6 +713,8 @@ static struct SYMBOL *go_global_time(struct SYMBOL *s, && s2->time != 0) break; } + if (!s2) + return s2; if (s2->time < voice_tb[cursys->top_voice].meter.wmeasure) s = s2; goto chk_time; @@ -913,6 +911,8 @@ static void set_bar_num(void) break; /* move the clef */ + if (!s->next) + break; s->next->prev = s->prev; s->prev->next = s->next; s->ts_next->ts_prev = s->ts_prev; @@ -2011,9 +2011,12 @@ static char txt_no_note[] = "No note in voice overlay"; error(1, s, "Erroneous end of voice overlap"); return; } - if (p_voice->time != over_mxtime) - error(1, s, tx_wrong_dur); curvoice = &voice_tb[over_voice]; + if (p_voice->time != over_mxtime) { + error(1, s, tx_wrong_dur); + if (p_voice->time > over_mxtime) + curvoice->time = p_voice->time; + } over_mxtime = 0; over_voice = -1; over_time = -1; @@ -2115,8 +2118,12 @@ static char txt_no_note[] = "No note in voice overlay"; } else { if (over_mxtime == 0) over_mxtime = p_voice->time; - else if (p_voice->time != over_mxtime) + else if (p_voice->time != over_mxtime) { error(1, s, tx_wrong_dur); + if (p_voice->time > over_mxtime) + voice_tb[over_voice].time = + over_mxtime = p_voice->time; + } } p_voice2->time = over_time; curvoice = p_voice2; @@ -2339,8 +2346,7 @@ static void get_staves(struct SYMBOL *s) if (p_voice->sym) flags = 1; } - if (flags == 0 /* if first %%staves */ - || (maxtime == 0 && staves_found < 0)) { + if (flags == 0) { /* if first %%staves */ for (voice = 0; voice < MAXVOICE; voice++) parsys->voice[voice].range = -1; } else { @@ -2799,6 +2805,8 @@ static void set_global_def(void) p_voice->s_clef->u.clef.type = TREBLE; p_voice->s_clef->sflags &= ~S_CLEF_AUTO; } + if (cfmt.staffscale) + p_voice->staffscale = cfmt.staffscale; } /* switch to the 1st voice */ @@ -3061,7 +3069,8 @@ static struct SYMBOL *get_info(struct SYMBOL *s) s = get_global_def(s); break; case 'U': - deco[s->u.user.symbol] = parse.deco_tb[s->u.user.value - 128]; + if (s->u.user.value) // if no error + deco[s->u.user.symbol] = parse.deco_tb[s->u.user.value - 128]; break; case 'u': break; @@ -3623,6 +3632,8 @@ void do_tune(void) continue; case ABC_T_TUPLET: set_tuplet(s); + if (!s->type && (s->flags & ABC_F_GR_END)) + curvoice->last_sym->flags |= ABC_F_GR_END; break; default: continue; @@ -5689,8 +5700,7 @@ static struct SYMBOL *process_pscomment(struct SYMBOL *s) return s; } if (s->state != ABC_S_TUNE) { - for (voice = 0; voice < MAXVOICE; voice++) - voice_tb[voice].staffscale = scale; + cfmt.staffscale = scale; } else { curvoice->staffscale = scale; } @@ -6156,6 +6166,13 @@ static void set_tuplet(struct SYMBOL *t) r = t->u.tuplet.r_plet; grace = t->flags & ABC_F_GRACE; + if (t->flags & ABC_F_GR_END) { + if (r != 1) { + error(1, t, "Empty tuplet"); + return; + } + grace = 0; + } l = 0; for (s = t->abc_next; s; s = s->abc_next) { @@ -6217,13 +6234,22 @@ static void set_tuplet(struct SYMBOL *t) } if (s->u.note.notes[0].len == 0) /* space ('y') */ continue; - if (grace ^ (s->flags & ABC_F_GRACE)) - continue; + if (grace) { + if (!(s->flags & ABC_F_GRACE)) { + error(1, t, "End of tuplet before end of grace sequence"); + return; + } + } else if (s->flags & ABC_F_GRACE) + continue; // skip the grace note s1 = s; l += s->dur; if (--r <= 0) break; } + if (!l) { + error(1, t, "No note in the tuplet"); + return; + } if (!s) { error(1, t, "End of tune found inside a tuplet"); return; diff --git a/svg.c b/svg.c index dc39e09..40dc53d 100644 --- a/svg.c +++ b/svg.c @@ -1148,7 +1148,7 @@ static void define_head(float w, float h) "<style type=\"text/css\">\n" ".fill {fill: currentColor}\n" ".stroke {stroke: currentColor; fill: none}\n" - "text{white-space: pre}\n"; + "text{white-space:pre; fill:currentColor}\n"; static const char svg_font_style[] = ".music {font:24px %s;\n" " fill: currentColor}\n"; @@ -1203,7 +1203,6 @@ void define_svg_symbols(char *title, int num, float w, float h) fprintf(fout, "}\n" "\t@page {margin: 0}\n" - "\ttext {white-space: pre; fill:currentColor}\n" "\tsvg {display: block}\n" "</style>\n" "<title>%s</title>\n" @@ -1323,7 +1322,10 @@ static void output_font(int span) if (imin > i) imin = i; } - fprintf(fout, "%.2fpx %.*s\"", gcur.font_s, imin, fn); + if (strchr(fn, ' ')) + fprintf(fout, "%.2fpx '%.*s'\"", gcur.font_s, imin, fn); + else + fprintf(fout, "%.2fpx %.*s\"", gcur.font_s, imin, fn); } static float strw(char *s)