Search code examples
androidgoogle-fontsandroid-downloadable-fonts

How to use non-Latin languages for Android downloadable fonts?


After reading the documentation for Google Fonts API for Android, I've successfully added different font weights beside regular and bold. But, the downloaded font isn't displaying for non-Latin characters. The difference can be seen between non-Latin letters (i.e. Cyrillic) and properly displayed Latin (like numbers and punctuation).

I even tried copying the web version of the API, something like this:

<?xml version="1.0" encoding="utf-8"?>
<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="name=Montserrat&amp;subset=cyrillic"
    app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>

but nothing happened, because subset is not a valid keyword.

Is there any way to specify which scripts should be included, like with the web version?


Solution

  • Now, Google Fonts API supports non-Latin characters for downloadable fonts by default. I have tested this on this sample project with the 29.0.0 build tools.