mastodon-alt icon indicating copy to clipboard operation
mastodon-alt copied to clipboard

Compute right-aligned status indicators not in characters, but pixels?

Open DivineDominion opened this issue 2 years ago • 4 comments

The proposed look and feel is great! 👍

I have display issues with the statuses, though: This depends on the font being used, I guess, but not all emoji are of the same width. Some take up 2 characters. This doesn't gel well with right-aligning, though, in some circumstances like this one:

image

image

I believe once we calculate the width of the string with the faces applied, we could use :align-to (- right (??? . px))), i.e. specify the unit in pixels instead of characters: https://www.gnu.org/software/emacs/manual/html_node/elisp/Pixel-Specification.html

I also found that mastodon-alt-tl-show-status is not used at all a.t.m. so I couldn't toggle the statuses off completely. I'm adding a PR in a second.

DivineDominion avatar Jan 10 '23 08:01 DivineDominion

Oh that would be great if you can fix it. I'm using the nerd font that guarantee glyhp to be one character wide but I noticed the problem with emojis. How do you get the string width in pixels though?

rougier avatar Jan 10 '23 09:01 rougier

How do you get the string width in pixels though?

I have no clue, yet. :) Will be asking around!

https://www.gnu.org/software/emacs/manual/html_node/elisp/Size-of-Displayed-Text.html

DivineDominion avatar Jan 10 '23 09:01 DivineDominion

This looks promising: https://github.com/emacs-mirror/emacs/blob/master/lisp/emacs-lisp/subr-x.el#L318

No time to try until later today, though.

DivineDominion avatar Jan 10 '23 09:01 DivineDominion

@rougier Thank you for the wonderful theme!

@DivineDominion Did you manage to fix this?

I would have loved to do this, but I don't know how to go about doing this.

bmp avatar Feb 01 '23 17:02 bmp