How to reference custom fonts

Could someone walk me through how to reference a custom font? Using small words, maybe pictures?

I’ve read the documentation, and it mostly seems to be oriented to using Typst from the command line. However, I use TinyMist in VS Code.

It’s not an installation problem, as the same font works fine with LibreOffice and with LaTeX. I’ve tried putting the .otf in the project file. I tried it in a couple different documents to see if something else I was doing might be interfering. Nothing works. I keep getting the “unknown font family” error (and then it defaults to Libertinus Serif).

BTW, if I enter “Typst fonts” in the terminal it’s listed.

OK, I worked out the original problem by following instructions here fonts in all environment · typst/typst · Discussion #5013 · GitHub.

New problem #1: Not all of my fonts in the referenced folders are recognized, just an apparently random assortment of them.

New problem #2: At least one font that is recognized, and works normally in other apps, has a problem where the roman, bold, and bold italic are all correct, but italic comes out bold italic, too.

Code:
Screenshot From 2025-02-05 18-04-52

Output: image

Sorry, I meant that the roman and bold italic come out normally, but the bold becomes roman and the italic becomes bold italic.

Again, the font works fine in other apps, and a few other fonts I randomly sampled in Typst still work normally.

Is there something different about the way Typst recognizes members of a font family?

I don’t have an aswer to your issue. But is the font available freely somewhere so that others could test with it? I wonder if there is an issue in the font itself.

Lemme try that again: OpenType Fonts

I’m on macOS and I tried to use the font by installing it just like you install all fonts (open the font file and select the “Install” option). It worked just fine:

All styles seem to be rendered correctly so I guess the fonts themselves are ok. What system you are on and how did you install the font files?

I’m on Ubuntu 24.10. I just tried the same thing on my wife’s laptop with the same OS and it worked fine.
Rats. I see an OS reinstallation in my future.

1 Like

You could try to uninstall and reinstall the fonts again before touching your OS installation.

1 Like

Fonts have “name tables” inside that define how the italic and bold and bold italic relate to the roman. The values in the name tables are basically covering all the legacy differences between platform and old operating systems. It’s difficult matter, that is not solved well in many fonts. Therefor it may work well on one OS or app and not on another. If could help to test with other fonts (TTF or OTF) so see if they behave in the same way.

I think I have a similar, related issue regarding this. Right now I am trying to set up a template for a report with this specific font: LG Smart

It includes 6 TTF files, if I only install “Regular”, there is no issue. Since I need “Bold” and “Italic” for emphasizes, I have installed all of them.

Unfortunately as soon as “LG Smart Regular Italic.ttf” is installed, everything is displayed in italic. Could it be a mix-up with the font name (“LG Smart”) and the different variiations?

Font Files:

  • LG Smart SemiBold.ttf
  • LG Smart Regular Italic.ttf
  • LG Smart Regular.ttf
  • LG Smart Light.ttf
  • LG Smart Bold Italic.ttf
  • LG Smart Bold.ttf