lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Issue 3778: Use bounding box as skylines for markup in svg b


From: Han-Wen Nienhuys
Subject: Re: [PATCH] Issue 3778: Use bounding box as skylines for markup in svg backend
Date: Fri, 24 Apr 2020 21:18:10 +0200

Can you add  a regression test that shows the problem?

On Fri, Apr 24, 2020 at 8:50 PM Kevin Barry <address@hidden> wrote:
>
> As there is no routine for determining skylines for utf-8-string
> stencils, they normally fall back to the grob's bounding box, which is
> fine. However, when there is a mixture of utf-8-string and other types
> of stencil (which have associated skyline functions) in a single grob,
> the entire grob gets a skyline determined only from the non-utf-8-string
> stencils. This sometimes causes the text portion of such mixed grobs
> (e.g.  metronome marks) to collide with other grobs.
>
> While looping over the stencils, check for utf-8-string and if found,
> clear the skylines and break out of the loop. Empty skylines forces a
> fallback to the grob's bounding box, which restores the behaviour from
> before the patch to improve skyline approximations (issue 2148). This
> does not fix the issue that there is no routine for determining skylines
> for utf-8-strings when the backend is svg, but it does at least remove
> the collisions without changing the behaviour in non-broken situations.
> ---
>  lily/stencil-integral.cc | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/lily/stencil-integral.cc b/lily/stencil-integral.cc
> index 7b12eaf17b..47179148cd 100644
> --- a/lily/stencil-integral.cc
> +++ b/lily/stencil-integral.cc
> @@ -1097,7 +1097,14 @@ Stencil::skylines_from_stencil (SCM sten, Real pad, 
> SCM rot, Axis a)
>    vector<Box> boxes;
>    vector<Drul_array<Offset> > buildings;
>    for (SCM s = scm_reverse_x (data, SCM_EOL); scm_is_pair (s); s = scm_cdr 
> (s))
> -    stencil_dispatcher (boxes, buildings, scm_caar (s), scm_cdar (s));
> +    {
> +      // If any stencils are utf-8-string, fall back on the bounding box
> +      if (scm_is_eq (scm_cadar (s), ly_symbol2scm ("utf-8-string"))) {
> +          boxes.clear();
> +          break;
> +      }
> +      stencil_dispatcher (boxes, buildings, scm_caar (s), scm_cdar (s));
> +    }
>
>    // we use the bounding box if there are no boxes
>    // FIXME: Rotation?
> --
> 2.25.3
>
>


-- 
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]