grame-cncm / guidolib

Guido project - music score layout engine - music description language
http://guido.grame.fr
Mozilla Public License 2.0
156 stars 35 forks source link

Text tag introduces phantom Space #67

Closed arshiacont closed 5 years ago

arshiacont commented 5 years ago

The text tag seem to introduce extraneous Space in all Staves and Voices of a GMN Score.

Adding a \space<0> can solve the problem in some cases (e.g. when the Text in an Expressive Tempo Markup) but not in all (e.g. when the text is a expressive markup before an Intensity).

See this example GMN code and the screenshot where extra spaces are highlighted:

screenshot 2019-02-16 at 18 06 03

{[ \staff<1> \barFormat<style= "system", range="1"> (* meas. 1 *) \clef<"f4"> \key<0> \meter<"2/4", autoBarlines="off", autoMeasuresNum="system"> \text<"Andantino non troppo lento",fsize=10.6pt,fattrib="b", dy=18.6hs> _/4 \text<"espress. ma ",fattrib="i", dy=-3hs> \intens<"p", dy=-1hs> \stemsDown \slurBegin:1<curve="up"> \beamsOff \tieBegin e/4 \doubleBar (* meas. 2 *) \key<3> \beamsOff e/4 \tieEnd \beamsOff c#/4 \bar (* meas. 3 *) \beamsOff \fingering<text="0", position="above">( a0/4) \slurEnd:1 \beamsOff \fingering<text="4", position="above">( c#1/4) ] , [ \staff<2> \accol<id=0, range="2-3"> \barFormat<style= "system", range="2-3"> (* meas. 1 *) \clef<"g2"> \key<0> \meter<"2/4", autoBarlines="off", autoMeasuresNum="system"> \intens<"p", dy=-5.8hs> \stemsUp \grace( \slurBegin:1<curve="down"> \beamBegin:1 b0/16 c#1/16 \beamEnd:1) \slurBegin:1<curve="down"> \beamsOff d/4. \slurEnd:1 \beamBegin:1 c#/16 b0/16 \beamEnd:1 \slurEnd:1 \doubleBar (* meas. 2 *) \key<3> \text<"sempre ",fattrib="i", dy=-8hs> \intens<"p", dy=-6hs> \slurBegin:1<curve="down"> \beamBegin:1 \tuplet<"3", dispNote="/8", position="above">( a/12 c#1/12 a0/12) \beamEnd:1 \beamBegin:1 \tuplet<"3", dispNote="/8", position="above">( e1/12 c#/12 a0/12) \beamEnd:1 \slurEnd:1 \bar (* meas. 3 *) \slurBegin:1<curve="down"> \beamBegin:1 \tuplet<"3", dispNote="/8", position="above">( a1/12 e/12 c#/12) \beamEnd:1 \beamBegin:1 \tuplet<"3", dispNote="/8", position="above">( c#2/12 a1/12 e/12) \beamEnd:1 \slurEnd:1 ] , [ \staff<3> \staffFormat<dy=-6> \barFormat<style= "system", range="3"> (* meas. 1 *) \clef<"f4"> \key<0> \meter<"2/4", autoBarlines="off", autoMeasuresNum="system"> \stemsUp \beamsOff e-1/4 \beamBegin:1 \stacc<position="below">( f#/8) \stacc<position="below">( g#/8) \beamEnd:1 \doubleBar (* meas. 2 *) \key<3> \beamsOff a-2/4 \beamBegin:1 a-1/8 a/8 \beamEnd:1 \bar (* meas. 3 *) \beamsOff a-2/4 \beamBegin:1 a-1/8 a/8 \beamEnd:1 ] }

dfober commented 5 years ago

Actually \text tag can take 2 different forms:

You could rewrite your example like follows:

{
[ 
    \staff<1> \barFormat<style= "system", range="1"> 
    (* meas. 1 *) \clef<"f4"> \key<0> \meter<"2/4", autoBarlines="off", autoMeasuresNum="system"> 
    \text<"Andantino non troppo lento",fsize=10.6pt,fattrib="b", dy=18.6hs>(_/4) 
    \text<"espress. ma ",fattrib="i", textformat="rt", dx=-2, dy=-3hs> (\intens<"p", dy=-1hs> 
    \stemsDown \slurBegin:1<curve="up"> \beamsOff \tieBegin e/4) \doubleBar 
    (* meas. 2 *) \key<3> \beamsOff e/4 \tieEnd \beamsOff c#/4 \bar 
    (* meas. 3 *) \beamsOff \fingering<text="0", position="above">( a0/4) \slurEnd:1 
    \beamsOff \fingering<text="4", position="above">( c#1/4) ] 
, 
[   \staff<2> \accol<id=0, range="2-3"> \barFormat<style= "system", range="2-3"> 
    (* meas. 1 *) \clef<"g2"> \key<0> \meter<"2/4", autoBarlines="off", autoMeasuresNum="system"> 
    \intens<"p", dy=-5.8hs> \stemsUp \grace( \slurBegin:1<curve="down"> 
    \beamBegin:1 b0/16 c#1/16 \beamEnd:1) \slurBegin:1<curve="down"> \beamsOff d/4. \slurEnd:1 
    \beamBegin:1 c#/16 b0/16 \beamEnd:1 \slurEnd:1 \doubleBar 
    (* meas. 2 *) \key<3> \text<"sempre ",fattrib="i",  textformat="rt", dx=-2.5, dy=-8hs> (\intens<"p", dy=-6hs> 
    \slurBegin:1<curve="down"> \beamBegin:1 
    \tuplet<"3", dispNote="/8", position="above">( a/12 c#1/12 a0/12)) \beamEnd:1 
    \beamBegin:1 \tuplet<"3", dispNote="/8", position="above">( e1/12 c#/12 a0/12) \beamEnd:1 
    \slurEnd:1 \bar 
    (* meas. 3 *) \slurBegin:1<curve="down"> \beamBegin:1 
    \tuplet<"3", dispNote="/8", position="above">( a1/12 e/12 c#/12) \beamEnd:1 
    \beamBegin:1 \tuplet<"3", dispNote="/8", position="above">( c#2/12 a1/12 e/12) \beamEnd:1 
    \slurEnd:1 ]
 , 
[ 
    \staff<3> \staffFormat<dy=-6> \barFormat<style= "system", range="3"> 
    (* meas. 1 *) \clef<"f4"> \key<0> \meter<"2/4", autoBarlines="off", autoMeasuresNum="system"> 
    \stemsUp \beamsOff e-1/4 \beamBegin:1 \stacc<position="below">( f#/8) 
    \stacc<position="below">( g#/8) \beamEnd:1 \doubleBar 
    (* meas. 2 *) \key<3> \beamsOff a-2/4 \beamBegin:1 a-1/8 a/8 \beamEnd:1 \bar 
    (* meas. 3 *) \beamsOff a-2/4 \beamBegin:1 a-1/8 a/8 \beamEnd:1 
] 
}
arshiacont commented 5 years ago

Dominique,

I was actually using that mode until I discovered that Closing paranthesis can become conflictual with articulations (or sth else that I don't recall).

This means that the CREATION ORDER is probably important for Guido Parser. Is there anywhere I can see what's the correct creation order?

arshiacont commented 5 years ago

Dominique,

Studying your example, the answer actually lies in the combination of what you described and also in using textFormat tagParameter when proceeding or following an Intensity! I can actually derive that from MusicXML.

Many thanks.

arshiacont commented 5 years ago

@dfober I just implemented your solution on xml2guido but it wouldn't work in general. You combine dx and textformat to make sure things come out correctly. But the dX parameter seems to be a function of the Text and Intensity rendered size which I don't have access to in the AR domain!

Below are test examples.

If there was a way to avoid collisions in these cases it would be great. If I use text tag without paranthesis there'll be no collision with the proceeding Intensity but we have the phantom space problem!

Here is a better test example:

{[ \staff<1> \auto<autoInstrPos="on"> \instr<"MusicXML Part"> \barFormat<style= "system", range="1"> 
   (* meas. 1 *)  \clef<"g2"> \key<0> \meter<"4/4", autoBarlines="off", autoMeasuresNum="system"> \text<"subito ",fattrib="i", dx=-2.5hs, textformat="lt", dy=-5hs>( \intens<"p", dy=-3hs> \stemsDown \beamsOff e2/4)
 \beamsOff e/4 \beamsOff f/4 \intens<"ffff", dy=-1.6hs> \text<" furioso",fattrib="i", dx=2hs, textformat="lt", dy=-3.6hs>( \beamsOff g/4)
 \bar 
   (* meas. 2 *)  \beamsOff g/4 \beamsOff f/4 \intens<"pp", dy=-1hs> \text<" sempre",fattrib="i", dx=2hs, textformat="lt", dy=-3hs>( \beamsOff e/4)
 \beamsOff d/4 \bar 
   (* meas. 3 *)  \text<"subito ",fattrib="i", dx=-5.4hs, textformat="rt", dy=-3.2hs>( \intens<"p", dy=-1.2hs> \stemsAuto \beamsOff c/1)
 ]
  }

How it looks like in Guido: screenshot 2019-02-18 at 17 03 44

How it should look like: screenshot 2019-02-18 at 17 04 16

dfober commented 5 years ago

ok. A safer solution would be to extend \intens with text attributes...

arshiacont commented 5 years ago

That would be great.. the subtility is that sometimes text is Before and sometimes After the intensity...

dfober commented 5 years ago

just a matter of an additional attribute

dfober commented 5 years ago

that's done ! It's illustrated in gmn-examples/new-tags-v1.66/intens.gmn