gregorio-project / gregorio

The Gregorio Project
http://gregorio-project.github.io
Other
155 stars 43 forks source link

Support brackets in NABC typography #1569

Open lbssousa opened 1 year ago

lbssousa commented 1 year ago

Some works like Antiphonae et Responsoria, by Mons. Alberto Turco, uses brackets around adiastematic neums to indicate that they are editor choices not corresponding necessarily to original ancient manuscripts.

I would like to suggest such an addition to NABC typography.

xmarteo commented 4 months ago

I volunteer to add this in the following way:

@rpspringuel @jakubjelinek can you give me a go for this?

jakubjelinek commented 4 months ago

I think the fonts used for gabc rendering already do have such brackets, what is used say for ([[ce]]) ([[gi]]) ([[fh]]) So, syntax-wise, I think it would be best to do the same in nabc, so a(g|[[vi]]) and also switch to the other font at that point, pick up somehow the right height and vertical position (perhaps from measuring the height of the neumes in between?) and then switch back to the gregall/grelaon/gresgmodern font.

xmarteo commented 4 months ago

Avoiding duplicating brackets across fonts is good. Note that in a typical use case there may be long passages between brackets, spanning multiple syllables and multiple lines.

I can attempt something, but as far as I can see the main while loop in gregallparse_neumes does not easily allow for either forward measurement of the neumes heights across the score, or multiple passes once this measurement is done, since it only gets passed the NABC for a given syllable.

So, we can do one of the following:

xmarteo commented 4 months ago

@jakubjelinek Any guidance on this?

jakubjelinek commented 3 months ago

I think we should start by writing a TeX macro which temporarily switches to the music font and typesets the bracket, first test it completely outside of gregorio score, then test it in [alt:...] and then tweak the nabc parsing to emit those after parsing [[ or ]]. But I have trouble writing such a macro. From what I can see in the fonts, there isn't a single character for the Brackets, but there are Bracket{Left,Right}{Bottom,Line,Top} characters. And gregoriotex.lua should predefine macros for all characters in map_font. But, when I try to use \hbox{\gre@font@music\GreBracketLeftBottom} or \hbox{\gre@font@music\GreCPBracketLeftBottom} either outside of score or in [alt:], it just doesn't work. @rpspringuel any ideas here?

jakubjelinek commented 3 months ago

@rpspringuel Oops, mistyped, see above.