typst-community / setup-typst

📑 Install Typst for use in GitHub Actions

Home Page:https://github.com/marketplace/actions/setup-typst

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you add the option to install the font on github?

qujihan opened this issue · comments

This is a good suggestion, as this feature is useful and it's a fact that there are users who have installed fonts on the Runner specifically for Typst. I think it's possible to support a new parameter indicating the fonts to be installed, which can be either a string or a list, with the default being an empty string indicating that no fonts will be installed.

I've had a look under the font topic on GitHub: for code, it might be good to support Fira Code; for CJK, I'm going to support Source Han Sans, Source Han Serif and LXGW WenKai 霞鹜文楷.

For English and English-like, I'm not sure there's a need to support more fonts; for other languages such as Arabic, I have found Roboto and Noto, maybe I will search for more later on Google Fonts.

I'm a little unclear as to what "option to install the font on github" means but I assume it means "install additional fonts to the github actions runner so i can use them with typst"? If so, then this would be a great thing to split into its own GitHub Action called something like "setup-fonts" or "install-google-fonts" or "fetch-adobe-fonts" or something. 🤷‍♀️ just an idea.

@qujihan you may be interested in using https://github.com/tecc/fontpm to install Google Fonts in the github actions runner like this:

- uses: typst-community/setup-typst@v3
- run: cargo install fontpm
- run: fontpm refresh
- run: fontpm install fira-mono
- run: typst fonts # should include "Fira Mono" now!
- run: typst compile uses-fira-mono.typ

There's also https://github.com/fontist/fontist Fontist which does a similar thing.

- uses: typst-community/setup-typst@v3
- uses: ruby/setup-ruby@v1
  with:
    ruby-version: ruby
- run: gem install fontist
- run: fontist update
- run: fontist install "Fira Mono"
- run: typst fonts --font-path ~/.fontist/fonts # should include "Fira Mono" now!
- run: typst compile uses-fira-mono.typ

Fontist also supports manifest files so you can use a package.json/Cargo.toml-like file to define what fonts you need! 😎 that's cool! https://www.fontist.org/docs/