Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PlayN Font Support

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.

like image 662
hatboyzero Avatar asked Jan 30 '26 22:01

hatboyzero


1 Answers

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:

  • Java
  • Android
  • iOS
  • HTML
like image 159
samskivert Avatar answered Feb 02 '26 15:02

samskivert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!