diff src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 244:32737a428805

add host preference for fixed screen size
author Carl Byington <carl@five-ten-sg.com>
date Mon, 14 Jul 2014 11:07:11 -0700
parents 502ba7668993
children 23119f3c0d28
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalBridge.java	Mon Jul 14 10:36:15 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalBridge.java	Mon Jul 14 11:07:11 2014 -0700
@@ -189,22 +189,7 @@
         defaultPaint.setFakeBoldText(true);  // more readable?
         localOutput = new LinkedList<String>();
         fontSizeChangedListeners = new LinkedList<FontSizeChangedListener>();
-        float defaultFontSize = Float.parseFloat(manager.prefs.getString(PreferenceConstants.DEFAULT_FONT_SIZE, "-1"));
-        Log.i(TAG, "fontSize: " + this.fontSize + ", defaultFontSize: " + defaultFontSize);
-
-        float hostFontSize;
-        if (fontSize <= 0) {
-            if ((defaultFontSize > 0) && (host.getFontSize() <= 0))
-                hostFontSize = defaultFontSize;
-            else
-                hostFontSize = host.getFontSize();
-        }
-        else
-            hostFontSize = fontSize;
-
-        if (hostFontSize <= 0) hostFontSize = DEFAULT_FONT_SIZE;
-
-        setFontSize(hostFontSize);
+        setFontSize(host.getFontSize());    // not correct for fixed size screen
         resetColors();
         selectionArea = new SelectionArea();
     }
@@ -346,8 +331,14 @@
             relayThread.start();
         }
 
-        // force font-size to make sure we resizePTY as needed
-        setFontSize(fontSize);
+        // get proper font size
+        if (host.getFixedSize()) {
+            resizeComputed(host.getFixedWidth(), host.getFixedHeight(), w, h);
+        }
+        else {
+            setFontSize(host.getFontSize());
+        }
+
         // finally send any post-login string, if requested
         injectString(host.getPostLogin());
     }
@@ -450,7 +441,7 @@
      * sure we resize PTY if needed.
      */
     final void setFontSize(float size) {
-        if (size <= 0.0) return;
+        if (size <= 0.0) size = 12.0;
         size = (float)(int)((size * 10.0f) + 0.5f) / 10.0f;
         defaultPaint.setTextSize(size);
         fontSize = size;