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

Make it very easy to quickly set font-family #21

Open
gadenbuie opened this issue Sep 12, 2024 · 4 comments
Open

Make it very easy to quickly set font-family #21

gadenbuie opened this issue Sep 12, 2024 · 4 comments

Comments

@gadenbuie
Copy link
Collaborator

As proposed by @cpsievert, we could make it very easy to set font families by letting typography.{base,headings,monospace} take a string that we'd map to the family property.

typography:
  fonts:
    - family: Open Sans
      source: google
    - family: Roboto Slab
      source: google
    - family: Fira Code
      source: google
  base: Open Sans
  headings: Roboto Slab
  monospace: Fira Code

For someone who just wants to pick fonts quickly even this is still a bit of boilerplate. In pkgdown and rmarkdown, we've used a syntax like this to declare in-place Google fonts:

typography:
  base: { google: Open Sans }
  headings: { google: Roboto Slab }
  monospace: { google: Fira Code }

Instead of this, I wonder, if we're comfortable making Google Fonts the default, we could automatically add Google Font declarations for font families that don't have a counterpart in typography.fonts and are a single font family name.

With this approach, in the following example we'd use Roboto Slab and Fira Code from Google Fonts but rely on locally-installed Open Sans (i.e. opting out of Google Fonts).

typography:
  fonts:
    - family: Open Sans
      source: file
  base: Open Sans
  headings: Roboto Slab
  monospace: Fira Code
@gadenbuie gadenbuie changed the title Make it very easy to quickly setting font-family Make it very easy to quickly set font-family Sep 12, 2024
gadenbuie added a commit that referenced this issue Sep 20, 2024
Treats `base: Open Sans` and
`base.family: Open Sans` as "get from Google Fonts"

For #21
@gadenbuie
Copy link
Collaborator Author

gadenbuie commented Oct 9, 2024

typography:
  fonts:
    - family: Open Sans
      source: system
  base: Open Sans
  headings: Roboto Slab
  monospace: Fira Code
  1. headings: Roboto Slab as a shortcut for headings: {family: "Roboto Slab"}
  2. Undeclared fonts come from some default location. brand_yaml (Shiny) will use Google Fonts by default, Quarto will use system.
  3. A font with source: system says "don't do anything to resolve this font".

cscheid added a commit to quarto-dev/quarto-cli that referenced this issue Oct 10, 2024
@cscheid
Copy link
Collaborator

cscheid commented Oct 10, 2024

Quarto now uses the following schemas:

https://github.com/quarto-dev/quarto-cli/blob/c0c320d9433dc6b0065e88186d0f2f9f1e5afa07/src/resources/schema/definitions.yml#L2763-L2777

(other related schemas were similarly changed.)

@gadenbuie
Copy link
Collaborator Author

brand_yaml added BrandTypographyFontSystem in f934ef9

@gadenbuie
Copy link
Collaborator Author

And the default font source is now configurable via the BRAND_YAML_DEFAULT_FONT_SOURCE envvar in 57fb01d and "system" is the new default after #28.

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

No branches or pull requests

2 participants