[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable pitch text filling
From: |
Eli Zaretskii |
Subject: |
Re: Variable pitch text filling |
Date: |
Sat, 27 Nov 2021 10:35:01 +0200 |
> 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.
- Variable pitch text filling, Lars Ingebrigtsen, 2021/11/26
- Re: Variable pitch text filling, Eli Zaretskii, 2021/11/26
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/26
- Re: Variable pitch text filling, Eli Zaretskii, 2021/11/26
- Re: Variable pitch text filling, Stefan Monnier, 2021/11/26
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/27
- Re: Variable pitch text filling, Eli Zaretskii, 2021/11/27
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/27
- Re: Variable pitch text filling,
Eli Zaretskii <=
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/27
- Re: Variable pitch text filling, Eli Zaretskii, 2021/11/27
- Re: Variable pitch text filling, Eli Zaretskii, 2021/11/27
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/29
- Re: Variable pitch text filling, Eli Zaretskii, 2021/11/29
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/29
- Re: Variable pitch text filling, Eli Zaretskii, 2021/11/29
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/29
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/30
- Re: Variable pitch text filling, Lars Ingebrigtsen, 2021/11/29