Calligraphy
Custom fonts in Android the easy way...
Calligraphy is an Android library (now end-of-life) that made it easy to apply custom fonts across an entire app using XML attributes, without writing repetitive code for every text view.
Calligraphy is an Android library that made it straightforward to use custom fonts throughout an app without writing repetitive code. Before Android added built-in support for custom fonts in XML layouts, developers had to either create custom view subclasses for every text component or write code that walked the entire view hierarchy to find text elements and reassign fonts manually. Calligraphy was built to eliminate that friction.
The approach works by wrapping the Activity context with a special Calligraphy wrapper. Once that single line is added to each Activity, the library intercepts how views are created and applies fonts automatically. You can then specify a font using a simple XML attribute directly on any TextView, or define fonts through Android styles, text appearances, or the app theme, following the same priority order Android itself uses when resolving style attributes.
You drop your font files into the assets folder of your project, then reference them by path in your XML layouts or style definitions. A global default font can be set once in the Application class so every text view in the app gets a consistent typeface without further work. For cases where you need more than one font style within a single block of text, the library also includes a helper for creating text spans with different typefaces.
The README notes one known edge case: two Switch widgets in Android have a second typeface setter for the on/off label inside the toggle itself, which Calligraphy does not reach automatically, requiring a subclass workaround.
This version of the library has reached end-of-life and is no longer maintained. The README directs users to migrate to Calligraphy 3, which is hosted under a different GitHub organization. The library is licensed under Apache 2.0.
Where it fits
- Apply a custom brand font to every TextView in an Android app by adding one line to each Activity and setting the font in the app theme.
- Use different custom fonts for headings and body text via standard Android XML style attributes without subclassing any views.
- Migrate an older Android app to use consistent custom fonts across all screens with minimal code changes.