Skip to content

Gradients on curve elements don't use the correct bounding box when last segment is curve.line #6068

@Mc-Zen

Description

@Mc-Zen

Description

Consider

#curve(  
  curve.line((40pt, 40pt)),
  stroke: gradient.linear(blue, red).sharp(2)
)

Due to the sharp gradient, we expect a line that is half red and half blue but actually it is rendered

  • entirely blue with png and
  • entirely red with pdf and svg export.

The issue does not occur with

  • path
    #path(
      (0pt, 0pt),
      (40pt, 40pt),
      stroke: gradient.linear(blue, red).sharp(2)
    )
  • when using a curve.quad or curve.cubic element, e.g.,
    #curve(  
      curve.quad(none, (40pt, 40pt)),
      stroke: gradient.linear(blue, red).sharp(2)
    )

Note that this has nothing to do with sharp gradients, they are just better to demonstrate the issue.

Reproduction URL

No response

Operating system

No response

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-investigationMore investigation is necessary.visualizeRelated to the visualize category, which is about drawing and illustrating

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions