Skip to content

Wrong "monospace" font fallback for CJK characters in raw block #3385

@Myriad-Dreamin

Description

@Myriad-Dreamin

Description

The following text are rendered wrongly on most Windows. This is because typst usually makes font fallback to "LiSu", an ancient chinese font, or even fails to fallback to any font.

运行结果:

```
请输入一个整数:16
该整数的平方根为: 4.0
```
image

Though Chinese users already have to style their documents with a template overriding many default settings, I believe it deserves to make our settings more sensible. I suggest to extend this fallback list for different systems:

out.set(TextElem::set_font(FontList(vec![FontFamily::new("DejaVu Sans Mono")])));

#show raw: set text(font: (
  "DejaVu Sans Mono",
  "Microsoft YaHei", // for Windows users
  "PingFang SC", // for macOS users
  "...", // for Linux users
))
image

Reproduction URL

No response

Operating system

Windows 11

Typst version

  • I am using the latest version of Typst

Reference: https://www.tug.org/texlive//Contents/live/texmf-dist/tex/latex/ctex/fontset/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcjkChinese, Japanese, Korean typography.textRelated to the text category, which is all about text handling, shaping, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions