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).
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.
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.
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:
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.
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?
I don’t completely understand the solution. I’m using a Mac and I want to use fonts that I purchased with Typst. How do I get Typst to recongnize fonts on my mac?
I’ll explain this from scratch. I’m on the same platform, and recently dealt with much of the same for some math fonts.
Assuming your purchased fonts gave you access to .otf or .ttf files, as that is Typst’s interface for using custom fonts (I don’t know if there are other methods), move your .otf files and .ttf files into your project directory, at which point, you should just be able to use the font name in the text functions. This will work on compilation.
If you are using VSCode or VSCodium, there is a caveat to this setup, as VSCode doesn’t necessarily read your project directories for fonts to read, which is what will result in the
“unknown font family”
error. To fix this, assuming you have the Tinymist extension for VSCode installed, check the settings.json file for VSCode and check for the lines:
"tinymist.fontPaths": [
"./", (Example)
],
If it isn’t there, you need to add it, and then you should be good.
I should add that except for not being able to use the font I want, the code is working very well, with a lot of help from forum members. The full code of the prject is:
#set page(
paper: "us-letter",
margin: 1in,
numbering: "-1-"
)
#set text(
font: "Equity A Regular",
size: 12pt,
)
#set align(center)
#show "In The": smallcaps
#show "United States District Court": smallcaps
#show "For the Eastern District of Virginia": smallcaps
In The\
United States District Court\
For the Eastern District of Virginia\
#show "Plaintiff": smallcaps
#show "Defendant": smallcaps
#let field(name) = grid(
columns: 1fr,
align: right,
v(2em),
//line(length: 100%),
smallcaps(name),
)
#grid(
columns: (1fr, 1fr),
inset: 1em,
align: center + horizon,
grid.cell(
stroke: (right: 1pt, bottom: 1pt)
)[
#field[Insert name of Plaintiff Here]
#field[Plaintiff,]
vs.
#field[insert name of Defendant here]
#field[Defendant.]
],
[
C A. No: CV-xxxxxx=xx
],
)
#set text(tracking: 1.5pt)
*COMPLAINT*\
#set text(tracking: 0pt)
#set par(
leading: 24pt,
)
#show "Introduction": smallcaps
*Introduction*\
#set enum(numbering: "1.", body-indent: 1em)
#set align(left);
#set par(
leading: 24pt,
)
+ This is test of numbering paragraphs of a complaint and of using single spacing for the text.
+ I need to type a longer line to see how it looks and whether it wraps; it does wrap. If you type enough.
+ This is test
Hmm, I’ve never worked with projects in OneDrive, so I’m not sure what’s going on there. I can offer a second approach.
Make a copy of your .otf/.ttf files and move them to the following directory:
/Users/username/Library/Fonts/
where username is whatever your username is on your Mac. After that, adjust the settings.json file to include the new path. You don’t even have to get rid of the previous line, just change it to:
If you prefer to use Finder to move files around your Mac, be aware the Library directory is hidden in normal mode. To show hidden directories, while in Finder, hit cmd+shift+., and you should then see a bunch of previously hidden stuff.
Hmm, okay, that is weird. The only other thing that’s different at this point is that you have your project in OneDrive while mine was on my local machine. You could try moving the project, but beyond that, I’m out of ideas.