googlefonts / googlefonts/roboto-flex
Can't use Roboto Flex as a downloadable font on Android
- Dominant language
- HTML
- Stars
- 525
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
Here's my code that works for other fonts available on Google Fonts if I change the name:
```java
FontRequest req=new FontRequest("com.google.android.gms.fonts", "com.google.android.gms", "name=Roboto Flex");
FontsContract.FontRequestCallback callback=new FontsContract.FontRequestCallback(){
@Override
public void onTypefaceRetrieved(Typeface typeface){
textView.setTypeface(typeface);
Log.e("111", "onTypefaceRetrieved() called with: typeface = ["+typeface+"]");
}
@Override
public void onTypefaceRequestFailed(int reason){
Log.e("111", "onTypefaceRequestFailed() called with: reason = ["+reason+"]");
}
};
FontsContract.requestFonts(getActivity(), req, new Handler(Looper.getMainLooper()), null, callback);
```
It does not work for Roboto Flex, however, failing with `FAIL_REASON_FONT_NOT_FOUND`. Here's the relevant logcat output:
```
2023-05-18 04:50:53.362 5151-5410 FontLog com.google.android.gms I Received query name=Roboto Flex, URI content://com.google.android.gms.fonts [CONTEXT service_id=132 ]
2023-05-18 04:50:53.363 5151-5410 FontLog com.google.android.gms I Query [name=Roboto Flex] resolved to {Roboto Flex, wdth 100.0, wght 400, ital 0.0, bestEffort false} [CONTEXT service_id=132 ]
2023-05-18 04:50:53.365 5151-5410 FontLog com.google.android.gms I Fetch {Roboto Flex, wdth 100.0, wght 400, ital 0.0, bestEffort false} end status Status{statusCode=Not found, resolution=null} [CONTEXT service_id=132 ]
2023-05-18 04:50:53.373 8500-8500 111 org.joinmastodon.android E onTypefaceRequestFailed() called with: reason = [1]
```
The device and system version don't seem to make a difference, I tested this on two devices and an emulator. The URL encoding isn't a culprit either, there doesn't need to be any as other fonts with spaces in their names also work fine.
Is there something I'm missing, or does this need to be fixed on Google's side?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.