Skip to main content
Configure system and custom fonts used in Userpilot experiences, including resolution order, weights, and multi-module support. The Userpilot Android SDK supports system and custom fonts for rendering experiences, ensuring visual consistency across your app with dynamic fonts, weight mapping, and text scaling.

Overview

When building an experience, you can specify the font family name. The SDK will search and apply the font automatically so the selected font renders consistently across your app.

Font Sources and Resolution Order

The SDK resolves fonts by checking the following sources in order:
  1. System Fonts: Standard Android typefaces such as default, serif, and monospaced.
  2. Resources: Fonts defined in the res/font folder of the SDK or client apps.
  3. Assets: Fonts stored in the assets/fonts/ directory.
  4. System Font Directory: Custom fonts located in /system/fonts.

Font Weight Handling

The SDK converts weight strings (for example, bold, light) to a Typeface style or integer value using the FontWeight enum.

Multi-Module Apps or Custom App IDs

If your app supports multiple modules and you want to use a font from one of them, provide the module’s package name so the SDK can locate the font.
userpilot = Userpilot(context, "<APP_TOKEN>") {
    packageNames = listOf("com.example.features")
}

Error Logging

If a requested font cannot be found, an error message is logged to help debug issues during SDK development or integration:
Font "fontName" not found!