#Multiple fonts, each for a script with OTF features appled
22 messages · Page 1 of 1 (latest)
Add a features: argument to set text() ( https://typst.app/docs/reference/text/text/#parameters-features ).
?r ```
#let fonts = (
en: "Computer Modern",
de: "Comic Neue",
zh: "Noto Sans CJK SC",
)
#let colors = (
en: blue,
de: red,
zh: yellow,
)
#show text: it=> text(
font: fonts.at(default: fonts.en, text.lang),
colors.at(default: colors.en, text.lang),
it,
)
Hello, old bean!
#text(lang: "de", region: "at")[Seă's, Åidă!]
#text(lang: "zh", region: "tw")[你好,老人家!]
That way you could concisely associate the font & other features, but also lead that structured data from TOML, YAML …
I'd recommend you define functions for typesetting with each language instead
Text show rules just aren't robust enough to be used for this
Yeah there definitely should be an easier way of doing it
you cannot do this easily at this moment
typst lacks virtual font and unicode-range support. this is a tracking issue for this
for now you will have to define functions like #ar-text() #en-text(), set relevant properties, and call them whenever you need use them
FYI
mostly yes. but the ar-text, en-text approach doesnt use show rule and might be more maintainable
@strong fox please see also @open plover 's comments
i have trouble understanding what you are looking for in "it would be lovely to have..."
iiuc you can make several functions, to set correct styles and fonts. and you can compose them freely to achieve what you want
about document: it's another question. the page you posted is the reference(but not the guide)