From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Pixel-based display functions Date: Sat, 07 Feb 2015 02:22:26 +1100 Message-ID: <87k2zvgj4d.fsf@building.gnus.org> References: <837fw3l7uz.fsf@gnu.org> <54CD4B27.4080201@gmx.at> <874mr6qvi5.fsf@building.gnus.org> <87sieqpfxh.fsf@building.gnus.org> <54CDE908.7050908@gmx.at> <87ioflq0dz.fsf@building.gnus.org> <54CE2187.9070003@gmx.at> <83lhkhiq8t.fsf@gnu.org> <54CE54A3.1020707@gmx.at> <838ughilmo.fsf@gnu.org> <54CE6BD2.8000402@gmx.at> <8361bliin0.fsf@gnu.org> <83386piiby.fsf@gnu.org> <87oap9yoti.fsf@building.gnus.org> <874mqzvnwo.fsf@building.gnus.org> <83h9uzeb4a.fsf@gnu.org> <87bnl7jrr7.fsf@building.gnus.org> <831tm3dt8u.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423236287 6115 80.91.229.3 (6 Feb 2015 15:24:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2015 15:24:47 +0000 (UTC) Cc: rudalics@gmx.at, monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 06 16:24:35 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YJklj-0007mX-KM for ged-emacs-devel@m.gmane.org; Fri, 06 Feb 2015 16:24:31 +0100 Original-Received: from localhost ([::1]:48934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJkli-0005lc-VP for ged-emacs-devel@m.gmane.org; Fri, 06 Feb 2015 10:24:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJklU-0005iF-7e for emacs-devel@gnu.org; Fri, 06 Feb 2015 10:24:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJklT-00054b-3P for emacs-devel@gnu.org; Fri, 06 Feb 2015 10:24:16 -0500 Original-Received: from smtp.syd.comcen.com.au ([203.23.236.77]:4535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJklN-0004zy-BI; Fri, 06 Feb 2015 10:24:09 -0500 Original-Received: from building.gnus.org ([27.96.197.126]) by smtp.syd.comcen.com.au (8.13.4/8.12.9) with ESMTP id t16FMVmB054802; Sat, 7 Feb 2015 02:22:32 +1100 (EST) In-Reply-To: <831tm3dt8u.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 06 Feb 2015 16:12:01 +0200") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-comcen-MailScanner-Information: Please contact the ISP for more information X-comcen-MailScanner: Found to be clean X-comcen-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0.119, required 4, AWL 0.03, BAYES_20 -0.01, RDNS_NONE 0.10) X-comcen-MailScanner-From: larsi@gnus.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.23.236.77 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182539 Archived-At: Eli Zaretskii writes: > When you "repeat", do you start from the part of the line that's left, > without the part that is before the just-inserted newline, or from the > original long one? The time it takes vertical-motion to do its job > will be smaller if the line is shorter. I start from the part of the line that's left. > Also, try invoking vertical-motion from a position that is not > immediately after a newline, I think this might speed it up a little > more. Ah, right. > Why do you need to know what width you ended up with? Or maybe I > don't understand "ended up with" when -- before or after > vertical-motion did its job? IOW, do you need window-text-pixel-size > for measuring the long unfilled line, or the lines after filling? I need to measure the lines after filling so that I know how wide the column ended up being. (This is to better use the available horizontal space when rendering tables, which is quite important.) >> It would be equivalent to a `window-text-pixel-size' that advances one >> character at a time (since we'd avoid the entire `font-at' problem), and >> returns an vector of pixel points (instead of calling move_it_to just >> once). > > You are describing an implementation. Please describe the API and the > contract instead. Well, it depends on what's realistic to implement, really. If calling `font-at' had been fast enough, I would have been happy sticking with that, but it turned out not to be. So the API kinda depends on what's feasible... I think the ideal interface for this would be a function that returns a vector of glyph widths in the region, possibly with one vector per line. So (glyph-pixel-widths FROM TO) => ([4 5 10 12] [4 14 1] ...) That would allow caching the computations so that they would only be called once per (unfilled) buffer. > Also, as long as you use these functions, there's still a problem with > visual vs logical order that needs to be solved. Yes. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/