We aren’t limited in our Android applications to just the built-in fonts. Android supports
the creation of Typeface objects from any TrueType font file. TrueType fonts are a
standard and work on a variety of platforms. This opens up a wide range of possibilities
for our applications.
Many sites on the Internet offer free fonts, and, of course, there are font foundries,
companies that create fonts that will sell you a license to use their fonts.
The Typeface.createFromAsset method takes in an AssetManager, which can be gotten
through a call to getAssets from the Context and the name of the file. It returns a
Typeface object that can be passed into the Paint.setTypeface method.
Typeface chops = Typeface.createFromAsset(getAssets(),
"ChopinScript.ttf");
paint.setTypeface(chops);