Skip to content

Instantly share code, notes, and snippets.

@GirlBossRush
Created May 13, 2016 00:09
Show Gist options
  • Select an option

  • Save GirlBossRush/8526052aa86a3c7ca177b9bf614281d4 to your computer and use it in GitHub Desktop.

Select an option

Save GirlBossRush/8526052aa86a3c7ca177b9bf614281d4 to your computer and use it in GitHub Desktop.

Google Fonts Requirements

  • Allow the user to add an array of fonts to their site. Limit this to three entries (check the docs for how to do this).
  • The previewer font array object should have a selection box for the categories "Serif", "Sans Serif", "Display", "Handwriting", "Monospace".
  • The previewer font array object should have a radio button group for font CSS target, "Headers", "Body", "custom". Custom reveals a selector type field, {"format": "selector"...}
  • Add two default entries to the font array. The first targeting headers with a serif font, the second targeting the body text with a sans serif font.
  • The user's category selection will change the second selection box, the choice of font. Use the top 2 fonts listed for each category by popularity.
  • Each web font has a normal weight and often an italic and bold weight, each is unique. Find the value the web font API is anticipating and use it for install.json, "Roboto Slab": "Roboto+Slab:400,700:latin"
  • Observe the web font API listed in the instructions shown after choosing a font. Their script appending approach is a bit overkill, do it like we've done in PayPal.
  • Create a stylesheet that applies the user's choice of fonts and selectors. Here's an example of a javascript created stylesheet.
  • On completion, use the top 10 fonts listed for each category by popularity instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment