unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: Variable pitch text filling
Date: Sat, 27 Nov 2021 10:35:01 +0200	[thread overview]
Message-ID: <83a6hq0zey.fsf@gnu.org> (raw)
In-Reply-To: <87h7byrplm.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat,  27 Nov 2021 09:04:53 +0100)

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: emacs-devel@gnu.org
> Date: Sat, 27 Nov 2021 09:04:53 +0100
> 
> 1) We want to display the "-" wider in the variable-pitch mode line
> 2) In the justification case, we want to add some blank pixels more free-form
> 3) A much-requested feature is to be able to "snap" characters to an
> integer multiple of the standard font (in a fixed-width buffer).
> (Mostly relevant for people that mix fonts, like CJK and roman.)
> 
> All three of these are essentially the same: Add some pixels to the
> glyphs in a region.
> 
> So we could do just that.  I.e., not a complex display spec, but a
> simpler char-based one, for instance `char-spacing', that could have
> values:
> 
> 1) 1.0, to be at least 1 normal character wide
> 2) 3, to add three blank pixels to the end
> 3) `grid', to add enough blank pixels to have a width that's an
>    integer multiple of the normal character width

It is trivial to add some pixels to the width of a glyph we produce
for a character: it just involves enlarging the it->pixel_width and/or
the glyph->pixel_width when we produce the glyph for that character.
Then the display backends (xterm.c etc.) will draw the background
color for those pixels automatically, thus creating an illusion of
"blank pixels".

The problem is how to determine which characters to "widen", and how
to calculate the number of the "widening" pixels.  The answer could be
different for each kind of situations you mention.

