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

Add font-family fallback and optimize font loading #36

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

runofthemillgeek
Copy link
Contributor

Optimized font loading by adding font-display: swap. Additionally, moved font-family values into CSS variables.

@tomfran
Copy link
Owner

tomfran commented Oct 29, 2024

Thank you for this, may I ask you how you selected the fonts in "font-body"? Also, would failing to load Literata fallback on the second, and so on?

Optimized font loading by adding `font-display: swap`. Additionally,
moved font-family values into CSS variables.
@runofthemillgeek
Copy link
Contributor Author

@tomfran ah, I made an error of using the font stack I was testing out on an example site instead of using something to fallback for Literata. Will update the PR.

Also, would failing to load Literata fallback on the second, and so on?

Yes, it will fallback to the first font available in the stack and based on the usage of font-display: swap, will keep it on that fallback font until the main font is loaded and ready to be swapped.

@runofthemillgeek runofthemillgeek force-pushed the fix/font-family-fallback branch from d65347e to ac1f38d Compare October 29, 2024 18:07
@@ -12,6 +12,9 @@
--header-menu-top-gap: 1rem;

/* Typography */
--font-body: 'Literata', Georgia, Cambria, 'Noto Serif', 'Droif Serif', ui-serif, serif;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tomfran this should be a more reasonable fallback.

Copy link
Owner

Choose a reason for hiding this comment

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

I'll have a look at soon as I have a laptop on my hands, thank you for changing it :)

@tomfran tomfran merged commit 1e5da71 into tomfran:main Oct 30, 2024
@tomfran
Copy link
Owner

tomfran commented Oct 30, 2024

I just realized that the menu was using monospace instead of Monaspace, I added a small font size to bring back some consistency in the size, as I saw my personal website changed quite a lot.

I liked better the old monospace font there, completely missed it was another font 😅

@runofthemillgeek
Copy link
Contributor Author

@tomfran ah, I thought that was a typo (pun intended). btw monospace renders differently across browsers and OS. Better to be specific even if you wanted a different monospace font for menu.

@runofthemillgeek runofthemillgeek deleted the fix/font-family-fallback branch October 30, 2024 19:22
@tomfran
Copy link
Owner

tomfran commented Oct 30, 2024

Yeah it's better to use Monaspace everywhere, at least this was the intention.

tomfran added a commit that referenced this pull request Oct 30, 2024
Add font-family fallback and optimize font loading
tomfran added a commit that referenced this pull request Oct 30, 2024
Add font-family fallback and optimize font loading
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.

2 participants