Skip to content

Text gradient in a zero-height block is invisible in PDF #9049

Open

Description

@woerndl

Description

This exports a shading pattern with a singular matrix:

#block(height: 0pt, text(fill: gradient.linear(red, blue))[Gradient text])

The PDF contains /Matrix [59.488 0 0 0 70.86614 771.0236].

  • Ghostscript 10.08.0: the page is blank.
  • poppler 26.11.0 (pdftocairo): prints Syntax Warning: matrix not invertible and the page is blank.
  • PNG export: the text is solid red.

A one-line heading under #set text(top-edge: "baseline") also has zero height and gives a singular matrix.

convert_paint in crates/typst-pdf/src/paint.rs replaces a zero size with 1 pt (L97–102), but convert_gradient then uses state.container_size() for RelativeTo::Parent (L209), which still has the zero height. The code is the same on main.

Expected: the gradient shows from red to blue, as in a block with a height.

Reproduction URL

none

Operating system

macOS

Typst version

  • I am using the latest version of Typst (0.15.1)

Activity

  1. added
    pdf
    visualize
    bug
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpdfvisualize

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions