Skip to content

0.12 handles CJK fonts incorrectly  #5277

Closed as not planned
Closed as not planned

Description

@leana8959

Description

Hello,

I noticed that documents with CJK fonts are compiled with "tofu" text when using typst version 0.12.
I also noticed that compiling to svg works just fine, this seems to be related to pdf.

#set text(size: 3em)
#set align(center + horizon)

我在測試我的 CJK 字體

The one that works is 0.11.1.

0.11.1
0.12.0

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Oct 22, 2024
  2. frozolotl commented on Oct 22, 2024

    @frozolotl
    Contributor

    From what I can gather, the problem lies with the font being a variable font.

    When using one of the static Noto Serif CJK variants, the output looks perfectly fine on both 0.11.1 and 0.12.0.
    After switching to a variable variant, tofus appear on 0.12.0 and on first glance looks fine on 0.11.0. However, that is just when exporting to PDF.

    When exporting to PNG, the output in 0.11.1 is noticeably worse than on 0.12.0:

    • 0.11.1:
      0.11.1
    • 0.12.0:
      0.12.0

    Considering that variable font export never truly functioned correctly for PDFs either (#185), I think the tofus are actually the better choice.

    The ideal solution would of course be to support variable fonts, but until that date, you'll have to use a static font.
    We could also consider warning the user when trying to use a variable font, or not even selecting it when searching for fonts. Both of these seem tricky and counterproductive, though.

  3. leana8959 commented on Oct 23, 2024

    @leana8959
    Author

    I see, I’ll try using a static font and see if that fixed the problem. Thank you !

  4. leana8959 commented on Oct 23, 2024

    @leana8959
    Author

    I confirm that Noto CJK's static variant works :)

    Would it be possible (if it's a good idea) to detect whether the user is trying to use variable fonts, and show a compiler hint?

  5. laurmaedje commented on Oct 26, 2024

    @laurmaedje
    Member

    Opened #5304, closing this.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions