Skip to content

Variable font in SVG changes from thin weight to tofu (possible regression?) #8367

Closed

Description

@YDX-2147483647

Description

Note

Considering that #185 is still open, I'm not sure if this can be considered as a regression bug. I'm just reporting it anyway.

Typst v0.14.2 renders texts in variable fonts as the lightest weight when exporting to SVG or PDF, and turn them into tofus when exporting to PNG.

Now the SVG case changes to tofus. (PDF & PNG unchanged)

Example

// Exported to SVG
#set page(height: auto, width: auto, margin: 1em)
#set text(5em, fallback: false)

#text(font: "Source Han Sans SC VF")[可变字体]
#text(font: "Source Han Sans SC")[不可变字体]
Image Image

Operating system

Windows

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on May 28, 2026
  2. added
    svg
    text
    on May 28, 2026
  3. self-assigned this
    on May 29, 2026
  4. laurmaedje commented on Jun 4, 2026

    @laurmaedje
    Member

    The weight being thin instead of regular is just because that's the default of the font without configured variations. With my variable fonts PR, it's correct.

    The problem with the tofus is specific to TTF fonts with 65536 glyphs. I've opened #8434 to track this more specifically.

    I cannot reproduce this having rendered correctly before with the TTF font in SVG export. I just get a fully empty page. The change from nothing to tofus makes sense due to #7679. Are you sure that you can reproduce the thin weight in SVG export on 0.14 with the TTF (as opposed to OTF) variant?

  5. YDX-2147483647 commented on Jun 5, 2026

    @YDX-2147483647
    ContributorAuthor

    Are you sure that you can reproduce the thin weight in SVG export on 0.14 with the TTF (as opposed to OTF) variant?

    Here are my results for SVG:

    v0.14.2 331f101
    Variable/TTF empty tofu
    Variable/OTF thin weight tofu
  6. laurmaedje commented on Jun 5, 2026

    @laurmaedje
    Member

    That matches my investigation. The thin weight stuff is fixed with #8425 and the empty -> tofu is tracked by #8434 and not a regression imo. If anything, it's an improvement as you can more clearly see that something went wrong. I'll close this then.

  7. laurmaedje commented on Jun 5, 2026

    @laurmaedje
    Member

    Actually, I misread. The OTF tofu is kind of a regression...

  8. added
    regression
    on Jun 5, 2026
  9. laurmaedje commented on Jun 5, 2026

    @laurmaedje
    Member

    But my variable fonts branch still fixes that. :)

    Sorry for the back and forth, I got a bit confused...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugregressionsvgtext

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions