Valid values for androidfontFamily and what they map to?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
android:fontFamily accepts both generic family names and references to actual font resources, but developers often expect a single official list of string values with guaranteed mappings on every device. In reality, only a small set of generic family names is broadly portable, and many named families or aliases can vary by Android version and OEM implementation.
The Portable Generic Families
The safest built-in values are the generic families:
- '
sans-serif' - '
serif' - '
monospace'
Example:
These names map to the platform's default sans, serif, and monospaced typefaces. On many Android devices that means Roboto or Noto-related system fonts, but the exact concrete font can vary with Android release and vendor customization.
So the mapping is conceptual rather than a promise that every device will use one identical font file.
Common Alias Names You May See
Android devices often support additional family names such as:
- '
sans-serif-light' - '
sans-serif-medium' - '
sans-serif-condensed' - '
sans-serif-black' - '
serif-monospace' - '
casual' - '
cursive'
These are useful, but they are not as universally portable as the core generic families. Some map to specific Roboto variants on AOSP-based systems, while others may behave differently or be absent depending on device and API level.
That is why relying heavily on string family names can be fragile if typography consistency matters.
Prefer Font Resources for Predictable Results
If you need a specific font, the modern Android answer is usually not a hard-coded string family name. It is a font resource in res/font.
This approach gives you a predictable font regardless of device vendor or system font mapping.
You can define the font file in the project:
That is the best option when a design system expects consistent typography across devices.
Font Family XML Resources
Android also supports font-family resource XML files so you can group weights and styles under one family entry.
Then reference it with:
This is a much better long-term pattern than trying to infer exactly which system alias maps to which vendor font file.
What Do Built-In Names Map To
Conceptually, the mappings look like this:
- '
sans-serifmaps to the system default sans family' - '
serifmaps to the system default serif family' - '
monospacemaps to the system default monospaced family' - more specific names such as
sans-serif-mediumusually map to weight or style variants of the system sans family
That is enough for practical UI work, but it is not the same as a universal cross-device contract. If you are asking for pixel-perfect mapping, system aliases are the wrong tool.
When System Families Are Still a Good Idea
System families are appropriate when:
- you want native platform look and feel,
- you do not need precise cross-device typography,
- or you want to keep the APK smaller by avoiding bundled font files.
They are especially reasonable for utility apps, internal tools, or screens where visual consistency with platform defaults matters more than custom branding.
When to Avoid Relying on String Names
Avoid depending on system alias names when:
- brand typography is part of the product,
- design review expects identical screenshots across devices,
- or you need precise control over weights, styles, and fallback behavior.
In those cases, package the fonts you want or use downloadable fonts with explicit configuration.
Common Pitfalls
The most common mistake is assuming there is one fixed official mapping from android:fontFamily strings to exact font files on every Android device. There is not.
Another mistake is using a device-specific alias because it looked correct on one phone. That may not hold across OEMs or Android versions.
Developers also sometimes avoid font resources because system families seem simpler. That is fine for generic UI text, but it is a poor choice when typography consistency is a real requirement.
Finally, do not confuse android:textStyle with android:fontFamily. Style changes bold or italic behavior within a family; it does not guarantee the same thing as selecting a specific family resource.
Summary
- The most portable string values are
sans-serif,serif, andmonospace. - Additional aliases exist, but their exact mappings can vary across devices and Android versions.
- Use
@font/...resources when you need predictable typography. - System family names are best for native-looking UI, not pixel-perfect brand control.
- Do not assume one device's font mapping is universal across Android.

