all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: user42_kevin@yahoo.com.au, 26396@debbugs.gnu.org
Subject: bug#26396: 25.1; char-displayable-p on a latin1 tty
Date: Fri, 14 Apr 2017 11:56:32 -0700	[thread overview]
Message-ID: <24bd0681-08d5-137f-29df-715eefddf2ae@cs.ucla.edu> (raw)
In-Reply-To: <83inm7go6o.fsf@gnu.org>

On 04/14/2017 05:37 AM, Eli Zaretskii wrote:
>> This should not be a problem, as the Linux console has only 
>> single-width characters. 
> Are you sure?  AFAIU, the Linux console supports the BMP, and some of
> the characters in the BMP are double-width (a.k.a. "full-width"), for
> example U+1100, U+231A, U+2B1B, and others.  What does the Linux
> console do when these characters are sent to the screen driver?

I haven't experimented with it, so I'm not 100% sure. However, as I 
understand the implementation, the console driver can support at most 
512 simultaneously-displayable characters, as this is a property of the 
classic IBM VGA design that is the greatest common denominator of 
current or recent (post-1990) PC graphics hardware. The user can specify 
what each character looks like down to the pixel level, but cannot alter 
character sizes on a character-by-character basis. In theory one could 
display double-wide characters by splitting them into halves and 
displaying each half separately, but I don't know of anyone who does 
that (it would not be practical due to that 512 limit).

>
>>> And what does "display as-is" means in practice?  Should we send to
>>> the console the glyph codes corresponding to Unicode points, or should
>>> we send UTF-8 encoded characters?
>> It depends on whether the console is in UTF-8 mode. If so, send UTF-8;
>> if not, send a byte that is transformed according to the current mapping
>> table into a Unicode value. I hope we don't need to bother with the
>> latter possibility.
> What software puts the console in UTF-8 mode?  Is that the locale
> setting?

It's done at boot time. The escape sequences ESC % G (or ESC % 8) and 
ESC % @ get you into and out of UTF-8 mode; see 
<http://man7.org/linux/man-pages/man4/console_codes.4.html>. Common 
practice is to stay in UTF-8 mode as the alternative is worse (it has 
only 256 simultaneously-displayable characters).

> http://www.tldp.org/LDP/LG/issue91/loozzr.html
> http://man7.org/linux/man-pages/man4/console_codes.4.html
> that seems to be just the tip of an iceberg.  Or maybe the
> issue is easier than I envisioned.

Both, I hope. :-)

> Suppose we only wanted to use this feature for UTF-8 locales.
> Assuming that the OS takes care of putting the console in UTF-8 mode,
> we don't need any changes in Emacs, since Emacs already sends UTF-8
> sequences to the screen driver.  As the Linux console only supports
> the BMP, we could then simply amend the code of char-displayable-p to
> check whether a character is within the BMP, when the terminal is the
> Linux console.  Do you agree with this conclusion?

No, because a character is displayable only if it's in that set of 
at-most-512 characters.

> OTOH, now I'm not sure I understand the need for terminal_glyph_code.
> What does it do that a simple check for a Linux console and UTF-8
> terminal encoding, plus a character being inside a BMP, don't?

terminal_glyph_code gets the current set of at-most-512 displayable 
characters from from the kernel.






  reply	other threads:[~2017-04-14 18:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08  2:20 bug#26396: 25.1; char-displayable-p on a latin1 tty Kevin Ryde
2017-04-08  7:42 ` Eli Zaretskii
2017-04-09  5:16   ` Kevin Ryde
2017-04-10  6:47     ` Eli Zaretskii
2017-04-10  7:05       ` Eli Zaretskii
2017-04-10  7:45         ` Eli Zaretskii
2017-04-13  6:19         ` Paul Eggert
2017-04-13  7:16           ` Eli Zaretskii
2017-04-13 20:58             ` Paul Eggert
2017-04-14  3:01               ` Kevin Ryde
2017-04-14 18:59                 ` Paul Eggert
2017-04-14 12:37               ` Eli Zaretskii
2017-04-14 18:56                 ` Paul Eggert [this message]
2017-04-15  8:48                   ` Eli Zaretskii
2017-04-15 21:12                     ` Paul Eggert
2017-04-16  5:59                       ` Eli Zaretskii
2017-04-16 20:25                         ` Paul Eggert
2017-04-17  6:19                           ` Eli Zaretskii
2017-04-17  3:00                         ` Kevin Ryde
2017-04-17  3:26                           ` Paul Eggert
2017-04-17  5:56                             ` Paul Eggert
2017-04-17  7:33                               ` Eli Zaretskii
2017-04-17 17:22                                 ` Paul Eggert
2017-04-17  6:24                             ` Eli Zaretskii
2017-04-17  6:41                               ` Paul Eggert
2017-04-17  7:27                                 ` Kevin Ryde
2017-04-17  8:08                                 ` Eli Zaretskii
2017-04-17 18:08                                   ` Paul Eggert
2017-04-17 18:32                                     ` Eli Zaretskii
2017-04-18 17:49                                       ` Paul Eggert
2017-04-18 18:19                                         ` Eli Zaretskii
2017-04-13 22:07           ` Richard Stallman
2017-04-13 22:18             ` Paul Eggert
2017-04-14 19:48               ` Richard Stallman
2017-04-11  7:22       ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24bd0681-08d5-137f-29df-715eefddf2ae@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=26396@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=user42_kevin@yahoo.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.