Why do my LWJGL fonts have dots and lines around them?
- by Jordan
When we render fonts there are weird dots and lines around the text. I have no idea why this would happen. Here is an image of what it looks like:
Our font class looks like this:
package me.NJ.ComputerTycoon.Font;
import me.NJ.ComputerTycoon.BaseObjects.UDim2;
import org.lwjgl.opengl.Display;
import org.newdawn.slick.Color;
import org.newdawn.slick.TrueTypeFont;
public class Font {
public TrueTypeFont font;
private int fontSize = 18;
private String fontName = "Calibri";
private int fontStyle = java.awt.Font.BOLD;
public Font(String fontName, int fontStyle, int fontSize) {
font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
//font.
}
public Font(int fontStyle, int fontSize) {
font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
}
public Font(int fontSize) {
font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
}
public Font() {
font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
}
public void drawString(int x, int y, String s, Color color){
this.font.drawString(x, y, s, color);
}
public void drawString(int x, int y, String s){
this.font.drawString(x, y, s);
}
public void drawString(float x, float y, String s, Color color){
this.font.drawString(x, y, s, color);
}
public void drawString(float x, float y, String s){
this.font.drawString(x, y, s);
}
public void drawString(UDim2 udim, String s){
this.font.drawString((Display.getWidth() * udim.getX().getScale()) + udim.getX().getOffset(), (Display.getHeight() * udim.getY().getScale()) + udim.getY().getOffset(), s);
}
public String getFontName(){
return this.fontName;
}
public int getFontSize(){
return this.fontSize;
}
public TrueTypeFont getFont(){
return this.font;
}
}
What could be causing this?