Skip to content

Gradient fill wrongly applied to color emojis in PDF output #8154

Closed

Description

@sijow

Description

With color emojis, a simple text fill is ignored as expected, but with a gradient the fill is applied:

#set text(
  size: 36pt,
  font: ("Libertinus Serif", "Noto Color Emoji"),
  fallback: false,
  fill: red,
)
Package #emoji.package
#set text(fill: gradient.linear(red, blue))
Package #emoji.package
Image

This is only observed in the PDF output (PNG and SVG ignore the gradient). Tested on main and 0.14.2.

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Apr 22, 2026
  2. saecki commented on Apr 22, 2026

    @saecki
    Member

    I've been meaning to open an issue for this too. I haven't investigated this further, but was suspecting a bug in how COLR glyphs are handled in krilla.

  3. added
    pdf
    on Apr 22, 2026
  4. added
    visualize
    on Apr 22, 2026
  5. LaurenzV commented on Apr 22, 2026

    @LaurenzV
    Collaborator

    Hmm, can't reproduce this... Instead, for me it looks something like this:

    Image

    This is because COLR has certain blend modes which aren't supported natively in PDF... Haven't figured out yet what the best way of supporting those is.

  6. sijow commented on Apr 23, 2026

    @sijow
    ContributorAuthor

    So there's a lot of variability in how renderers handle gradients and vector fonts.

    Using Noto Color Emoji 2.051 (latest) and rendering the output of the following command:

    typst c --font-path [bitmap or vector font dir] --ignore-system-fonts file.typ file.pdf
    
    Image

    Some things that puzzle me:

    • Why Typst renders the vector font correctly while the hayro render tool doesn't (hayro 0.4.0 gives the same result). And it's really the vector font, I tried a 1200 ppi rendering and it looks good.
    • Why does Typst squeeze the bitmap emoji horizontally? (maybe related to Discrepancy between emoji sizing between PDF and PNG/SVG #8072)
    • Even Chrome and Firefox render the vector emoji in black, but that's wrong right? Then how to know if the culprit is Krilla or the browser...
  7. LaurenzV commented on Apr 24, 2026

    @LaurenzV
    Collaborator

    As mentioned, the fact that for COLR font the emoji is rendered black, is a bug in krilla. However, I fixed this yesterday, so it should be fixed in the next Typst release: LaurenzV/krilla#358

    Regarding the gradient issue, given that Firefox/Chrome can handle it fine, I'm leaning towards it being a bug in Poppler and seemingly mupdf.

  8. LaurenzV commented on Apr 24, 2026

    @LaurenzV
    Collaborator

    See also here:

    Image

    From left to right, this is: mupdf, ghostscript, PDFium, poppler, Apple Preview, PDFBox and Hayro. I also checked Adobe Acrobat and it renders fine there as well.

  9. LaurenzV commented on Apr 24, 2026

    @LaurenzV
    Collaborator

    I've reported it to mupdf: https://bugs.ghostscript.com/show_bug.cgi?id=709368

    If you feel like it, feel free to report it to poppler as well!

    In any case, I think we can close this issue once krilla has been bumped since there isn't more we can do from our side, apart from the fix that I linked above.

  10. sijow commented on Apr 24, 2026

    @sijow
    ContributorAuthor

    Awesome, thanks! I reported it for poppler here: https://gitlab.freedesktop.org/poppler/poppler/-/work_items/1710 (copy-pasting your description, I hope you don't mind).

  11. added
    upstream
    on Apr 27, 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

    bugpdfupstreamvisualize

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions