all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Display certain glyphs with paddings on the side
Date: Tue, 03 Dec 2019 21:13:23 +0200	[thread overview]
Message-ID: <83a789jk8c.fsf@gnu.org> (raw)
In-Reply-To: <edf6799f-fb48-5097-02b8-78f724691cf2@gmail.com> (message from Clément Pit-Claudel on Tue, 3 Dec 2019 13:43:33 -0500)

> Cc: emacs-devel@gnu.org
> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> 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	other threads:[~2019-12-03 19:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-30 19:51 Display certain glyphs with paddings on the side Yuan Fu
2019-12-02 16:24 ` Eli Zaretskii
2019-12-03  4:56   ` Richard Stallman
2019-12-03 15:43     ` Eli Zaretskii
2019-12-03 15:49       ` Yuan Fu
2019-12-03 16:42   ` Clément Pit-Claudel
2019-12-03 17:38     ` Eli Zaretskii
2019-12-03 18:36       ` Yuri Khan
2019-12-03 18:42         ` Eli Zaretskii
2019-12-03 18:43       ` Clément Pit-Claudel
2019-12-03 19:13         ` Eli Zaretskii [this message]
2019-12-03 20:00           ` Clément Pit-Claudel
2019-12-04  1:22             ` Yuan Fu
2019-12-04  3:41             ` Eli Zaretskii
2019-12-02 18:34 ` 황병희
2019-12-03 15:51   ` Yuan Fu
2019-12-03 22:33     ` 황병희

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=83a789jk8c.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.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 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.