Why is tab unaffected by font whereas space is affected?
Kent Karlsson
kent.b.karlsson at bahnhof.se
Sun Apr 19 19:01:36 CDT 2020
> 18 apr. 2020 kl. 21:24 skrev Eli Zaretskii via Unicode <unicode at unicode.org>:
>
>> Date: Fri, 17 Apr 2020 16:09:41 +0100
>> From: Richard Wordingham via Unicode <unicode at unicode.org>
>>
>> In some editors, e.g. Emacs 24.4.2, changing the font does
>> significantly change the position. (For most Emacs modes, one nowadays
>> has to specify the character as U+0009 to enter the tab as a character.)
>
> Emacs uses a fixed number of space_width pixels to display a TAB.
> Since space_width varies with font, so does the width of a TAB.
1) Several text editors, primarily aimed at editing program source code, actually REPLACE
an input (i.e. from the keyboard, not when read in from a file) tab character with a number of spaces,
or can be set to do so. That is preferred for programming, with the (max) number of spaces specified
in a style guide, since people use different editors (with different (default) tab positions), or
use different tab positions even if using the same text editor. This is especially true for programming
project involving hundreds of people and/or spanning over many years.
2) (Stepping away from source code editing.) What if one can change font or size ”in the middle of lines”.
With the emacs approach (but not talking about emacs here, but a context where one actually can
change font or size in the middle of lines), one would then get a harder time getting text to line up
over several lines by using tabs. That kind of defeats the purpose of tabs. Sure, tables are better, and
are not bogged with other (similar) problems associated with tabs and setting tab stops. But I see no
reason to make tabs less useful than they have been. So no, the emacs approach to tabs ”does not fly”.
3) Tab stops really used to be settable (either by proprietary escape sequences, or standard ECMA-48
control sequences) on some terminals. Granted, those terminals also had very fixed size of their
characters’s glyphs, and at that time one could not set the tab stops ”between” character positions
(which one can in some modern ”document editors” (trying to use a neutral term here)).
In summary, tab stops are at particular positions in a displayed line of text, and do not depend on
font changes, or font size changes. In some contexts one can set the tab stops (not just using
default positions), and they ”stay” over font changes and font size changes, until tab stops are
(re)set by a tab setting ”command” (or paragraph property, or similar mechanism, depending
on system).
I would say that emacs stands alone with its rather strange interpretation. (As far as I know.)
/Kent Karlsson
More information about the Unicode
mailing list