Android O and Android Support Library 26 add support for Downloadable Fonts.
Google Fonts is shipping a beta build of our Font Provider in Google Play Services. For early access you will need to enroll in the Google Play Services public beta.
Which fonts can I use?
The entire Google Fonts Open Source collection. Visit https://fonts.google.com to browse.
What versions of Android are supported?
Our beta provider supports Android N (API level 24) and up. It can be used with Android Support Library 26 beta or with early builds of Android O. Enroll in the Google Play Services beta program for early access.
This summer, alongside Android Support Library 26 and Android O, we will exit beta and extend support to Android Jelly Bean (API level 16) and up. That covers 95%+ of Android devices in the wild (platform dashboard)
How can I get started!
- Check out the demo app.
- Try it in Android Studio 3.0 Canary 1:
- Create an app targeting Android O or using supportlib 26 beta
- Select a text view
- In Properties find
- Browse the entire Google Fonts collection
- Android Studio will wire everything together!
- Use Google Fonts declaratively or programmatically as shown in Downloadable Fonts.
To request a font from the Google Fonts provider use the following query format:
|Parameter||Required?||Range||Data Type||Default value|
|name||Yes||Any family from fonts.google.com||string|
|weight||No||(0, 1000) exclusive||int||400|
|italic||No||[0, 1] inclusive||float||0|
If besteffort is true and your query specifies a valid family name but the requested width/weight/italic value is not supported we will return the best match we can find within the family. For example, a request for Oswald at weight 900 would return Oswald at weight 700.
name=Lobster # Lobster, 400 weight name=Lato&weight=100 # Lato, 100 weight name=Open Sans&weight=800&italic=1 # Open Sans, 800 weight, italic
For security you must specify the signature of the application exposing the provider you want to request fonts from. Android Studio will add the correct signature for you.