Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Roboto font for Android 4+?

Tags:

Do I need to use Roboto font and put it to asset folder if my app will support only Android 4+ devices?

I would greatly appreciate for your help. Alex. P.S. Sorry for my English:)

like image 417
AlexMomotov Avatar asked Oct 01 '13 10:10

AlexMomotov


People also ask

Is Roboto available on Android?

Roboto (/roʊˈbɒt. oʊ/) is a neo-grotesque sans-serif typeface family developed by Google as the system font for its mobile operating system Android, and released in 2011 for Android 4.0 "Ice Cream Sandwich". The entire font family has been licensed under the Apache license.

How do I get the Roboto font on my Samsung phone?

Tap 'Foundation' and select 'XDA 968 Fonts (by Winb33)' from the dropdown menu. Apply said overlay (press the FAB) Tada! You now have over 900 fonts including Roboto Light, Helvetica Neue, Segoe UI and many more.

Can I use Roboto font for free?

Roboto is available via an open source license. You're free to use it with your Adobe Fonts account just as you would any other font in the Adobe Fonts library.

How do I get Roboto font?

Go to the FontSquirrel Roboto font page, click “Webfont Kit,” then choose your preferred font formats, a subset (if any) and click “Download @Font-Face Kit.”


2 Answers

You can use Roboto natively from Android 4.1+ like this:

android:fontFamily="sans-serif"           // roboto regular
android:fontFamily="sans-serif-light"     // roboto light
android:fontFamily="sans-serif-condensed" // roboto condensed

For any version below that, you have to load the font yourself. Look at this answer I gave a while back for more information.

like image 127
Ahmad Avatar answered Oct 22 '22 02:10

Ahmad


Answer

Ok. I think, I got it.

Samsung phones are by far the most popular Android phones. Whilst it's true that all Samsung phones from 4.1 and up have Roboto, they also have something called Samsung Sans, and if your user has set it as their default font then the android:font-family (as @Ahmad says) requests all return Samsung Sans, not Roboto. If you have fixed tight layouts with no wriggle-room that can't stretch, Samsung Sans will break them. There's no easy way round this. If you absolutely have to have Roboto, you must package it as an asset and set it as the typeface explicitly.

Thx to @Ahmad as well as @Kenton Price's comment here: https://stackoverflow.com/a/14633032/2553905

like image 35
AlexMomotov Avatar answered Oct 22 '22 01:10

AlexMomotov