[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Double-underline markup
From: |
David Kastrup |
Subject: |
Re: Double-underline markup |
Date: |
Sun, 20 Oct 2019 12:58:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Thomas Morley <address@hidden> writes:
> Am Sa., 19. Okt. 2019 um 14:45 Uhr schrieb David Kastrup <address@hidden>:
>
> 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?
Oh very most definitely. I was thinking of props here.
> 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)))
Basically, the idea was to just call something like
(interpret-markup layout (prepend-alist-chain 'offset (1+ offset) props) arg)
for the call of interpret-markup (of course using the proper arithmetic
on the proper property).
--
David Kastrup
- Re: Double-underline markup, (continued)
- Re: Double-underline markup, Thomas Morley, 2019/10/19
- Re: Double-underline markup, David Kastrup, 2019/10/19
- Re: Double-underline markup, Thomas Morley, 2019/10/19
- Re: Double-underline markup, Aaron Hill, 2019/10/19
- Re: Double-underline markup, David Kastrup, 2019/10/19
- Re: Double-underline markup, Thomas Morley, 2019/10/19
- Re: Double-underline markup, Urs Liska, 2019/10/19
- Re: Double-underline markup, David Kastrup, 2019/10/19
- Re: Double-underline markup, Thomas Morley, 2019/10/19
- Re: Double-underline markup, Thomas Morley, 2019/10/20
- Re: Double-underline markup,
David Kastrup <=
- Re: Double-underline markup, Thomas Morley, 2019/10/20
- Re: Double-underline markup, David Kastrup, 2019/10/20
- Re: Double-underline markup, Werner LEMBERG, 2019/10/19
- Re: Double-underline markup, Carl Sorensen, 2019/10/19
- Re: Double-underline markup, Thomas Morley, 2019/10/20