[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add function window-line-width

From: Eli Zaretskii
Subject: Re: [PATCH] Add function window-line-width
Date: Fri, 08 Nov 2019 15:18:06 +0200

> From: martin rudalics <address@hidden>
> Date: Fri, 8 Nov 2019 10:21:45 +0100
> Cc: address@hidden
>  > The first point is important for my use case, so if 'window-line-width' is
>  > not accepted, would you agree for a patch
>  > adding a parameter to 'window-lines-pixel-dimensions' controlling this
>  > behavior ?
> I certainly would but it's up to Eli to decide.

If window-text-pixel-size fits the bill, I don't see why we need
another function or a new argument to window-lines-pixel-dimensions.

>  > 'window-text-pixel-size' uses a display iterator to compute values, I don't
>  > know the details of this iterator but it seems to
>  > be slower than fetching values directly from the glyph matrix. As
>  > mentioned, I need the width of all lines on window.
> It would be good to know how much slower 'window-text-pixel-size' then
> is.  If it is significantly slower, we probably should replace it with
> a function based on directly accessing the glyph matrix.  Can you try
> to measure the respective performances?

I would be very surprised to learn that it's significantly slower.  Do
you need to invoke this function in a tight loop or something?  If
not, a single invocation, even if slower, won't matter much.

In general, functions that use only the glyph matrices have a
significant disadvantage in that they will fail when display is not up
to date, something that can happen out of control of a Lisp program
that calls the function.  So I very much prefer window-text-pixel-size
to an alternative that uses the glyph matrices.  If we find that using
the glyph matrices is much faster, then I'd prefer to fix
window-text-pixel-size to use the glyph matrices when possible, and
otherwise fall back to its current method.  See move-point-visually
for one example of how this can be done.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]