> So standard-mode-line-format would have
> 
>              (list
>               :propertize
>               (list ""
> 	            'mode-line-mule-info
> 	            'mode-line-client
> 	            'mode-line-modified
> 	            'mode-line-remote)
>               'display '(min-width (5.0))
>               'char-spacing 1.0)

What would be the exact meaning of "char-spacing 1.0" here?  IOW, how
would we compute the number of pixels to add to each glyph's width in
this case? what is a "normal character" for this purpose?

> while inter-character justification would use 'char-spacing 1 to add an
> extra pixel after all the chars on the line, for instance. 

With the value 1 computed by Lisp?  Because it cannot be a fixed
value: it should at least depend on the size of the font, and I think
it should be possible to add more pixels without making the display
unpleasant.

Also, in the case of CJK fonts, we should be able to do that without
any text property put on the text, so we need some (optional)
variable as well.



  reply	other threads:[~2021-11-27  8:35 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 14:45 Variable pitch text filling Lars Ingebrigtsen
2021-11-26 15:04 ` Eli Zaretskii
2021-11-26 15:10   ` Lars Ingebrigtsen
2021-11-26 16:22     ` Eli Zaretskii
2021-11-26 17:03       ` Stefan Monnier
2021-11-27  7:12       ` Lars Ingebrigtsen
2021-11-27  7:43         ` Eli Zaretskii
2021-11-27  8:04           ` Lars Ingebrigtsen
2021-11-27  8:35             ` Eli Zaretskii [this message]
2021-11-27 14:28               ` Lars Ingebrigtsen
2021-11-27 14:55                 ` Eli Zaretskii
2021-11-27 19:36                   ` Eli Zaretskii
2021-11-29 13:50                     ` Lars Ingebrigtsen
2021-11-29 14:02                       ` Eli Zaretskii
2021-11-29 15:09                         ` Lars Ingebrigtsen
2021-11-29 15:20                           ` Eli Zaretskii
2021-11-29 18:44                             ` Lars Ingebrigtsen
2021-12-01  4:35                               ` Lars Ingebrigtsen
2021-12-01  5:31                                 ` Eli Zaretskii
2021-12-01  5:38                                   ` Lars Ingebrigtsen
2021-12-01 12:28                                     ` Eli Zaretskii
2021-12-01 14:33                                       ` Lars Ingebrigtsen
2021-12-01 14:45                                         ` Eli Zaretskii
2021-12-01 15:10                                           ` Lars Ingebrigtsen
2021-12-01 16:42                                             ` Eli Zaretskii
2021-12-01 16:49                                               ` Lars Ingebrigtsen
2021-12-01 16:57                                                 ` Eli Zaretskii
2021-12-01 17:02                                                   ` Lars Ingebrigtsen
2021-12-01 17:22                                                     ` Eli Zaretskii
2021-12-01 17:35                                                       ` Lars Ingebrigtsen
2021-12-01 17:49                                                         ` Eli Zaretskii
2021-12-01 17:52                                                           ` Lars Ingebrigtsen
2021-12-01 17:56                                                             ` Eli Zaretskii
2021-12-01 18:19                                                               ` Lars Ingebrigtsen
2021-12-01 18:47                                                                 ` Eli Zaretskii
2021-12-01 18:52                                                                   ` Lars Ingebrigtsen
2021-12-01 19:15                                                                     ` Eli Zaretskii
2021-12-01 19:23                                                                       ` Lars Ingebrigtsen
2021-12-01 19:29                                                                         ` Eli Zaretskii
2021-12-01 19:34                                                                           ` Lars Ingebrigtsen
2021-12-01 19:58                                                                             ` Eli Zaretskii
2021-12-02  8:15                                                                               ` Lars Ingebrigtsen
2021-12-02  8:46                                                                                 ` Eli Zaretskii
2021-12-02  8:56                                                                                   ` Lars Ingebrigtsen
2021-12-02  9:34                                                                                     ` Eli Zaretskii
2021-12-03 15:43                                                                                       ` Lars Ingebrigtsen
2021-12-02 20:32                                                                                     ` Jim Porter
2021-12-02 21:19                                                                                       ` Stefan Kangas
2021-12-02 22:00                                                                                         ` [External] : " Drew Adams
2021-12-02 22:32                                                                                         ` Jim Porter
2021-12-03  7:08                                                                                           ` Eli Zaretskii
2021-12-03  7:14                                                                                             ` Po Lu
2021-12-03 18:15                                                                                             ` Jim Porter
2021-12-03 18:53                                                                                               ` Stefan Kangas
2021-12-03  0:41                                                                                         ` Po Lu
2021-12-03  6:58                                                                                         ` Eli Zaretskii
2021-12-03 15:45                                                                                         ` Lars Ingebrigtsen
2021-12-01 19:30                                                                 ` Jim Porter
2021-12-02 17:53                                                         ` Eli Zaretskii
2021-12-02 19:03                                                           ` Yuan Fu
2021-12-02 19:38                                                             ` Eli Zaretskii
2021-12-02 20:18                                                             ` Eli Zaretskii
2021-12-03  8:10                                                               ` Eli Zaretskii
2021-12-03  8:17                                                                 ` Feng Shu
2021-12-03 11:31                                                                   ` Eli Zaretskii
2021-12-03 11:55                                                                     ` Feng Shu
2021-12-03 12:23                                                                       ` Eli Zaretskii
2021-12-03  8:51                                                                 ` Feng Shu
2021-12-03 11:35                                                                   ` Eli Zaretskii
2021-12-03 11:44                                                                     ` Feng Shu
2021-12-03 11:52                                                                       ` Eli Zaretskii
2021-12-03 11:47                                                                     ` Feng Shu
2021-12-03 15:41                                                                 ` Lars Ingebrigtsen
2021-12-03 19:38                                                                   ` Eli Zaretskii
2021-12-04  0:35                                                                     ` Po Lu
2021-12-04  7:45                                                                       ` Eli Zaretskii
2021-12-04  5:41                                                                     ` Lars Ingebrigtsen
2021-12-04  8:02                                                                       ` Eli Zaretskii
2021-12-04 19:00                                                                         ` Lars Ingebrigtsen
2021-12-01  5:39                                   ` chad
2021-12-01  6:52                                     ` Eli Zaretskii
2021-12-01  6:59                                       ` Yuri Khan
2021-12-01 18:14                                       ` john muhl
2021-11-29 13:46                   ` Lars Ingebrigtsen
2021-11-29 14:01                     ` Eli Zaretskii
2021-11-29 14:09                       ` Lars Ingebrigtsen
2021-11-29 14:14                         ` Eli Zaretskii
2021-11-29 14:19                           ` Lars Ingebrigtsen
2021-11-29 14:25                             ` Eli Zaretskii
2021-11-29 14:27                               ` Lars Ingebrigtsen
2021-11-29 18:44                         ` Yuan Fu
2021-11-29 19:28                           ` Eli Zaretskii
2021-11-29 20:15                             ` Yuan Fu
2021-11-26 16:47     ` Yuan Fu
2021-12-01 17:07     ` Stefan Kangas
2021-12-01 17:26       ` Eli Zaretskii
2021-11-26 15:08 ` Ihor Radchenko
2021-11-26 15:11   ` Lars Ingebrigtsen
2021-11-30  1:09 ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83a6hq0zey.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).