Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #395679

Re: Unicode...

Path csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: Unicode...
Date Wed, 03 Dec 2025 18:15:38 -0800
Organization None to speak of
Lines 51
Message-ID <877bv3ngad.fsf@example.invalid> (permalink)
References <10f85f9$33pck$1@dont-email.me> <10fgc9g$17a9o$1@dont-email.me> <10fihbp$7jbe$1@dont-email.me> <10fik8j$1pqbu$1@dont-email.me> <10gohgv$30bof$1@raubtier-asyl.eternal-september.org> <10gpvp1$3ie47$1@dont-email.me> <10gq1ei$37uq3$2@dont-email.me> <10gq5o5$3kjac$1@dont-email.me> <87bjkfnve4.fsf@example.invalid>
MIME-Version 1.0
Content-Type text/plain
Injection-Date Thu, 04 Dec 2025 02:15:40 +0000 (UTC)
Injection-Info dont-email.me; posting-host="e38d0a155bf5e1059ca9aac90fa21c1e"; logging-data="4074440"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/L5WpoA5fbwDMHN3kRGrTS"
User-Agent Gnus/5.13 (Gnus v5.13)
Cancel-Lock sha1:LOCUyjrhUTWmP2aFYbQuIdS6ZKg= sha1:uN2fm2d2H8PyGtE2YGjYLFLPY7o=
Xref csiph.com comp.lang.c:395679

Show key headers only | View raw


Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
> bart <bc@freeuk.com> writes:
>> On 03/12/2025 19:01, James Kuyper wrote:
> [...]
>>> I find it confusing that this is supposed to "work perfectly"
>>> "across
>>> diverse OSs". The amount of space that a character takes up varies
>>> depending upon the installed fonts, especially on whether the font is
>>> monospaced or proportional. Those fonts can be different for display on
>>> screen or on a printer. I don't see any query to determine even what the
>>> current font is, much less what it's characteristics are. I don't know
>>> of any OS-independent way of collecting such information. Does this
>>> solution "work perfectly" only for your own particular favorite font?
>>
>> This looks like a solution for a fixed-pitch font. I get this output
>> for a Windows console display (with - used for space):
> [...]
>
> I think bart is right that this is specific to fixed-width fonts.
> For a variable width font, 'W' is going to be wider than '|'.
>
> See also the POSIX `int wcwidth(wchar_t wc)` function, which returns
> the "number of column positions of a wide-character code".  It does
> depend on the current locale.
>
> The assumption seems to be that fixed-width fonts are expected to be
> consistent about the widths of characters.

And in fact Unicode specifies how many cell positions each printable
character occupies, or at least for some of them.

The following is quoted from wcwidth.c in the xterm sources.  The text
was originally written by Markus Kuhn.

 * For some graphical characters, the Unicode standard explicitly
 * defines a character-cell width via the definition of the East Asian
 * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.
 * In all these cases, there is no ambiguity about which width a
 * terminal shall use. For characters in the East Asian Ambiguous (A)
 * class, the width choice depends purely on a preference of backward
 * compatibility with either historic CJK or Western practice.
 * Choosing single-width for these characters is easy to justify as
 * the appropriate long-term solution, as the CJK practice of
 * displaying these characters as double-width comes from historic
 * implementation simplicity (8-bit encoded characters were displayed
 * single-width and 16-bit ones double-width, even for Greek,
 * Cyrillic, etc.) and not any typographic considerations.
 
