Re: Grapheme clusters and east asian width

From: Eli Zaretskii <>
Date: Thu, 17 Sep 2015 17:47:53 +0300

> Date: Thu, 17 Sep 2015 13:27:31 +0100
> From: Richard Wordingham <>
> The best estimator is probably the POSIX function wcswidth().

Only on glibc-based systems, I'm quite sure.

> The
> terminal emulator might actually use that function to do its layout.
> Some do. If you need accuracy, you may have to resort to asking the
> terminal where the cursor is. Of course the latter might not work
> if only the general concept of a terminal (perhaps, better, teletype)
> is being emulated. I wouldn't expect either to work for an application
> being run from the emacs shell program, which works with 'proportional'
> fonts, though one might get a pleasant surprise. (For example, emacs
> *might* *convert* the cursor position to nominal cell widths.)

When Emacs displays on a text terminal, it's up to the terminal to
handle the font; Emacs speaks to the terminal in character cell units.
When Emacs displays on a graphics terminal, it works in pixels, so
cursor position in character units is not useful.

In any case, where do you think Emacs takes its idea of the width of
every character? What other database could it use, that can be relied
upon on any of the modern OSes, except the UCD?
Received on Thu Sep 17 2015 - 09:49:00 CDT

This archive was generated by hypermail 2.2.0 : Thu Sep 17 2015 - 09:49:01 CDT