GNU bug report logs -
#47712
27.1; Provide `string-display-width` function, which takes properties into account, `substring-width`
Previous Next
Reported by: Daniel Mendler <mail <at> daniel-mendler.de>
Date: Sun, 11 Apr 2021 21:17:02 UTC
Severity: normal
Found in version 27.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 47712 <at> debbugs.gnu.org (full text, mbox):
On 4/12/21 10:53 AM, Lars Ingebrigtsen wrote:
> I can see how that may be useful in some cases (and is very different
> from `window-text-pixel-size'), so I think adding something like that
> would be nice. But the name is confusing -- it sounds like it's
> computing the displayed width, and it's not -- if there's images or text
> with a different font in there, it's not taken into account?
Yes, a better name could be `string-property-width`? I proposed
`string-display-width` since it takes the 'display property into
account, but maybe this gives false associations.
Note that I would like to have an implementation of
`substring-width`/`string-display-width`/`substring-display-width` which
does not allocate, since this reduces the GC pressure when formatting
many items. How do you think about this?
Regarding images, different fonts, maybe a `string-property-pixel-width`
would be useful too. But for the use cases I have in mind (formatting
monospaced text) computing columns is sufficient.
This bug report was last modified 4 years and 38 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.