emacs-devel
[Top][All Lists]
Advanced

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

Re: Pixel-based display functions


From: Lars Ingebrigtsen
Subject: Re: Pixel-based display functions
Date: Fri, 06 Feb 2015 20:58:23 +1100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

martin rudalics <address@hidden> writes:

> We can do that.  But it's hardly cheaper than
>
> (save-window-excursion
>   (set-window-buffer nil ...)
>   (window-text-pixel-size ...)
>   ...)
>
> especially when packing multiple `window-text-pixel-size' calls into
> the same excursion.

Ok; I can try doing that and see what the results are.

Another possible interface function just occurred to me, though.  :-)
(Many ways to skin a ... fill...)

I haven't looked closely at the code, but I think in all (or most)
instances where I need to know the pixel width I ended up with in a
column, what I really need to know is the width of the longest line.

So a `window-text-pixel-width' function that loops over all the lines in
the specified region, and return the maximum width, might be what I
really need here.  Hm...  Yeah, I think that might be a fast and handy
function?

It doesn't really solve the problem of `vertical-motion' being too slow,
really, when finding fill points in large HTML documents.

Hm...  so many approaches...

Hm.  A `window-text-glyphs-pixel-widths' that returns all the pixel
widths for all the glyphs in the region, segmented by line?  That would
avoid calling `vertical-motion' at all, but may not be any faster than
calling `vertical-motion'.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



reply via email to

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