I would like to use the "book" weight of this version of the font New Computer Modern (https://ctan.org/pkg/newcomputermodern?lang=en) to get a slightly "blacker" type with Typst.
In LaTeX (using xelatex), it can be loaded via \usepackage[default]{fontsetup}
. For Typst, I downloaded and installed the .otf files on MacOS using homebrew. However, only the "08" (point?) version of the font works; the "10" (point) one does not: warning: unknown font family: newcomputermodern10
Apparently, New Computer Modern 08 comes without a boldface so some of my formatting is lost:
#set text(font: "New Computer Modern 08")
= Heading
The heading should be *bold*.
Any way to make this work? I can't see why one should work while the other does not judging by the Font Book entries:
Typst provides the New Computer Modern 10 (Regular, Bold, and Italic) with its binary in the name of New Computer Modern
. Thus, before installing font-new-computer-modern
, you can get these variants:
> typst fonts --variants | rg Computer -A 10
New Computer Modern
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Italic, Weight: 400, Stretch: FontStretch(1000)
- Style: Italic, Weight: 700, Stretch: FontStretch(1000)
New Computer Modern Math
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Normal, Weight: 450, Stretch: FontStretch(1000)
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
...
After installing font-new-computer-modern
, more variants will be shown:
> brew install font-new-computer-modern
...
> typst fonts --variants | rg Computer -A 10
New Computer Modern
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
- Style: Italic, Weight: 400, Stretch: FontStretch(1000)
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Italic, Weight: 450, Stretch: FontStretch(1000)
- Style: Normal, Weight: 450, Stretch: FontStretch(1000)
- Style: Italic, Weight: 700, Stretch: FontStretch(1000)
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
- Style: Normal, Weight: 700, Stretch: FontStretch(1000)
- Style: Italic, Weight: 400, Stretch: FontStretch(1000)
- Style: Italic, Weight: 700, Stretch: FontStretch(1000)
New Computer Modern 08
- Style: Normal, Weight: 450, Stretch: FontStretch(1000)
- Style: Italic, Weight: 400, Stretch: FontStretch(1000)
- Style: Normal, Weight: 400, Stretch: FontStretch(1000)
- Style: Italic, Weight: 450, Stretch: FontStretch(1000)
...
Notice that the normal style font has three weights: 400, 450, and 700. The font book also shows there are three font files:
$HOME/Library/Fonts/NewCM10-Bold.otf
$HOME/Library/Fonts/NewCM10-Book.otf
$HOME/Library/Fonts/NewCM10-Regular.otf
I assume the new 450 weight variant is the book weight variant, and here is a simple example:
#set page(margin: 1em)
#let test_text = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
#text(font: "New Computer Modern", weight: 400)[#test_text]
#text(font: "New Computer Modern", weight: 450)[#test_text]
#text(font: "New Computer Modern", weight: 700)[#test_text]
#text(font: "New Computer Modern", weight: "regular")[#test_text]
#text(font: "New Computer Modern", weight: "medium")[#test_text]
#text(font: "New Computer Modern", weight: "bold")[#test_text]
Notice:
Book
has a weight of 450.weight: "medium"
sets the weight to 500, and I think typst uses the nearest weight and gets the 450.I hope this solves your problem.