Skip to content

Conversation

@thisisdano
Copy link
Contributor

@thisisdano thisisdano commented Mar 12, 2021

This PR improves the logic we use to assign font stacks to type tokens. Now every font will get a stack, even if it has no defined stack.

  1. First we look for a custom stack and use it if it exists.
  2. Then we look to see if the font has an existing stack defined in its metadata, and use that if it exists.
  3. If neither of those exist, we use a predefined default stack for that font type.

I created a new map to hold our new default stacks, using the system stack as our sans default, the Georgia stack as our serif default, and the Bitstream Vera Sans Mono stack as our mono default.

Before:

font-family:Foo Sans,;

After:

font-family:Foo Sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
  Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
  "Segoe UI Symbol";

Fixes #4048

1. Look for a custom stack
2. Look for an existing stack in the font's metadata
3. Choose a default stack based on the font type
@thisisdano thisisdano requested a review from mejiaj March 12, 2021 18:56
@mejiaj mejiaj merged commit a5c9e05 into uswds-2.11.0 Mar 12, 2021
@mejiaj mejiaj deleted the dw-font-stack branch March 12, 2021 20:23
This was referenced Mar 17, 2021
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.

Using a custom font disables default font stack and breaks font display

3 participants