[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: prettify-symbols-mode, derived modes, and compose-region
From: |
Eli Zaretskii |
Subject: |
Re: prettify-symbols-mode, derived modes, and compose-region |
Date: |
Sat, 06 Mar 2021 11:15:11 +0200 |
> From: D <d.williams@posteo.net>
> Cc: emacs-devel@gnu.org
> Date: Fri, 5 Mar 2021 22:24:44 +0100
>
> > And that's even before you consider
> > complex text shaping which could combine several codepoints into a
> > single wide grapheme cluster.
>
> I don't think that using a character capable of that would be of any
> use as a decorative element.
I was talking about the need to align the "decorative elements" with
text that includes such grapheme clusters.
> > 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.
>
> That would of course be the perfect solution. But, doesn't this have
> to exist in one way or another already? For example, the checkbox
> widget in custom interfaces to my knowledge visually replaces a simple
> "[X]" with a bitmap. When I examine a checkbox with C-u C-x = it
> seems to be the case that display does the legwork and somehow obtains
> the image size from the xpm file (I suppose).
In your original use case you didn't have images, you had characters.
Or did I misunderstand?
> Same with superstar, essentially. For example, every decorative
> bullet can have a "fallback character" for terminal displays, and this
> behaves correctly from the perspective of the frame you opened the
> buffer with. I include a simple redisplay command for emacsclient
> users for this reason. So I suppose I operate under the same
> limitations as shr?
Yes, I think so. And on text terminals this issue is moot anyway,
because every character takes a single column (if you forget about
those rare ones that take 2).
> In that case, I probably should look into that character size
> function. Could you point me in the right general direction? I'm not
> quite sure how to find it.
shr-fill-line, I guess.
You can also try using font-get-glyphs, it might be more suitable for
your needs. I think shr.el doesn't use it because that turned out to
be slower than the current approach, but your use case is different.
- Re: prettify-symbols-mode, derived modes, and compose-region, (continued)
- Re: prettify-symbols-mode, derived modes, and compose-region, Eli Zaretskii, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region, Stefan Monnier, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region, Eli Zaretskii, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region, Stefan Monnier, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region, Lars Ingebrigtsen, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region, Eli Zaretskii, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region, Clément Pit-Claudel, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region, D, 2021/03/05
- Re: prettify-symbols-mode, derived modes, and compose-region,
Eli Zaretskii <=
- Re: prettify-symbols-mode, derived modes, and compose-region, D, 2021/03/06
- Re: prettify-symbols-mode, derived modes, and compose-region, Eli Zaretskii, 2021/03/06