added monospace functions to fonts

This commit is contained in:
DaniTheSkunk 2022-10-09 02:25:15 +00:00
parent f02b2a984e
commit 94d657d7be
3 changed files with 22 additions and 0 deletions

View File

@ -86,6 +86,16 @@ public class FontTTF implements IFont {
return false; return false;
} }
@Override
public boolean isMonospace() {
return false;
}
@Override
public Vec2i getMonospaceSize() {
throw new RuntimeException("Not a monospace font");
}
@Override @Override
public int getLineHeight(int ch) { public int getLineHeight(int ch) {
cacheChar(ch); cacheChar(ch);

View File

@ -24,6 +24,16 @@ public class FontTileset implements IFont {
return true; return true;
} }
@Override
public boolean isMonospace() {
return true;
}
@Override
public Vec2i getMonospaceSize() {
return charSize;
}
@Override @Override
public int getLineHeight(int ch) { public int getLineHeight(int ch) {
return charSize.getY(); return charSize.getY();

View File

@ -9,4 +9,6 @@ public interface IFont {
ITexture getTexture(int ch); ITexture getTexture(int ch);
int getXAdvance(int ch); int getXAdvance(int ch);
boolean isCP437(); boolean isCP437();
boolean isMonospace();
Vec2i getMonospaceSize();
} }