-
Notifications
You must be signed in to change notification settings - Fork 341
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
base: main
Are you sure you want to change the base?
Conversation
this is complete except for choice of fonts for purposes of testing, this commit uses Roboto as the sans-serif font in order to implement this feature we need to ship a variable-width sans-serif font because Typst does not
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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
@@ -593,6 +593,10 @@ local function quote(s) | |||
return '"' .. s .. '"' | |||
end | |||
|
|||
local function dequote(s) | |||
return s:gsub('^["\']', ''):gsub('["\']$', '') | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is safe here, but it's always terrifying to consider the full implications of quoting, escaping, etc. There's no chance that fonts can have ,
in their titles, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this is also about L662 below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:shudder:
The spec does not seem to ban commas in font family names. In practice this seems to be something that happens in PostScript because of weights and styles of a family, but CSS handles this differently (and better).
i can't figure out a way to automate this test but we should have it for visual testing
Fixes #11683
This is complete except for choice of fonts.
For demo purposes, this PR uses Roboto as the sans-serif font. (No endorsement implied.)
In order to implement generic font families we need to ship a variable-width
sans-serif
font because Typst does not.These are called "generic font families" when they are part of the CSS spec, and are called "font stacks" when they come from a third party. This PR only implements the four major generic font families
sans-serif
serif
math
monospace
and aliases
ui-sans-serif
/system-ui
,ui-serif
,ui-monospace
, but other generic font families and font stack names could be added to the input data.