Re: Issue 269 in connectbot: Add more realistic default font size based on DPI

67 views
Skip to first unread message

conne...@googlecode.com

unread,
Feb 14, 2012, 11:28:02 AM2/14/12
to connectbo...@googlegroups.com

Comment #3 on issue 269 by cubano10...@gmail.com: Add more realistic
default font size based on DPI
http://code.google.com/p/connectbot/issues/detail?id=269

Font is real small on Galaxy Nexus. Would like to pick font and font size.

conne...@googlecode.com

unread,
Mar 23, 2012, 6:48:22 PM3/23/12
to connectbo...@googlegroups.com

Comment #4 on issue 269 by j...@jine.se: Add more realistic default font

Thanks for the heads of regarding changing font-size per host, but I'd like
to set a default font of like 18, which looks better on my Galaxy Nexus...

conne...@googlecode.com

unread,
Jul 11, 2012, 4:08:22 AM7/11/12
to connectbo...@googlegroups.com

Comment #5 on issue 269 by arvid...@gmail.com: Add more realistic default
On Samsung Galaxy S3 (300+ DPI screen) the default font size is also way
too small. Around 22 pt seems like a much better default for that screen.
Annoying to have to change it per host though. I might look into making a
patch to add a global "default font size for new hosts" setting later this
week. Probably also auto detecting a good default value for that setting on
first start or similar.

conne...@googlecode.com

unread,
Jul 11, 2012, 7:17:52 AM7/11/12
to connectbo...@googlegroups.com

Comment #6 on issue 269 by arvid...@gmail.com: Add more realistic default
Here is a very simple patch I made to add a default font size option. The
patch does not try to default to a good font size on first run yet. The
only thing it adds is an option that allows you to change the default font
size for new hosts (without this patch it is hard-coded at 10 pt).

I will look into how to change the default font size based on the DPI
later, the issue is that as far as I understand from the API docs you
should use getWindowManager().getDefaultDisplay().getMetrics(metrics).
However getWindowManager() is found in the Activity class, and thus can't
be reached from the service that would need it (given the current
architecture of ConnectBot). I guess the reason for this is that the device
DPI could change. For example what if an user connects a phone or tablet
(with HDMI out) to a TV? I can't test this scenario (I lack the cables for
it) but presumably Android would re-initialize the activity (as it does
when you rotate the device for example). Thus I suspect that the only way
to correctly handle device DPI is to let the activity inform the
TerminalBridge about the screen DPI when it opens the TerminalBridge
(assuming such a re-initialisation of the activity would cause it to
re-open the TerminalBridge).

A potential issue with this patch is translation. I don't know how
translated strings work on android: Does it default to the string in
res/values/strings.xml if it can't find a translated version of that
string? If so it should work (though not be translated) I guess.

I have tested the change on my Samsung Galaxy S3 (I9300) and in the
emulator instances that I have around for my own projects (API levels 8 and
15) and it seems to work fine.

Attachments:
default-fontsize-setting.diff 3.2 KB

conne...@googlecode.com

unread,
Jul 24, 2012, 5:21:12 AM7/24/12
to connectbo...@googlegroups.com

Comment #7 on issue 269 by arvid...@gmail.com: Add more realistic default
I made two patches to fix this issue:
1) default-fontsize-setting.diff is the same as the above patch (with a few
minor formatting fixes).
2) dpi.diff scales font sizes for the device DPI. I don't know if it will
work when plugging in for example HDMI (and thus moving the activity to a
screen with a different DPI presumably), since I don't have the hardware
required to test that.

Attachments:
default-fontsize-setting.diff 3.2 KB
dpi.diff 591 bytes

conne...@googlecode.com

unread,
Oct 21, 2012, 4:53:28 PM10/21/12
to connectbo...@googlegroups.com

Comment #8 on issue 269 by yavor.tc...@gmail.com: Add more realistic
The font is still tiny on the galaxy nexus, stock JB. However, i saw you
mentioned the font can be controlled via the volume keys which works
beautifully. I love the app - I think you should simply add that tip to one
of the pop-ups when you run the app for the first time (ie "If font size is
too small on your device use the volume up/down buttons to change it").
Thanks.

Reply all
Reply to author
Forward
0 new messages