TTF Font Resource

XML file saved at:

res/
  font/
    file.txt
    other_file.json

Resource reference

  • XML: @raw/file
  • Java: Res.raw.file

Example

XML file saved at res/font/myFont.ttf.

This layout XML applies a font ttf to a View:

<Button font="@font/myFont" />

This application code retrieves a TTF font:

Font myFont = ResManager.getFont(Res.font.myFont);