Mercurial > 510Connectbot
comparison src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 247:1e1bb5468ebe
add host preference for fixed screen size
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 14 Jul 2014 11:18:24 -0700 |
parents | dfe5f44bbea1 |
children | 0181323d0d33 |
comparison
equal
deleted
inserted
replaced
246:dfe5f44bbea1 | 247:1e1bb5468ebe |
---|---|
121 private ClipboardManager clipboard; | 121 private ClipboardManager clipboard; |
122 | 122 |
123 public int charWidth = -1; | 123 public int charWidth = -1; |
124 public int charHeight = -1; | 124 public int charHeight = -1; |
125 private int charTop = -1; | 125 private int charTop = -1; |
126 private float fontSize = -1; | |
127 | 126 |
128 private final List<FontSizeChangedListener> fontSizeChangedListeners; | 127 private final List<FontSizeChangedListener> fontSizeChangedListeners; |
129 | 128 |
130 private final List<String> localOutput; | 129 private final List<String> localOutput; |
131 | 130 |
445 */ | 444 */ |
446 final void setFontSize(float size) { | 445 final void setFontSize(float size) { |
447 if (size <= 0.0) size = 12.0f; | 446 if (size <= 0.0) size = 12.0f; |
448 size = (float)(int)((size * 10.0f) + 0.5f) / 10.0f; | 447 size = (float)(int)((size * 10.0f) + 0.5f) / 10.0f; |
449 defaultPaint.setTextSize(size); | 448 defaultPaint.setTextSize(size); |
450 fontSize = size; | |
451 // read new metrics to get exact pixel dimensions | 449 // read new metrics to get exact pixel dimensions |
452 FontMetrics fm = defaultPaint.getFontMetrics(); | 450 FontMetrics fm = defaultPaint.getFontMetrics(); |
453 charTop = (int)FloatMath.ceil(fm.top); | 451 charTop = (int)FloatMath.ceil(fm.top); |
454 float[] widths = new float[1]; | 452 float[] widths = new float[1]; |
455 defaultPaint.getTextWidths("X", widths); | 453 defaultPaint.getTextWidths("X", widths); |
460 if (parent != null) parentChanged(parent); | 458 if (parent != null) parentChanged(parent); |
461 | 459 |
462 for (FontSizeChangedListener ofscl : fontSizeChangedListeners) | 460 for (FontSizeChangedListener ofscl : fontSizeChangedListeners) |
463 ofscl.onFontSizeChanged(size); | 461 ofscl.onFontSizeChanged(size); |
464 | 462 |
465 host.setFontSize(fontSize); | 463 host.setFontSize(size); |
466 manager.hostdb.updateFontSize(host); | 464 manager.hostdb.updateFontSize(host); |
467 } | 465 } |
468 | 466 |
469 /** | 467 /** |
470 * Add an {@link FontSizeChangedListener} to the list of listeners for this | 468 * Add an {@link FontSizeChangedListener} to the list of listeners for this |