package client.gui.element;

import client.gui.Font;

public class FontLabel extends Label {
	private final Font font;

	public FontLabel(int x, int y, int w, int h, Font font, String text, boolean left) {
		super(x, y, w, h <= 0 ? font.getHeight() : h, false, left);
		this.font = font;
		this.setText(text);
	}

	public FontLabel(int x, int y, int w, Font font, String text, boolean left) {
		super(x, y - font.getHeight(), w, font.getHeight(), false, left);
		this.font = font;
		this.setText(text);
	}
	
	protected void drawForeground(int x1, int y1, int x2, int y2) {
		Font.set(this.font);
		super.drawForeground(x1, y1, x2, y2);
		Font.unset();
	}
	
	public void updateText() {
		Font.set(this.font);
		super.updateText();
		Font.unset();
	}
}
