0

I would like for my TextView to have fontFamily set to sans-serif-thin whenever this font family is available on the device and use sans-serif-light if Roboto Thin is missing.

Is there a way how to programmatically find out whether a device supports a particular font family?

Is it safe to use values in resource directory for this king of behaviour?

<string name="main_font_family">sans-serif</string> <!-- values folder -->
<string name="main_font_family">sans-serif-light</string> <!-- values-v14 folder -->
<string name="main_font_family">sans-serif-thin</string> <!-- values-v16 folder -->

Is Roboto Thin guaranteed to be on all Jelly Bean devices?

EDIT: I can of course download required Roboto fonts from android site and use it on all OS version but it significantly increase the overall size of the APK, right?

Ondřej Z
  • 5,094
  • 3
  • 24
  • 30
  • Why don't you just use the suggestion here and import this into your project: http://stackoverflow.com/questions/13539688/how-to-use-roboto-font-in-android-project – g00dy Aug 14 '13 at 12:17
  • http://developer.android.com/design/style/typography.html. yes. check the docs – Raghunandan Aug 14 '13 at 12:18
  • I would like to keep the size of the APK file as small as possible. (But it is possible that at the end a I will attach required *.ttf files manually) – Ondřej Z Aug 14 '13 at 12:24

2 Answers2

1

Is Roboto Thin guaranteed to be on all Jelly Bean devices?

Yes, Roboto should be available on every device that runs API 16 (Android 4.1) and above.

Ahmad
  • 69,608
  • 17
  • 111
  • 137
  • This is incorrect. Roboto Regular, Light and Condensed are available from 4.1, Roboto Thin is available from 4.2 and Roboto Medium is available from 5.0 – LukaCiko Apr 03 '15 at 14:11
1

depends on device to be honest (Kindle Fire list of fonts http://wiki.mobileread.com/wiki/List_of_fonts_included_with_each_device#KindleFire).

Vanilla devices should have it. You can however use that font as a custom. Here is link from Android website http://developer.android.com/downloads/design/Roboto_Hinted_20120823.zip

robotoaster
  • 3,082
  • 1
  • 24
  • 23