'Expected EOQ but found &' when setting custom font weight

87 Views Asked by At

I'm trying to use a downloadable font Montserrat with custom weight. This is a Google font and is available via Google Play Services.

In some tutorials I found they set custom weight by adding &weight=900 to the query, in my case resulting in

<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
    app:fontProviderAuthority="com.google.android.gms.fonts"
    app:fontProviderPackage="com.google.android.gms"
    app:fontProviderQuery="Montserrat&amp;weight=900"
    app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>

My Android Studio 3.0.1 complains that

Expected EOQ but found &

Any ideas why Android Studio doesn't let me set custom weight?

1

There are 1 best solutions below

0
Marcel Bro On BEST ANSWER

I was missing name= in front of the font name in the query.

Correct query with custom font weight looks like

app:fontProviderQuery="name=Montserrat&amp;weight=900"