typst
typst copied to clipboard
Inconsistent font resolution: standalone vs fallback
Description
#let fa(c, font) = text(str.from-unicode(c), font: font)
#fa(0xf113, ("Libertinus Sans", "Font Awesome 6 Free"))
#fa(0xf113, ("Libertinus Sans", "Font Awesome 6 Brands"))
#fa(0xf113, "Font Awesome 6 Free")
I wouldn't say this is a bug because that glyph is indeed defined in Brands and not in Free, but it's strange that when using Free as the only font it's nevertheless found.
Reproduction URL
No response
Operating system
macOS
Typst version
- [X] I am using the latest version of Typst
This invokes last resort fallback, which tries to find a font that is as close as possible to the primary font.
In the first case, it tries to find a font as close as possible to Libertinus Sans which ends up with New CM math in the web app (crucially, it produces no tofu!). Not sure which font it picked for you. It kinda looks like a tofu, but that wouldn't make sense as then last resort fallback would not try to pick it. Would need the PDF to check.
In the second case, it tries to find a font as close as possible to Font Awesome 6 Free. This increases the priority of Font Awesome 6 Brands because their name has a long shared prefix (this is taken into account.)