-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Difficulty customising the font stack cleanly #472
Comments
The theme CSS prioritises font-families that are defined in @font-face at-rules. These rules prioritise local fonts then fall back to downloading fonts bundled with the theme. Move the prioritisation of local fonts from @font-face to the main CSS font-family declarations and use custom font-family names in the @font-face at-rules. This allows use of italic fonts found locally and facilitates user-override of fonts. Fixes welpo#472 Signed-off-by: Stephen Kershaw <[email protected]>
The theme CSS prioritises font-families that are defined in @font-face at-rules. These rules prioritise local fonts then fall back to downloading fonts bundled with the theme. Move the prioritisation of local fonts from @font-face to the main CSS font-family declarations and use custom font-family names in the @font-face at-rules. This allows use of italic fonts found locally and facilitates user-override of fonts. Fixes welpo#472 Signed-off-by: Stephen Kershaw <[email protected]>
Thanks for reporting this! As far as I understand, the problem with using
I'm not sure I understand the issue: if you want to prioritise Menlo, why not place it earlier, as you mention? Do I understand your goal correctly?: "have a set of fonts that might be available locally and never load remote fonts" |
System information
Zola version: 0.19.2
Tabi: main branch (e519864)
Expected behaviour
I was trying to add a stylesheet to use this system font stack (using only system-local fonts) for rendering code blocks:
On my MacBook using Chrome I expected this to render code blocks using
Menlo
as that is the first font family installed locally on my Mac.Actual behaviour
Code blocks used the subset of
Cascadia Code
that ships with tabi (#174).This was then hard to prevent (or had undesirable features):
Menlo
as expected, but there is then a 404 trying to download the font.@font-face
rule can help the desired font being used but can still lead to the font being downloaded (or a 404 if deleted), because it seems the@font-face
at-rules are not evaluated like the usual CSS cascade for normal rules and the order/speed of stylesheet download can affect which sources are checked.It could be made to work as expected on a Mac by reordering the font stack so that
Cascadia Code
comes later, which works for me but there is a chance that others may hit this issue or similar. There a a couple of other options too, but they have peculiarities too.Also, on Windows with the font family present locally the italic font is never used, rather the italics are faked with the usual slanting of the regular font. This could be addressed in a couple of ways.
Steps to reproduce
config.toml
:sass/skins/custom.scss
including:Cascadia Code
installed locally (e.g Win11): system-local Cascadia Code is usedMenlo
in Chrome - this is what happens if not using tabiAdditional context
I'll raise a PR with a suggested fix. If tabi used a font family name like
Cascadia Code subset
then that leavesCascadia Code
to work as expected.Final checklist
The text was updated successfully, but these errors were encountered: