Vukašin Manojlović
Vukašin Manojlović

Reputation: 3857

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?

Upvotes: 1

Views: 393

Answers (2)

Vukašin Manojlović
Vukašin Manojlović

Reputation: 3857

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.

Upvotes: 0

kovac777
kovac777

Reputation: 730

It's not supported yet. You must use custom fonts that support cyrillic symbols for apply cyrillic. Put their it 'font' folder and get with ResourcesCompat.getFont(context, R.font.myfont) .

Upvotes: 0

Related Questions