diff --git a/CHANGELOG.md b/CHANGELOG.md index 784aebee0..dc7546062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/). - Different glyphs are now used for puncta inclinata in an ascent versus in a descent. A heuristic algorithm is used to ensure that the glyphs match when grouped together. If the algorithm chooses the wrong shape, use `0` (for descending) or `1` (for ascending) to force an orientation. See [UPGRADE.md](UPGRADE.md) and [#856](https://github.com/gregorio-project/gregorio/issues/856) for details. - The shape of the fused oriscus at ambitus one in the greciliae font has been tweaked to form a nicer connection (see [#1079](https://github.com/gregorio-project/gregorio/issues/1079)). - Syllables are now rewritten to improve ligature rendering. This may be disabled by issuing `\gresetsyllablerewriting{off}`. See GregorioRef for details (for the change request, see [#1098](https://github.com/gregorio-project/gregorio/issues/1098)). +- Italic, bold, underlined, small capital, teletype, and colored styles now span multiple syllables. Gregorio will also more consistently raise errors when styles are improperly started or ended. See [UPGRADE.md](UPGRADE.md) and [#1121](https://github.com/gregorio-project/gregorio/issues/1121) for details. ## [4.2.0-beta1] - 2016-04-27 diff --git a/UPGRADE.md b/UPGRADE.md index 637db1fb3..04cb08e12 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -40,6 +40,18 @@ Additionally, if you were redefining `\greemergencystretch`, you should now be c If the note following a custos has an alteration (flat, natural, or sharp), the custos will now also have that alteration typeset before it. If you prefer the old behavior, use `\gresetcustosalteration{invisible}`. This setting may be switched to `visible` and `invisible` between scores. +### Punctum inclinatum orientation + +As of version 4.2, a different glyph is used for puncta inclinata in an ascent versus puncta inclinata in a descent. However, because the two shapes clash with each other, Gregorio will attempt to use the same shape for all notes within a string of puncta inclinata. This is accomplished by a heuristic algorithm that determines the glyph to use, but tastes differ, so you may override the shape by appending `0` (to force descending) or `1` (to force ascending) after the letter used for the punctum inclinatum. + +Two additional distances have been added to handle strings of puncta inclinata which both ascend and descend. `descendingpunctuminclinatumascendingshift` will be used between two descending punctum inclinatum glyphs which ascend in pitch, and `ascendingpunctuminclinatumdescendingshift` will be used between two ascending punctum inclinatum glyphs which descend in pitch. + +### Styles spanning syllables + +From version 4.2, gabc styles persist through syllables so you can now, for instance, style an entire verse differently from the rest of the piece by starting the style at the beginning of the verse and ending it at the end of the verse. This covers italics (``), bold (``), small capitals (``), underlined text (`
    `), colored text (``), and "teletype" text (``). + +Prior to version 4.2, Gregorio inconsistenly indicated style errors. Now, errors like ending a style that is not started and starting a style that is already started will be caught more consistently. If you are getting errors to this effect, double-check the styles in your score to make sure that styles are started and ended properly. + ## 4.1.2 @@ -59,12 +71,6 @@ As always, please file a bug report if you have any problems with the update pro To avoid conflicts with the LilyPond Parmesan font, the Gregorio Parmesan font is now called Grana Padano. If you were using `\gresetgregoriofont{parmesan}`, you should now use `\gresetgregoriofont{granapadano}`. -### Punctum inclinatum orientation - -As of version 4.2, a different glyph is used for puncta inclinata in an ascent versus puncta inclinata in a descent. However, because the two shapes clash with each other, Gregorio will attempt to use the same shape for all notes within a string of puncta inclinata. This is accomplished by a heuristic algorithm that determines the glyph to use, but tastes differ, so you may override the shape by appending `0` (to force descending) or `1` (to force ascending) after the letter used for the punctum inclinatum. - -Two additional distances have been added to handle strings of puncta inclinata which both ascend and descend. `descendingpunctuminclinatumascendingshift` will be used between two descending punctum inclinatum glyphs which ascend in pitch, and `ascendingpunctuminclinatumdescendingshift` will be used between two ascending punctum inclinatum glyphs which descend in pitch. - ## 4.1.1 diff --git a/src/gabc/gabc-score-determination.h b/src/gabc/gabc-score-determination.h index 3b3016d70..3400e1004 100644 --- a/src/gabc/gabc-score-determination.h +++ b/src/gabc/gabc-score-determination.h @@ -28,6 +28,17 @@ #include "struct.h" #include "gabc.h" +/* The bits in this enum are named to correspond with the _BEGIN/_END tokens */ +typedef enum { + SB_I = 0x01, + SB_B = 0x02, + SB_TT = 0x04, + SB_SC = 0x08, + SB_UL = 0x10, + SB_C = 0x20, + SB_ELISION = 0x40 +} gabc_style_bits; + typedef union gabc_score_determination_lval_t { char *text; char character; @@ -36,8 +47,9 @@ typedef union gabc_score_determination_lval_t { #define YYSTYPE gabc_score_determination_lval_t #define YYSTYPE_IS_DECLARED 1 -int gabc_score_determination_lex(void); -#define YY_DECL int gabc_score_determination_lex(void) +#define YY_DECL \ + int gabc_score_determination_lex(gabc_style_bits *const styles) +YY_DECL; #define YYLTYPE gregorio_scanner_location diff --git a/src/gabc/gabc-score-determination.l b/src/gabc/gabc-score-determination.l index 314efb497..217137611 100644 --- a/src/gabc/gabc-score-determination.l +++ b/src/gabc/gabc-score-determination.l @@ -35,9 +35,35 @@ #include "gabc-score-determination.h" #include "gabc-score-determination-y.h" -static unsigned char style_stack = 0; static bool eof_found = false; +#define START_STYLE(STYLE) \ + if (*styles & SB_ ## STYLE) { \ + gregorio_messagef("gabc_score_determination_lex", VERBOSITY_ERROR, 0, \ + _("style already started: %s"), gabc_score_determination_text); \ + } else { \ + *styles ^= SB_ ## STYLE; \ + return STYLE ## _BEGIN; \ + } + +#define END_STYLE(STYLE) \ + if (*styles & SB_ ## STYLE) { \ + *styles ^= SB_ ## STYLE; \ + return STYLE ## _END; \ + } else { \ + gregorio_messagef("gabc_score_determination_lex", VERBOSITY_ERROR, 0, \ + _("style not started: %s"), gabc_score_determination_text); \ + } + +#define RETURN_CHARACTERS \ + gabc_score_determination_lval.text = \ + gregorio_strdup(gabc_score_determination_text); \ + return CHARACTERS + +#define RETURN_SPACE \ + gabc_score_determination_lval.text = gregorio_strdup(" "); \ + return CHARACTERS + #define YY_NO_INPUT #define YY_INPUT(buf,result,max_size) \ @@ -78,7 +104,7 @@ static bool eof_found = false; %x attribute %x score %x notes -%x style +%x sp %x verb %x comments %x inicomments @@ -217,127 +243,75 @@ semicolon. */ gabc_score_determination_text[0]); } [\n\r][\n\r \t]* { - gabc_score_determination_lval.text = gregorio_strdup(" "); - return CHARACTERS; + RETURN_SPACE; } -[^-\{\}\(\[\]<%\n\r]+ { - gabc_score_determination_lval.text = - gregorio_strdup(gabc_score_determination_text); - return CHARACTERS; +[^-\{\}\(\[\]<%\n\r]+ { + RETURN_CHARACTERS; } - { return HYPHEN; } - { + { return NLBA_B; } -<\/nlba> { +<\/nlba> { return NLBA_E; } - { - BEGIN(style); - style_stack ++; - return I_BEGIN; + { + START_STYLE(I); } -