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

typst: generic font families / font stack names #11918

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gordonwoodhull
Copy link
Contributor

@gordonwoodhull gordonwoodhull commented Jan 21, 2025

This is a minimal implementation of generic font families for Typst, using Noto Sans as the sans-serif font and the built-in Typst fonts for serif, math, monospace.

Each has a synonym, e.g. ui-sans-serif

Other generic font families (or font stack names) could be added in the future, and we could ship fonts to replace the built-in Typst fonts.

Fixes #11683 "big numbers" in gt. I can't figure out a way to automate this test but at least we have a visual test.

@gordonwoodhull gordonwoodhull changed the title typst: generic font families / font stack aliases typst: generic font families / font stack names Jan 21, 2025
Copy link
Collaborator

@cscheid cscheid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some minor comments, but LGTM.

@@ -1513,6 +1514,9 @@ async function resolveExtras(
}
fontdirs.add(font_cache);
}
const srcDir = Deno.env.get("QUARTO_SRC_PATH") ||
join(quartoConfig.sharePath(), "../../src");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use Deno.env.get("QUARTO_SRC_PATH") || join(quartoConfig.sharePath(), "../../src") in a few different places in our codebase. I wonder if we should be adding a srcPath() to quartoConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've implemented quartoConfig.srcPath() in a separate commit on this PR. (I only found one other use?)

@gordonwoodhull gordonwoodhull force-pushed the feature/typst-generic-font-families branch 2 times, most recently from 1d7b76a to f9f0bea Compare March 28, 2025 16:14
@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Mar 28, 2025

@cscheid, my only remaining reservation about this PR is that Noto Sans takes up 44MB of disk space.

This is because it's is a non-variable font, which is what we currently need for Typst, and it has almost 80 variants (and lots of glyphs, being international).

What do you think?

@gordonwoodhull gordonwoodhull marked this pull request as ready for review March 28, 2025 16:19
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-generic-font-families branch 2 times, most recently from 9bcb6df to 778cd2d Compare March 28, 2025 16:25
this is a minimal implementation using Noto Sans as the sans-serif font
and the built-in Typst fonts for serif, math, monospace

each has a synonym, e.g. ui-sans-serif

other generic font families could be added
and we could ship fonts to replace the built-in Typst fonts

fixes #11683 "big numbers"

i can't figure out a way to automate this test
but we should have it for visual testing
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-generic-font-families branch from 778cd2d to 0140417 Compare March 28, 2025 19:40
@cscheid
Copy link
Collaborator

cscheid commented Mar 31, 2025

Yikes. Thanks for catching that, and I agree it's bad. I don't think a 33% installation size increase is worth it, unless every other alternative is similarly large.

Could you get an estimate of those sizes?

@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Mar 31, 2025

We need to use the static version of a font because of typst/typst#185 not supporting variable fonts. Each font has 54-72 variants.

Noto Sans is 44MB
Inter is 18MB
Roboto is 8MB

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.

font issue in typst tables with gt with strings containing numbers and letters
2 participants