A tool to compare how Typst documents would look using different fonts or font variants.

Overview

typst-font-compare

A tool to compare how Typst documents would look using different fonts or font variants.

Installation

cargo install --path .

Usage

Examples

The following command generates a file main.variants.pdf containing all the system fonts:

typst-font-compare main.typ

To additionally check all variants, meaning style, weight, and stretch:

typst-font-compare --variants main.typ

The variants file includes too many Noto fonts. Let's remove them.

typst-font-compare --exclude Noto main.typ

We only want to compare a certain few fonts.

typst-font-compare --include 'Roboto|Inter|Ubuntu' main.typ

Only compare fonts that support italics.

typst-font-compare --style italic main.typ

Command-line Arguments

A tool to compare how Typst documents would look using different fonts or font variants

Usage: typst-font-compare [OPTIONS] <INPUT>

Arguments:
  <INPUT>
          Path to the Typst input file

Options:
  -o, --output <OUTPUT>
          Path to the output PDF.
          
          For an `input.typ`, the output will be `input.variants.pdf`.

  -v, --variants
          Whether to try each variant (style, weight, stretch)

  -f, --fallback
          Whether to enable font fallback

  -i, --include <INCLUDE>
          Only include font families that match this regular expression.
          
          The exclude regex takes priority over this regex.

  -e, --exclude <EXCLUDE>
          Exclude font families that match this regular expression.
          
          Takes priority over the include regex.

      --style <STYLE>
          Which font styles to check
          
          [default: normal]
          [possible values: normal, italic, oblique]

      --weight <WEIGHT>
          Which font weights to check

      --stretch <STRETCH>
          Which font stretch values to check
          
          [possible values: ultra-condensed, extra-condensed, condensed, semi-condensed, normal, semi-expanded, expanded, extra-expanded, ultra-expanded]

      --root <DIR>
          Specify a different project root folder
          
          [env: TYPST_ROOT=]

      --font-path <DIR>
          Adds additional directories to search for fonts in
          
          [env: TYPST_FONT_PATHS=]

      --ppi <PPI>
          The resolution to render the embedded variant content to
          
          [default: 300]

  -h, --help
          Print help (see a summary with '-h')

Questions and Answers

The pages are much larger than necessary.

Prefix your document with the following snippet to make them be only as large as needed:

#set page(height: auto, margin: .5cm)

You can also use this one to automatically scale all dimensions, though it can sometimes produce subpar results:

#set page(width: auto, height: auto, margin: .5cm)

Why do certain fonts not appear?

This tool does not embed any fonts that might normally be embedded into Typst. You must either install them system-wide, or add a --font-path fonts-folder argument where fonts-folder contains the needed fonts.

The generated document looks weird in my PDF viewer.

Each page this tool generates can have a different height. Some PDF viewers don't handle this correctly. Try opening the file in Firefox instead.

I'm getting a file not found error when including a package.

This tool does not automatically download packages. Compile your document using typst compile first and then typst-font-compare should work correctly.

The program just crashes at some point.

Images are stored in memory, making it potentially very memory intensive. Thus, your OOM killer (out-of-memory killer) shuts it down. Try not generating each variant, excluding certain fonts, or decreasing the PPI.

Legal

This software is not affiliated with Typst, the brand.

You might also like...
An mdBook backend to output Typst markup, pdf, png, or svg

mdbook-typst mdbook-typst is a backend for mdBook. The backend converts the book to Typst markup and can output any format Typst can (currently pdf, p

LaTeX support for Typst, powered by Rust and WASM.
LaTeX support for Typst, powered by Rust and WASM.

MiTeX LaTeX support for Typst, powered by Rust and WASM. MiTeX processes LaTeX code into an abstract syntax tree (AST). Then it transforms the AST int

Toki pona word look-up in the CLI
Toki pona word look-up in the CLI

seme toki pona word look-up in the CLI note the UCSUR are just a square for me because my font doesn't support them, but if yours does you should see

LaTeX support for Typst, powered by Rust and WASM
LaTeX support for Typst, powered by Rust and WASM

MiTeX LaTeX support for Typst, powered by Rust and WASM. MiTeX processes LaTeX code into an abstract syntax tree (AST). Then it transforms the AST int

A Rust 🦀️ font loading, positioning and rendering toolkit

Toolkit used to load, match, measure and render texts. NOTE: This project is a work in progress. Text measuring and positioning is a complex topic. A

Figma Agent for Linux (a.k.a. Font Helper)

Figma Agent for Linux (a.k.a. Font Helper)

🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.
🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.

Marky Markdown Magician 🧙 Features Hot reload previewing 🔥 Conversion to HTML / PDF 🏭 Themes! ✨ Extensions - Math, diagrams, syntax-highlighting 🧩

🔣 nerdfix helps you to find/fix obsolete Nerd Font icons in your project.

🔣 nerdfix nerdfix helps you to find/fix obsolete Nerd Font icons in your project. 💭 Why Nerd Fonts is used in many projects for a beautiful UI. It p

Tooling and library for generation, validation and verification of supply chain metadata documents and frameworks

Spector Spector is both tooling and a library for the generation, validation and verification of supply chain metadata documents and frameworks. Many

Owner
null
Rust library for regular expressions using "fancy" features like look-around and backreferences

fancy-regex A Rust library for compiling and matching regular expressions. It uses a hybrid regex implementation designed to support a relatively rich

fancy-regex 302 Jan 3, 2023
Croc-look is a tool to make testing and debuging proc macros easier

croc-look croc-look is a tool to make testing and debuging proc macros easier by these two features Printing the implementation specific generated cod

weegee 7 Dec 2, 2022
A simple command line tool for creating font palettes for engines like libtcod

palscii A simple command line tool for creating font palettes for engines like libtcod. Usage This can also be viewed by running palscii --help. palsc

Steve Troetti 2 May 2, 2022
ufo2nft is a CLI Rust tool to automate creating on-chain SVG NFTs from UFO font sources

ufo2nft is a CLI Rust program created by Eli Heuer at the 2022 Seattle Solana Hacker House event. It uses Norad to create on-chain SVG images from UFO font sources, and prepares them for minting as Solana NFTs. For Ethereum NFTs the program can just export the SVGs and Ethereum NFTs can be built manually.

Eli Heuer 1 Feb 10, 2022
A tool to format codeblocks inside markdown and org documents.

cbfmt (codeblock format) A tool to format codeblocks inside markdown, org, and restructuredtext documents. It iterates over all codeblocks, and format

Lukas Reineke 126 May 26, 2023
Look Ma: My computer is talking!

chatgpt-at-home A simple text generator based on n-grams and Markov chains: $ cargo run --release > :train sources/shakespeare.txt > ACT IV ACT IV.

Patryk Wychowaniec 5 Mar 26, 2023
run Typst in JavaScriptWorld.

Typst.ts Typst.ts allows you to independently run the Typst compiler and exporter (renderer) in your browser. You can: locally run the compilation via

null 9 Apr 18, 2023
👀Little program I made in 🦀Rust that reminds me every 20 minutes to look away from my computer 🖥screen.

?? eye break Little program I made in ?? Rust that reminds me every 20 minutes to look away from my computer ?? screen. I stay way too long on the com

Goldy 3 Apr 9, 2023
Shell Escape for Typst typesetting system. Linux Only.

Shell Escape for Typst This is a simple shell escape for Typst. It allows you to run shell commands directly from Typst compiler. That said, it does n

Nikolay Stepanov 4 Jun 7, 2023
Packages for Typst.

Typst Packages An experimental package repository for Typst. A searchable list of all packages that were submitted here is available in the official d

Typst 91 Jul 4, 2023