PlayN Font Support

Question

What kind of support do the PlayN or supporting libraries (like TriplePlay and others) provide in regards to non-standard fonts -- custom TrueType fonts in particular.

Solution

You have to register the font differently on each backend that you intend to use, but once the font is registered by name, you can use it like any built-in font by simply calling PlayN.graphics().createFont(name, style, size).

The HTML5 backend registers fonts using @font-face in CSS on the page that loads your game. The Android and Java backends require some code to register the font, and in the iOS backend the font must be listed in your Info.plist file.

The PlayN Showcase sample application demonstrates custom font registration for all platforms: