Wandering Thoughts archives


Many programs should provide an easy way to change font size

Here is a thesis: any GUI program that deals with a substantial amount of text should have a browser-like set of menu options for 'increase text size', 'decrease text size', and 'reset text size'. Naturally, this should really use the same key bindings as browsers do. Browsers have shown everyone the way, so it is now well past the day that we should have to go into preferences and configurations in order to temporarily change the text size in our editors, our mail clients, our terminal windows, or whatever. Perhaps this window needs a very large font for readability on the projector; perhaps that window can be very small because it's not important. Either way, it should be easy.

(And when it is easy and convenient, it may well become common.)

Typical programs that this applies to are editors, mail clients (which are more and more browser-like in general, especially since they are being called upon to display HTML mail), and terminal windows. There are probably others, although none spring to mind right away. Anything that really is a browser should definitely be doing this, because you should be as browser-like as possible; the leading example on Gnome and KDE desktops is help viewers.

Some implementation notes:

  • if the program is something where you normally only run one instance, like a mail client or a multi-window editor, I wouldn't object if it remembered the current text size when you quit and restarted it. If it does this, 'reset text size' should still reset things.

    This should definitely not happen for programs where you run a lot of instances. Just because I want this terminal window in a tiny font doesn't mean that I want all of them that way.

  • it would be nice if programs had a preferences option for 'set current text size as the default text size', so that once you'd experimented to find the size of editor font (or whatever) that worked for you, you could immediately set it without trying to work out exactly what font size you'd wound up with.

  • speaking of font sizes: Firefox does non-linear scaling, where 'increase font size' doesn't just add one to the current point size. Don't automatically imitate this, especially at relatively small point sizes (say, under 18 to 20 points). At the typical font sizes that terminal windows and editors and suchlike usually operate at, my experience is that I want to be able to do fine adjustments anyways because any change makes a difference.

(Firefox's large jumps in font size can actually be frustrating; my personal set of Firefox hacks makes them more fine-grained around the start point.)

Sidebar: what Firefox does for text scaling

Firefox's increase and decrease font size options multiply the base font size (whatever it is) by one of a set of constants; which constant is used depends on the level of increase or decrease in text size. The constants themselves are visible in the toolkit.zoomManager.zoomValues preference and you can see there how they are somewhat jumpy.

(In the old X days of bitmapped fonts and semi-scaled fonts, this could lead to all sorts of fun depending on your exact font. Because not all fonts were available in all sizes, Firefox used the closest size that was actually available; this meant that changing the text size could have no effect at all until suddenly it jumped significantly, as things had finally been enlarged or shrunk enough that the closest available size changed from the old font size to a new one. These days I suspect that font sizes are just rounded to the nearest point, and TrueType fonts are available in any point size you ask for (although they may not look very good at small or large ones).)

Embarrassingly, it hadn't sunk in until now that this is a user preference and so I can set and modify it without any source code changes at all. (I still have other Firefox hacks that I am carrying, but at least the number of them has shrunk over the years.)

programming/ChangingTextSize written at 00:28:44; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.