Le 21/06/2015 21:02, Élie Roux a écrit :
>> If no one else is tackling #59, I'm willing to give it a try, but I'll
>> admit I don't quite follow the suggestions on the issue in github and
>> will need more guidance as to what I need to tweak to adjust the spacing
>> for a given line.  It seems like Br. Samuel has/had something in mind,
>> but hasn't had time to try out his ideas.

So here's the current state of my ideas on this:

Globally
--------

each glyph in the score gets an ID, the easiest seems to give an ID per
score, and then give each glyph the ID of the score plus the glyph count
inside the syllable. (the "plus" here can be several things)

each compilation:
- at the end, write an aux file (maybe in lua directly, something like
main-lualatex.luaux) containing the ID of the last glyphs of each line
- at the beginning, read the .luaux file if it exists, and corrects
vertical spacings accordingly

This will produce a more or less instable system, but all should be fine
if the same document get compiled twice.


Writing the .luaux file
-----------------------

To get the last glyph of a line, the best is certainly to give each
glyph a distinguishable LuaTeX attribute (containing the ID of the
glyph, and its top and bottom height), and then read the attributes in
postlinebreak_filter callback, to get them line by line, and spot the
final attribute (and thus glyph) of each line. It's also necessary to
know if there is a correction to make to the line height. This
information can be retrieved in postlinebreak-filter too.

The I/O should be relatively easy, a string can be kept in lua, and
written in a file at the end of the compilation.


Using the .luaux file
---------------------

The .luaux file is read at the beginning of the compilation, and sets an
array called something like last_glyphs, and that contains

The \glyph macro would call some code at the end, this code will look in
the last_glyphs list if the current glyph is a last glyph of a line and
if there is a correction to make to line height. If there is, it
corrects the different heights, and redefines the clef. It shouldn't be
hard.

Note that this final code could simply call \greendofline, but that
doesn't seem a very good idea, as this would freeze line breaks (while
the proposed algorithm would not).


That's what I currently have in mind... This is not very simple to make,
but I don't think it's too complex on a conceptual level (I had even
simpler ideas, but they would be just too hard to implement and too
slow)... Please tell me if you need more details!

Thank you,
-- 
Elie

_______________________________________________
Gregorio-devel mailing list
[email protected]
https://mail.gna.org/listinfo/gregorio-devel

Répondre à