Skip to content

About Android Fonts

Alberto Martínez edited this page Aug 20, 2018 · 1 revision

Android does not offer functions to enumerate the pre-installed fonts and the official names are aliased to real font names, so the information provided by the rnTextSize fontFamilyNames function is hardcoded and limited to a subset of fonts that you will (probably) find already installed.

For example, in devices with API 21 or above, the system fonts are:

Generic Name Font File (.ttf) Weight Italic
sans-serif-thin Roboto-Regular (aliased)
Roboto-ThinItalic
100 yes
sans-serif-light Roboto-Light
Roboto-LightItalic
300 yes
sans-serif Roboto-Regular
Roboto-RegularItalic
400 yes
  Roboto-Bold
Roboto-BoldItalic
700* yes
sans-serif-medium Roboto-Medium
Roboto-MediumItalic
500 yes
sans-serif-black Roboto-Black
Roboto-BlackItalic
900 yes
sans-serif-condensed-light RobotoCondensed-Light
RobotoCondensed-LightItalic
300 yes
sans-serif-condensed RobotoCondensed-Regular
RobotoCondensed-Italic
400 yes
  RobotoCondensed-Bold
RobotoCondensed-BoldItalic
700* yes
sans-serif-smallcaps CarroisGothicSC-Regular 400 --
serif NotoSerif-Regular
NotoSerif-RegularItalic
400 yes
  NotoSerif-Bold
NotoSerif-BoldItalic
700* yes
monospace DroidSansMono 400 --
serif-monospace CutiveMono 400 --
casual ComingSoon 400 --
cursive DancingScript-Regular 400 --
  DancingScript-Bold 700* --

* There is not *-bold generic names of this fonts, to obtain the weight 700 of them, you must use fontWeight: 'bold'.

Up to SDK 27, Android did not support setting different weights other than 'normal' and 'bold' by code. RN 0.57, the last version released on this date, does not support it either and converts weights '500'-'900' to 'bold'.

So, for example, if you want "Roboto Medium Italic" (weight 500), you have only two choices:

// recommended
{
  fontFamily: 'sans-serif-medium',
  fontStyle: 'italic'
}
// by filename ...looks more like an iOS font face :)
{
  fontFamily: 'Roboto-MediumItalic'
}

But for "Roboto Bold Italic", you can use any of this forms:

// recommended
{
  fontWeight: 'bold',
  fontStyle: 'italic'
}
// generic name, specific weight & style
{
  fontFamily: 'sans-serif',
  fontWeight: 'bold',
  fontStyle: 'italic'
}
// by filename, with embedded weight & style
{
  fontFamily: 'Roboto-BoldItalic'
}

Also, be careful not to overwrite the desired weight with fontWeight, as here:

{
  fontFamily: 'sans-serif-medium',
  fontStyle: 'bold'     // bye bye weight 500
}

Some of the predefined, alternative names:

  • sans-serif: arial, helvetica, tahoma, verdana.
  • serif: times, times new roman, palatino, georgia, baskerville, goudy, fantasy, ITC Stone Serif
  • monospace: sans-serif-monospace, monaco
  • serif-monospace: courier, courier new

If you are curious, se the fonts.xml or system_fonts.xml file in the ~/Android/Sdk/platforms/android-[sdk-num]/data/fonts directory.

Clone this wiki locally