#35 fix demo
authorKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 11 Aug 2019 20:10:07 +0000 (15:10 -0500)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 11 Aug 2019 20:10:07 +0000 (15:10 -0500)
src/jexer/TApplication.java
src/jexer/backend/GlyphMaker.java
src/jexer/backend/LogicalScreen.java
src/jexer/backend/SwingTerminal.java

index b21c066fefb8ecd11dda667aec245e0ea28c98db..ec93629b0b17f9584336ff855f0d1010660121be 100644 (file)
@@ -1723,12 +1723,12 @@ public class TApplication implements Runnable {
                 }
             }
         }
-        assert (cell.getWidth() == Cell.Width.RIGHT);
-
-        if (x > 0) {
-            Cell leftHalf = getScreen().getCharXY(x - 1, y);
-            if (leftHalf.getWidth() == Cell.Width.LEFT) {
-                invertCell(x - 1, y, true);
+        if (cell.getWidth() == Cell.Width.RIGHT) {
+            if (x > 0) {
+                Cell leftHalf = getScreen().getCharXY(x - 1, y);
+                if (leftHalf.getWidth() == Cell.Width.LEFT) {
+                    invertCell(x - 1, y, true);
+                }
             }
         }
     }
index 08cbee8ca10a91d48900e182d6b1fd25d9946c39..91bda6d7314059c0fbbe0bddfcb763688d8c378d 100644 (file)
@@ -237,6 +237,11 @@ class GlyphMakerFont {
             glyphCache.put(key, image);
         }
 
+        /*
+        System.err.println("cellWidth " + cellWidth +
+            " cellHeight " + cellHeight + " image " + image);
+         */
+
         return image;
     }
 
@@ -265,6 +270,13 @@ class GlyphMakerFont {
 
         textHeight = fontTextHeight + textAdjustHeight;
         textWidth = fontTextWidth + textAdjustWidth;
+        /*
+        System.err.println("font " + font);
+        System.err.println("fontTextWidth " + fontTextWidth);
+        System.err.println("fontTextHeight " + fontTextHeight);
+        System.err.println("textWidth " + textWidth);
+        System.err.println("textHeight " + textHeight);
+         */
 
         gotFontDimensions = true;
     }
@@ -345,6 +357,7 @@ public class GlyphMaker {
      * @param fontSize the size of these fonts in pixels
      */
     private GlyphMaker(final int fontSize) {
+        assert (fontSize > 3);
         makerMono = new GlyphMakerFont(MONO, fontSize);
         // makerCJKhk = new GlyphMakerFont(CJKhk, fontSize);
         // makerCJKkr = new GlyphMakerFont(CJKkr, fontSize);
index e8d2662943abd06d579fe86ff082c7fc482a900d..558fdc4812c1e553b1434e0b1d6c173dc4ef0469 100644 (file)
@@ -967,16 +967,19 @@ public class LogicalScreen implements Screen {
     public final void putFullwidthCharXY(final int x, final int y,
         final Cell cell) {
 
-        if (lastTextHeight != getTextHeight()) {
-            glyphMaker = GlyphMaker.getInstance(getTextHeight());
-            lastTextHeight = getTextHeight();
+        int cellWidth = getTextWidth();
+        int cellHeight = getTextHeight();
+
+        if (lastTextHeight != cellHeight) {
+            glyphMaker = GlyphMaker.getInstance(cellHeight);
+            lastTextHeight = cellHeight;
         }
-        BufferedImage image = glyphMaker.getImage(cell, getTextWidth() * 2,
-            getTextHeight());
-        BufferedImage leftImage = image.getSubimage(0, 0, getTextWidth(),
-            getTextHeight());
-        BufferedImage rightImage = image.getSubimage(getTextWidth(), 0,
-            getTextWidth(), getTextHeight());
+        BufferedImage image = glyphMaker.getImage(cell, cellWidth * 2,
+            cellHeight);
+        BufferedImage leftImage = image.getSubimage(0, 0, cellWidth,
+            cellHeight);
+        BufferedImage rightImage = image.getSubimage(cellWidth, 0, cellWidth,
+            cellHeight);
 
         Cell left = new Cell(cell);
         left.setImage(leftImage);
index d32cf1ed248ba59a87ce5299b83c4413cc69b798..134eceda63772cec5c776b9d0dedf323f4559bf3 100644 (file)
@@ -182,12 +182,12 @@ public class SwingTerminal extends LogicalScreen
     /**
      * Width of a character cell in pixels.
      */
-    private int textWidth = 1;
+    private int textWidth = 16;
 
     /**
      * Height of a character cell in pixels.
      */
-    private int textHeight = 1;
+    private int textHeight = 20;
 
     /**
      * Width of a character cell in pixels, as reported by font.