> The 'point-max' fix could be improved: Since 'window-text-pixel-size'
> has to make the buffer shown in WINDOW current before processing its
> text anyway, it would IMO be more efficient to wrap the entire
> 'window-text-pixel-size' call into a
>
> (with-current-buffer (window-buffer window)
>
> form and thus avoid selecting WINDOW while providing the right buffer
> for 'window-text-pixel-size' right away.  Can you try that?
>

I think the (point-max) is unnecessary here actually. According to the docstring for window-text-pixel-size, nil should work here, no?

> Finally, the (frame-pixel-width) argument looks fishy too - it should
> probably be (frame-pixel-width (window-frame window)).  Can you verify
> that as well?

Yes, I made that change and the previous one in the patch attached. Both work with my test case. 

Thanks,
Justin