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 fonts for new builtin Shiny theme preset #638

Merged
merged 6 commits into from
Jun 20, 2023

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Jun 16, 2023

Closes #630 and adds the desired font stack for the new Shiny theme, namely Open Sans and Source Code Pro.

This PR updates the tools/download_bootswatch_fonts.R script to also download fonts for builtin presets. This necessitated a few changes:

  1. tools/download_bootswatch_fonts.R is now tools/download_preset_fonts.R
  2. The download fonts script now looks for _bootswatch.scss or _rules.scss files (in that order)
  3. Builtin presets now must follow this convention:
    • Preset files are stored in inst/bs{version}/{name}/
    • Preset scss files should be named according to their layer, e.g. _variables.scss and _rules.scss.

From what I can tell, these new fonts add ~600KB to the package bundle. We may want to cut back on font weights or figure out how to reduce the package bundle size, but I'm also okay waiting for on that for another PR.

@@ -0,0 +1,31 @@
/*-- scss:rules --*/
$web-font-path: "https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&family=Source+Code+Pro:ital,wght@0,400;0,600;1,400;1,600&display=swap" !default;
Copy link
Member Author

Choose a reason for hiding this comment

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

@gregswinehart Do you think we could cut back these font weights a little bit?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose we could if it's a thing. That said, I would probably only lose the 800 weight? I like to celebrate the whole catalog....

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Greg. I'm going to leave this as is for now and will review again with Carson this week.

@gadenbuie gadenbuie requested a review from schloerke June 16, 2023 18:43
@gadenbuie gadenbuie merged commit 70e602b into main Jun 20, 2023
11 of 12 checks passed
@gadenbuie gadenbuie deleted the refresh/shiny-theme-font branch June 20, 2023 13:05
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.

Custom font settings for shiny theme
3 participants