You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tomcashman edited this page Feb 24, 2013
·
1 revision
Mini2Dx has support for TrueTypeFonts through the freetype LibGDX extension. However, due to mini2Dx placing its origin in the top left corner of the screen, all fonts loaded will be upside-down when rendered.
Loading a font
//Generate a font object for font.ttf at size 40pxFreeTypeFontGeneratorgenerator = newFreeTypeFontGenerator(Gdx.files.internal("font.ttf"));
BitmapFontfont = generator.generateFont(40, FreeTypeFontGenerator.DEFAULT_CHARS, true);
Setting a font as the Graphics context font
publicvoidrender(Graphicsg) {
//Set the graphics fontg.setFont(font);
//Draw using the fontg.drawString("Hello, world!", 32, 32);
}