Skip to content

Add New Computer Modern font#247

Open
silas229 wants to merge 1 commit intofontist:v5from
silas229:v4
Open

Add New Computer Modern font#247
silas229 wants to merge 1 commit intofontist:v5from
silas229:v4

Conversation

@silas229
Copy link
Copy Markdown

@silas229 silas229 commented Mar 25, 2026

This PR adds support for installing New Computer Modern via Fontist.

New Computer Modern is one of the core fonts used by Typst. It is widely used throughout the official documentation and examples, making it a de facto standard font for many scientific Typst projects1.

At the same time, the GitHub Action typst-community/setup-typst explicitly documents Fontist as the recommended way to install fonts in CI environments2. However, New Computer Modern is currently not available through Fontist.

Adding New Computer Modern to Fontist closes this gap and provides a smoother experience for users who:

  • rely on Typst’s default or commonly used fonts, and
  • want reproducible builds in CI (e.g. via typst-community/setup-typst + Fontist).

Benefits

  • Aligns Fontist with Typst’s default font ecosystem
  • Simplifies CI setup for Typst projects
  • Reduces friction for new users following official documentation
  • Enables consistent rendering across environments

Footnotes

  1. https://typst.app/docs/guides/for-latex-users/#latex-look, https://typst.app/docs/reference/styling/, https://typst.app/docs/tutorial/formatting/

  2. https://github.com/typst-community/setup-typst#installing-fonts-with-fontist

@ronaldtse
Copy link
Copy Markdown
Contributor

Thank you @silas229 ! We'll merge this once it passes. Appreciate the contribution!

@silas229
Copy link
Copy Markdown
Author

silas229 commented Apr 1, 2026

I haven't been able to solve the problem from the test yet either (this pr was still marked as a draft😅)
https://github.com/fontist/formulas/actions/runs/23535680934/job/69520393853?pr=247

But surely you're more familiar with fontist and could maybe figure that out (before the mention in setup-typst, I had never even heard of it, let alone programmed in ruby)

@ronaldtse
Copy link
Copy Markdown
Contributor

The reason for the failure is this:

$ bundle exec fontist create-formula https://download.gnu.org.ua/release/newcm/newcm-7.1.1.txz
Downloading: 100% (22/22 MiB), 2.72 MiB/s, done.
[Fontist::Errors::FontNotFoundError] No fonts found in archive. Only files with these extensions are processed: ttf, otf, ttc, otc, woff, woff2, dfont

I think we are failing to unarchive the "txz" file which seems to be an "xz" that contains a "tar". It might be the case that in Excavate/Omnizip we are not using magic bytes to detect "xz" files?

@HassanAkbar can you please help here? Thanks.

@HassanAkbar
Copy link
Copy Markdown
Member

@ronaldtse Looking into it, will keep you posted.

@HassanAkbar
Copy link
Copy Markdown
Member

@ronaldtse The .txz extension was not supported by excavate. I've added support for .txz in omnizip/excavate#45. There is .tgz and .7z missing as well. I'll create an issue for it and add them too.

@ronaldtse
Copy link
Copy Markdown
Contributor

@HassanAkbar it seems that we still have a failure on Ubuntu:

(macOS and Windows both passed, but it seems that neither platform actually installs the font?)

Installing from formula "new_computer_modern".
Downloading from https://download.gnu.org.ua/release/newcm/newcm-7.1.1.txz

Downloading: 100% (22/22 MiB), 5.99 MiB/s, done.
Fonts not found in formula #<Fontist::Formula:0x00007fbf33b13ad8>
test/test_formulas.rb:123:in `print_errors': There are errors occured. (RuntimeError)
	from test/test_formulas.rb:28:in `call'
	from test/test_formulas.rb:127:in `<main>'
new_computer_modern, Formula 'new_computer_modern' not found locally nor available in the Fontist formula repository.
Perhaps it is available at the latest Fontist formula repository.
You can update the formula repository using the command `fontist update` and try again.
Error: Process completed with exit code 1.

@silas229
Copy link
Copy Markdown
Author

It's possible that some of the information in the file is incorrect. I'm not very familiar with this font stuff myself and created the file to the best of my knowledge.

@ronaldtse
Copy link
Copy Markdown
Contributor

@silas229 the problem is actually on our side, we'll handle it. Thanks!

@HassanAkbar
Copy link
Copy Markdown
Member

@ronaldtse it looks like the generated formula in this PR may have the wrong font path: newcm-7.1.1/otf/NewCM08-Regular.otf. When I generated it fresh with Fontist, it used NewCM08-Regular.otf, and installing from that formula seemed to work.

Could we regenerate this formula with Fontist?

@ronaldtse
Copy link
Copy Markdown
Contributor

@HassanAkbar yes, please do so. We need to change the target base branch to "v5" as well.

@ronaldtse ronaldtse marked this pull request as ready for review April 16, 2026 02:09
@ronaldtse ronaldtse changed the base branch from v4 to v5 April 16, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants