unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: D <d.williams@posteo.net>
Cc: emacs-devel@gnu.org
Subject: Re: prettify-symbols-mode, derived modes, and compose-region
Date: Fri, 05 Mar 2021 09:08:35 +0200	[thread overview]
Message-ID: <83eeguyt58.fsf@gnu.org> (raw)
In-Reply-To: <587ee071-985b-450a-2df7-0b4bb0f97b48@posteo.net> (message from D on Fri, 5 Mar 2021 01:22:30 +0100)

> Cc: emacs-devel@gnu.org
> From: D <d.williams@posteo.net>
> Date: Fri, 5 Mar 2021 01:22:30 +0100
> 
> The data structure org-superstar-todo-bullet-alist associates a todo
> keyword with a character to be displayed.  The image shows the alignment
> problem.  The compose-region solution to this is simply to compose each
> character with a wide enough space, so the user simply has to use
> "\N{EM SPACE}<character>" instead of ?<character> in the alist.
> compose-region will then just superimpose the two and you get a "padded"
> character.

But how do you know that no character associated with a todo keyword
could ever be wider than the EM SPACE in the same font?  That's
entirely up to the font designer.  And that's even before you consider
complex text shaping which could combine several codepoints into a
single wide grapheme cluster.

IOW, I think this solution is fragile.

Anyway, I think it should be very easy to add a new display property
type that would override the pixel width of a font glyph with a fixed
value calculated in some way by a Lisp program.

> On a side note: Are there any quirks I should be aware of when
> transitioning to the display property? I doubt there will be any
> difference in terms of performance (contrast overlays, which my mode
> can't afford use), but is there anything else I should be aware of?  I'm
> asking in case there have been efforts like mine in the past which I am
> not aware of.

This question is too general, and the only answer I can give to such a
question is YES.  I suggest to try that and bring up any issues you
have, then we could talk specifically about those issues.



  parent reply	other threads:[~2021-03-05  7:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 21:33 prettify-symbols-mode, derived modes, and compose-region D
2021-03-04 21:54 ` Eli Zaretskii
2021-03-05  0:22   ` D
2021-03-05  2:30     ` Stefan Monnier
2021-03-05  3:20       ` Stefan Kangas
2021-03-05  7:25         ` Eli Zaretskii
2021-03-05  7:18       ` Eli Zaretskii
2021-03-05 15:14         ` Stefan Monnier
2021-03-05 15:20           ` Eli Zaretskii
2021-03-05 15:51             ` Stefan Monnier
2021-03-05 15:57               ` Lars Ingebrigtsen
2021-03-05  7:08     ` Eli Zaretskii [this message]
2021-03-05 14:05       ` Clément Pit-Claudel
2021-03-05 21:24       ` D
2021-03-06  9:15         ` Eli Zaretskii
2021-03-06 10:43           ` D
2021-03-06 10:59             ` Eli Zaretskii

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=83eeguyt58.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=d.williams@posteo.net \
    --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 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).