emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display certain glyphs with paddings on the side


From: Eli Zaretskii
Subject: Re: Display certain glyphs with paddings on the side
Date: Tue, 03 Dec 2019 21:13:23 +0200

> Cc: address@hidden
> From: Clément Pit-Claudel <address@hidden>
> Date: Tue, 3 Dec 2019 13:43:33 -0500
> 
> > No, character composition does nothing to the width of glyphs on
> > display.  We take the width from the glyph metrics reported by the
> > font.
> 
> For the OP's purpose, I think character composition is "enough", in the sense 
> that it can be used to display a glyphs with padding on the sides (as far as 
> I know, composition can't be used to shrink a glyph, however).
> 
> Concretely, I'm think of this:
> 
>   (insert (compose-string "a" 0 1 '(?\s (br . bl) ?\s (bc . bc) ?我)))
> 
> If I'm reading the spec correctly, this should draw the character 我 with 
> padding on both sides to reach the width of two spaces (assuming the choice 
> of fonts is such as 我 is narrower than two spaces to being with).

This isn't really workable in practice.  First, you'd need to do this
for every CJK character, which means redisplay will be much slower for
them (since character composition calls Lisp from the display engine,
and will have to references a huge char-table).  Second, not all CJK
characters need to be padded, and you have no easy way of knowing that
from Lisp, certainly no fast way.  And third, you assume that the
width of the space is identical to the width of other characters,
which may be true for many fonts, but not for all of them.

IOW, as I said in another message, doing layout in Lisp will get you
rotten layout.  It is only "good enough" for simplistic subsets of the
real-life problems, IME.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]