2011/9/25 Werner LEMBERG <w...@gnu.org> > Actually, we don't *need* `\-' at all since Unicode already provides > characters to control hyphenation: > > 00AD SOFT HYPHEN > 2010 HYPHEN > 2011 NON-BREAKING HYPHEN > > Bertrand, does your code work support them?
Here is how it works for the moment: The Scheme command wordwrap-markups puts a maximum amount of words in a line so that the space between the words is at least word-space. Before continuing to the next line, wordwrap-markups tries to put one letter of the next word plus the hyphen if '--' is following this letter (and if the space between words is at least word-space). The same process is repeated for the rest of the word and stops before the space between the words reaches word-space. We therefore have the correct break. The first "half" of the word plus the hyphen is added to the line while the other "half" is put on the next line. I added the soft hyphen to default-string-replacement-alist ; text-interface.cc replaces '--' by a soft hyphen. The string '--' is therefore totally invisible when using interpret-markup, so the calculation of the width of a word in wordwrap-markups isn't modified by the presence of '--' in the markups. I made a command 'apply-string-proc-to-markup' to achieve the parsing. It's similar to markup->string, except that it rebuilds the markup after applying a procedure to the internal string of a markup (if there's one, of course). This allows to work on the string of a markup without modifying anything else... That's why I can break a markup in two parts and check if '--' is in the string of a markup. So this is the short version: I'm using the soft hyphen, but we can't use it to specify how to break words. It's not a flexible use, that's one of the reasons why I still need to work on it. I totally agree with Werner that soft hyphens, hyphens and non-breaking hyphens must be supported. And I also agree with Janek that there must be an ASCII solution. Now, what is better between '--' and '\-': '--' stands for an en dash in many languages. I proposed to use it in the list of special characters I just pushed, but we decided to use – instead, because '--' already stands for hyphenation in the lyrics. As Janek said, if we want to make hyphenation in the markups, the syntax must be the closest possible. And I really don't want to change the lyric hyphen for '\-'. Typesetting lyrics with '--' is much faster, especially on a french keyboard. '\-' can't easily work in lyrics, because of the '\'. It is an escaped character that defines a musical or markup command and must be followed by a letters, not '-' or anything else. Bertrand
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel