-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Support mainfontfallback
values in Typst template
#11223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Why not instead make use of |
@jgm Thanks for your reminding. I have made one more commit to use the ---
title: Fonts fallback example
mainfont: "Times New Roman"
mainfontfallback:
- "Noto Serif CJK SC"
- "LXGW WenKai"
--- |
MANUAL.txt
Outdated
respectively. These are lists. For `lualatex`, the font name must be followed | ||
by a colon and optionally a set of options, for example: | ||
|
||
--- | ||
mainfontfallback: | ||
- "FreeSans:" | ||
- "NotoColorEmoji:mode=harf" | ||
... | ||
|
||
Font fallbacks currently only work with `lualatex`. | ||
Font fallbacks currently work with `lualatex` and Typst. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To increase interoperability, we could have the LaTeX writer add the colon automatically when it is not present. This can be a separate change from this PR, if you prefer, but I don't want to lose track of it.
data/templates/default.typst
Outdated
$elseif(mainfontfallback)$ | ||
font: ($for(mainfontfallback)$"$mainfontfallback$"$sep$, $endfor$), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to worry about a case where you have mainfontfallback but not mainfont -- the former only makes sense with the latter.
fonts to try if a glyph isn\(cqt found in \f[CR]mainfont\f[R], | ||
\f[CR]sansfont\f[R], or \f[CR]monofont\f[R] respectively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We regenerate man pages just once before release, so don't include this in the Pr.
I have reverted changes according to your suggestions. Please review them. You could make changes if necessary. Thanks for your work. |
mainfont
values in Typst templatemainfontfallback
values in Typst template
Add support for multiple
mainfont
values in the Typst template so Pandoc doesn't concatenate them into a single font name. With this change we emit a Typst tuple and Typst can fall back gracefully for multilingual text.Example:
The rendered Typst now contains font:
("Times New Roman", "Noto Serif CJK SC")
, so Latin characters use Times New Roman and missing Chinese characters fall back to Noto Serif CJK SC.