Back to project page square-libgdx.
The source code is released under:
GNU General Public License
If you think the Android project square-libgdx listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.denzyldick.square; //from w w w . ja v a2 s. c o m import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; public class Font { private BitmapFont font; private FreeTypeFontGenerator fontGenerator; private int fontSize = 20; private Color fontColor = Color.RED; public Font() { fontGenerator = new FreeTypeFontGenerator( Gdx.files.internal("font/font.ttf")); font = fontGenerator.generateFont(fontSize); fontGenerator.scaleForPixelHeight(Gdx.graphics.getHeight()); fontGenerator.dispose(); font.setColor(fontColor); } public BitmapFont getFont() { return font; } public void setColor(Color color) { this.fontColor = color; } public void dispose() { font.dispose(); } }