How to set the Chinese font for use in spans within English text

Using Libertinus Serif as the base font of a document, in a string of inline Chinese characters, the first is rendered in some equivalent serif-type font, but subsequent characters are rendered in a non-serif type font (probably ‘PingFang SC’ on Mac).

SCR-20250325-piho

How can I create a rule to ensure that all Chinese characters are rendered in an appropriate given font like Songti SC?

Thanks

I think you want something like this:

#set text(font: ("Songti SC", (name: "Libertinus Serif", covers: "latin-in-cjk")))

That is, if your main document language is Chinese.

Otherwise, I think this should work:

#set text(font: ("Libertinus Serif", "Songti SC"), fallback: false)

The fallback: true will ensure that no other font is used, but this could potentially mean that some characters will not be displayed.

text.font

Thanks. My main document language is English, but your alternative fails because the Web app, which I’m using at the moment, doesn’t recognise Songti SC,

but if I replace “Songti SC” with “Noto Serif CJK SC” it works. I found reference to that in the documentation, so thank you for your help.

1 Like

You can always bring your fonts (files) with you into the project. It will pick them up.

Thanks again. Actually Noto Serif CJK SC works very well, so I’ll stick with that for the web app. I have installed it on my computer, so I can use it for other purposes too.

I use Noto CJK fonts because it’s the most popular FOSS fonts. But I know from a small experience that natives use some other fonts, maybe some standard fonts in some OS.

I am native English, though have worked with Chinese for many years. Songti SC is standard on recent Mac OS’s, though the default SC font is PingFang SC, a sort of Helvetica equivalent which I don’t like. I don’t know the copyright status of Songti SC. I have recently moved to using to FOSS fonts, particularly Libertinus Serif for most texts, so Noto Serif CJK suits me fine for where I need Chinese, and it looks good with Libertinus Serif.

SCR-20250326-lkzw

I work with a Windows-based Chinese collaborator so anything shared with her has whatever is standard on our machines with automatic substitution where necessary.

I will mention that Typst fully embeds a font subset into the PDF document, unlike some other tools. So PDF viewer will never substitute the embedded fonts. This is such a big plus for portability and ability to print anything through any OS (without text issues).

2 Likes