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 fallback family to the code sample #379

Merged
merged 1 commit into from Jan 11, 2022
Merged

Add fallback family to the code sample #379

merged 1 commit into from Jan 11, 2022

Conversation

pepelsbey
Copy link
Contributor

Otherwise the default Times New Roman serif font will be used before the Open Sans loads.

Generic fallback font family is considered as a good practice. It usually make font switch less obvious for users, so it’s good to have it in the code sample as a reminder.

@vercel
Copy link

vercel bot commented Oct 20, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/fontsource/fontsource/E7V8FiPU8Xk7sXi4YSpSFmww3G63
✅ Preview: https://fontsource-git-fork-pepelsbey-patch-1-fontsource.vercel.app

@vercel vercel bot temporarily deployed to Preview October 20, 2021 20:59 Inactive
@ayuhito
Copy link
Member

ayuhito commented Oct 21, 2021

Great idea. I think we can go one step further with this PR and implement it to font previews documentation too.

There is metadata per font preview that shows whether it is sans-serif, serif or monospace, so it'll be fairly easy to automatically show the correct one on the preview.

Would you be interested in giving that a go?

@pepelsbey
Copy link
Contributor Author

Yes, that makes sense. I'll look into that!

@pepelsbey
Copy link
Contributor Author

pepelsbey commented Oct 21, 2021

Well, the problem is the there are around 1345 fonts that needs to be specified as:

font-family: serif;
font-family: sans-serif;
font-family: monospace;
font-family: cursive;

Unfortunately it’s a manual and quite time-consuming process. It’s possible to gather such data from Google Fonts

But I’m not sure if I’m ready to automate it myself.

@ayuhito
Copy link
Member

ayuhito commented Oct 22, 2021

My bad, I feel I should add more documentation regarding the internal workings of the website when I get the chance. I've been besieged with so much work recently to keep track with this project though.

FontPreview.tsx is passed a metadata object in its parameters. This metadata looks like this. It's only a matter of reading metadata.category and change the documentation accordingly.

Note the categories Fontsource metadata give is the following:

  • sans-serif
  • serif
  • display (maps to cursive according to Google Fonts)
  • handwriting (maps to cursive)
  • monospace
  • other (should map to nothing)

You can go to the Fontsource font preview search and filter by those categories for reference.

@ayuhito
Copy link
Member

ayuhito commented Dec 7, 2021

@pepelsbey, just checking in if you're still interested in this PR or someone else should jump in to take care of it?

@pepelsbey
Copy link
Contributor Author

@DecliningLotus sorry, I’ll give a go on weekend and if nothing comes out of it, I’ll let you know.

@ayuhito
Copy link
Member

ayuhito commented Dec 9, 2021

No pressure at all! I was just checking in!

@ayuhito
Copy link
Member

ayuhito commented Jan 11, 2022

I'll merge this PR and post a new issue (#410) to see if anyone else is interested in undertaking this idea. Thank you for your initial contribution though!

@ayuhito ayuhito merged commit 92f64fc into fontsource:main Jan 11, 2022
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.

None yet

2 participants