add tag
I am considering using Typst to write preparation material for Linguistics Olympiads. Like many others I used to rely on LaTeX but it was a huge pain and I want to give new technology a try. Anyone who prepared for LOs in their student days knows that our PDFs contain a variety of scripts. In some cases one font is not enough, especially if there is one or more non-Latin script in the problem set.

While I know that it is possible to switch between fonts mid-document with ```#set text(font: "xxx")```, having to do that every time in a multilingual document where different scripts appear all the time is very tedious. I am curious whether there is a way to assign a font to a specific language, entire Unicode blocks or a predefined array of Unicode characters as opposed to the entire document?
Top Answer
Anonymous 12761
I am not sure I fully understood your requirements, but I would use functions for that. In particular, changing the font depending on unicode characters wouldn't work for east-asian languages, since the same codepoint can be rendered differently depending on the language.

#let lang_gr(body) = {
  set text(lang: "gr", font: "Noto Serif", fallback: false)

#let lang_jp(body) = {
  set text(lang: "jp", font: "Noto Sans CJK JP", fallback: false)

#let lang_zh(body) = {
  set text(lang: "zh", font: "Noto Sans CJK TC", fallback: false)

Default language




Notice how #lang_jp[話]≠#lang_zh[話]

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.