-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-14 21:03 +0000
  Re: Unicode... Kaz Kylheku <643-408-1753@kylheku.com> - 2025-11-14 21:20 +0000
    Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-14 21:46 +0000
      Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-11-14 16:12 -0800
        Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 00:46 +0000
          Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-11-14 18:47 -0800
            Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 19:10 +0000
              Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-11-15 13:51 -0800
                Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 22:31 +0000
  Re: Unicode... richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-11-14 23:23 +0000
    Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-14 23:51 +0000
  Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-11-14 16:11 -0800
    Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 00:49 +0000
  Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-15 05:51 +0100
    Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-15 06:24 +0100
      Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 19:28 +0000
        Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-19 11:56 +0100
          Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-21 02:21 +0000
            Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-21 11:10 +0100
      Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-16 00:38 +0000
      Re: Unicode... bart <bc@freeuk.com> - 2025-11-21 17:03 +0000
        Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-21 17:39 +0000
        Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 06:39 +0100
          Re: Unicode... bart <bc@freeuk.com> - 2025-11-22 11:55 +0000
            Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 14:10 +0100
              Re: Unicode... bart <bc@freeuk.com> - 2025-11-22 13:38 +0000
                Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 15:08 +0100
                Re: Unicode... bart <bc@freeuk.com> - 2025-11-22 14:28 +0000
                Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 15:51 +0100
                Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 16:05 +0100
                Re: Unicode... bart <bc@freeuk.com> - 2025-11-22 16:35 +0000
                Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 18:13 +0100
                Re: Unicode... bart <bc@freeuk.com> - 2025-11-22 17:35 +0000
                Re: Unicode... bart <bc@freeuk.com> - 2025-11-22 17:39 +0000
                Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-11-22 15:24 -0800
                Re: Unicode... bart <bc@freeuk.com> - 2025-11-23 00:14 +0000
                Re: Unicode... David Brown <david.brown@hesbynett.no> - 2025-11-23 13:32 +0100
                Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 18:44 +0100
                Re: Unicode... bart <bc@freeuk.com> - 2025-11-22 19:28 +0000
                Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-22 20:59 +0100
                Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-11-26 19:42 +0100
    Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 19:06 +0000
  Re: Unicode... Mikko <mikko.levanto@iki.fi> - 2025-11-15 12:47 +0200
    Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 19:09 +0000
      Re: Unicode... Mikko <mikko.levanto@iki.fi> - 2025-11-16 11:22 +0200
  Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 19:14 +0000
    Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-15 20:16 +0000
  Unicode Sorting (Was Re: Unicode...) Michael Sanders <porkchop@invalid.foo> - 2025-11-16 20:30 +0000
    Re: Unicode Sorting (Was Re: Unicode...) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-11-16 16:13 -0800
  Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-17 23:49 +0000
    Re: Unicode... James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-11-18 14:27 -0500
      Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-18 20:17 +0000
        Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-18 20:40 +0000
        Re: Unicode... James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-11-19 09:08 -0500
          Re: Unicode... Michael Bäuerle <michael.baeuerle@stz-e.de> - 2025-11-19 15:29 +0100
          Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-19 19:22 +0000
          Re: Unicode... Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-26 02:03 +0000
        Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-12-03 06:24 +0100
          Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-12-03 18:33 +0000
            Re: Unicode... James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-03 14:01 -0500
              Re: Unicode... bart <bc@freeuk.com> - 2025-12-03 20:15 +0000
                Re: Unicode... Michael S <already5chosen@yahoo.com> - 2025-12-03 22:43 +0200
                Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-03 12:49 -0800
                Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-03 18:15 -0800
              Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-12-03 23:23 +0000
              Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-12-04 14:15 +0100
            Re: Unicode... Bonita Montero <Bonita.Montero@gmail.com> - 2025-12-04 14:03 +0100
          Binary Search Trees (Was Re: Unicode...) Michael Sanders <porkchop@invalid.foo> - 2025-12-04 04:11 +0000
      Re: Unicode... Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 06:17 +0000
        Re: Unicode... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-23 22:22 -0800
          Re: Unicode... Lynn McGuire <lynnmcguire5@gmail.com> - 2025-12-24 01:41 -0600
            Re: Unicode... Michael S <already5chosen@yahoo.com> - 2025-12-24 11:24 +0200
            Re: Unicode... scott@slp53.sl.home (Scott Lurndal) - 2025-12-24 17:11 +0000
              Re: Unicode... Lynn McGuire <lynnmcguire5@gmail.com> - 2025-12-25 02:00 -0600
                Re: Unicode... Michael S <already5chosen@yahoo.com> - 2025-12-25 10:49 +0200
                Re: Unicode... Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-25 10:22 +0100
                Re: Unicode... scott@slp53.sl.home (Scott Lurndal) - 2025-12-26 16:28 +0000
                Re: Unicode... Lynn McGuire <lynnmcguire5@gmail.com> - 2025-12-27 00:25 -0600
                Re: Unicode... Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-29 23:34 +0000
                Re: Unicode... Lynn McGuire <lynnmcguire5@gmail.com> - 2025-12-27 00:29 -0600
                Re: Unicode... Michael S <already5chosen@yahoo.com> - 2025-12-27 18:08 +0200
                Re: Unicode... Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-29 23:38 +0000
                Re: Unicode... scott@slp53.sl.home (Scott Lurndal) - 2025-12-27 19:17 +0000
                Re: Unicode... Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-27 20:47 +0100
                Re: Unicode... Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2025-12-27 20:03 +0000
                Re: Unicode... Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2025-12-27 20:05 +0000
                Re: Unicode... Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-29 23:39 +0000
                Re: Unicode... Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-27 22:43 +0100
        Re: Unicode... James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-31 18:04 -0500
          Re: Unicode... Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 23:11 +0000
            Re: Unicode... James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-31 18:36 -0500
  Re: Unicode... Philipp Klaus Krause <pkk@spth.de> - 2025-11-23 12:42 +0100
    Re: Unicode... Michael Sanders <porkchop@invalid.foo> - 2025-11-23 22:05 +0000

csiph-web