X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FLogicalScreen.java;h=513c599145440e8a9682ef5c764b8e5d650e9c29;hb=9588c7134280341ab6e92e37d1c1d00b3756cee5;hp=b7648313d0d15513584dddf4659f42a841e8f47e;hpb=a69ed767c9c07cf35cf1c5f7821fc009cfe79cd2;p=fanfix.git diff --git a/src/jexer/backend/LogicalScreen.java b/src/jexer/backend/LogicalScreen.java index b764831..513c599 100644 --- a/src/jexer/backend/LogicalScreen.java +++ b/src/jexer/backend/LogicalScreen.java @@ -134,6 +134,26 @@ public class LogicalScreen implements Screen { // Screen ----------------------------------------------------------------- // ------------------------------------------------------------------------ + /** + * Get the width of a character cell in pixels. + * + * @return the width in pixels of a character cell + */ + public int getTextWidth() { + // Default width is 16 pixels. + return 16; + } + + /** + * Get the height of a character cell in pixels. + * + * @return the height in pixels of a character cell + */ + public int getTextHeight() { + // Default height is 20 pixels. + return 20; + } + /** * Set drawing offset for x. * @@ -564,6 +584,14 @@ public class LogicalScreen implements Screen { */ public final void setDimensions(final int width, final int height) { reallocate(width, height); + resizeToScreen(); + } + + /** + * Resize the physical screen to match the logical screen dimensions. + */ + public void resizeToScreen() { + // Subclasses are expected to override this. } /** @@ -889,6 +917,9 @@ public class LogicalScreen implements Screen { * @param y row coordinate. 0 is the top-most row. */ public final void unsetImageRow(final int y) { + if ((y < 0) || (y >= height)) { + return; + } for (int x = 0; x < width; x++) { if (logical[x][y].isImage()) { physical[x][y].unset();