Android O and AndroidX Library add support for Downloadable Fonts.
Google Fonts is shipping a Font Provider in Google Play Services. This means Google Fonts are available to native apps on Android devices!
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 provider supports Jelly Bean (API level 16) and up. This represents 95%+ of of Android devices in the wild (platform dashboard). It can be accessed using APIs in AndroidX Library (androidx.core) or Android O (API level 26).
How can I get started!
- Check out the demo app.
- Try it in Android Studio 3.0 (walkthrough with screenshots)
- Use Google Fonts declaratively or programmatically as shown in Downloadable Fonts.
Query Format
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 | |
width | No | > 0 | float | 100 |
weight | No | (0, 1000) exclusive | int | 400 |
italic | No | [0, 1] inclusive | float | 0 |
besteffort | No | true/false | boolean | true |
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.
Sample queries:
name=Lobster # Lobster, 400 weight
name=Lato&weight=100 # Lato, 100 weight
name=Open Sans&weight=800&italic=1 # Open Sans, 800 weight, italic
Security
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. See adding certificates.