I tried with truetype fonts.
Code:
import org.newdawn.slick.*;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.font.effects.ColorEffect;
import java.awt.Color;
import java.awt.Font;
public class FontTest extends BasicGame {
private UnicodeFont fUnicodeFont;
public FontTest() {
super("FontTest");
}
@Override
public void init(GameContainer gameContainer) throws SlickException {
Font font = new Font("Verdana", Font.PLAIN, 20);
fUnicodeFont = new UnicodeFont(font, 300, false, false);
fUnicodeFont.getEffects().add(new ColorEffect(Color.GREEN));
fUnicodeFont.addAsciiGlyphs();
fUnicodeFont.loadGlyphs();
}
@Override
public void update(GameContainer gameContainer, int i) throws SlickException {
// do nothing
}
public void render(GameContainer gameContainer, Graphics graphics) throws SlickException {
graphics.drawRect(0, 0, 800, 600);
fUnicodeFont.drawString(10, 10, "SOS");
}
public static void main(String[] args) throws SlickException {
AppGameContainer app = new AppGameContainer(new FontTest());
app.setDisplayMode(800, 600, false);
app.start();
}
}
With font-size 50, the text is displayed correctly.
If we change the font-size to 70, only the O is displayed.
With font-size 80, we don't see anything on screen.