Am Sa., 19. Okt. 2019 um 14:45 Uhr schrieb David Kastrup <d...@gnu.org>: > > Thomas Morley <thomasmorle...@gmail.com> writes: > > > Am Sa., 19. Okt. 2019 um 13:35 Uhr schrieb David Kastrup <d...@gnu.org>: > >> > >> Thomas Morley <thomasmorle...@gmail.com> writes: > > > >> > Iiuc, you recommend to fix \underline to make it work with most simple > >> > input like: > >> > > >> > \markup { > >> > \override #'(offset . 12) \underline > >> > \override #'(offset . 10) \underline > >> > \override #'(offset . 8) \underline > >> > \override #'(offset . 6) \underline > >> > \override #'(offset . 4) \underline > >> > "underlined" > >> > } > >> > > >> > I'll have a look. > >> > >> No, to have it work with most simple input like > >> > >> \markup > >> \underline > >> \underline > >> \underline > >> \underline > >> \underline > >> "underlined" > > > > Ok, understood. I'll give it a try... > > I mean, I might well be too naive about this. If the underline is > occuring in a fixed position with regard to the baseline, there are only > a few obvious avenues to have multiple underlines work: > > a) change the baseline. That's not really acceptable when mixing > underlined and non-underlined text
Yep. I think it's not the way to go. > b) change a property (akin to offset but probably unique to \underline > to avoid unexpected interactions) for the sake of additional > underline calls. That would result in the _innermost_ \underline call > ending up lowest. I tried to put a variable into layout's 'text-font-defaults (for now named foo) to keep track of the used offset. Ofcourse subsequent calls of \underline with different text will use the then stored value of foo. Though, if I clear foo first then it's useless. Currently I don't see a way out. Maybe putting it in layout is the wrong way? Any hints? Anyway, here the insufficient code so far: #(define-markup-command (underline-tst-II layout props arg) (markup?) #:category font #:properties ((thickness 1) (offset 2)) (let* ((thick (ly:output-def-lookup layout 'line-thickness)) (underline-thick (* thickness thick)) (m (interpret-markup layout props arg)) (arg-x-ext (ly:stencil-extent m X)) (x1 (car arg-x-ext)) (x2 (cdr arg-x-ext)) (arg-y-ext (ly:stencil-extent m Y)) (text-font-defaults (ly:output-def-lookup layout 'text-font-defaults)) (foo (assoc-get 'foo text-font-defaults 0)) (line (make-line-stencil underline-thick x1 0 x2 0)) (new-stil (ly:stencil-combine-at-edge m Y DOWN line (- (+ (* thick (+ foo offset)) (car arg-y-ext)) (/ underline-thick 2)))) (new-stil-y-ext (ly:stencil-extent new-stil Y))) (ly:output-def-set-variable! layout 'text-font-defaults (acons 'foo (+ offset foo) (ly:output-def-lookup layout 'text-font-defaults))) (ly:make-stencil (ly:stencil-expr new-stil) arg-x-ext new-stil-y-ext))) \markup \underline-tst-II \line { \underline-tst-II \underline-tst-II \underline-tst-II \underline-tst-II \underline-tst-II \underline-tst-II "pq-1-tst" \underline-tst-II \underline-tst-II \underline-tst-II \underline-tst-II \underline-tst-II \underline-tst-II "pq-2-tst" } > c) somehow affect bounding box/outline in a manner that can be > interpreted for moving the whole next underline to a different position > while retaining the baseline. That's sort of the handwavy "do magic" > option that may or may not be workable at all. If b) is not doable I'll have think more about the "do magic" Or "more magic" http://www.catb.org/~esr/jargon/html/magic-story.html lol Thanks, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user