Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
qujihan opened this issue Jan 10, 2024 · 3 comments · Fixed by #20
Closed

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

qujihan opened this issue Jan 10, 2024 · 3 comments · Fixed by #20

Comments

@qujihan
Copy link

qujihan commented Jan 10, 2024

No description provided.

@yusancky
Copy link
Member

yusancky commented Jan 11, 2024

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.

@jcbhmr
Copy link
Member

jcbhmr commented Jan 24, 2024

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.

@jcbhmr
Copy link
Member

jcbhmr commented Jan 24, 2024

@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/

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 a pull request may close this issue.

3 participants