From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048). Date: Wed, 02 Mar 2011 20:51:08 +0200 Message-ID: <834o7lxso3.fsf@gnu.org> References: <4D6B6AA4.8090008@gmx.at> <4D6BD6EA.4010000@gmx.at> <87mxlg57hs.fsf@stupidchicken.com> <83wrkklzcd.fsf@gnu.org> <87ipw4aq3x.fsf@stupidchicken.com> <8762s32854.fsf@gnu.org> <87ipw3ik43.fsf@stupidchicken.com> <83vd02y8qq.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1299092015 8269 80.91.229.12 (2 Mar 2011 18:53:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 2 Mar 2011 18:53:35 +0000 (UTC) Cc: cyd@stupidchicken.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 02 19:53:31 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PurAw-0003V6-4u for ged-emacs-devel@m.gmane.org; Wed, 02 Mar 2011 19:53:30 +0100 Original-Received: from localhost ([127.0.0.1]:60264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PurAv-0004oR-Kk for ged-emacs-devel@m.gmane.org; Wed, 02 Mar 2011 13:53:29 -0500 Original-Received: from [140.186.70.92] (port=47175 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PurAk-0004l3-TA for emacs-devel@gnu.org; Wed, 02 Mar 2011 13:53:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PurAh-00058E-1M for emacs-devel@gnu.org; Wed, 02 Mar 2011 13:53:18 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:59564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PurAg-00057y-NB for emacs-devel@gnu.org; Wed, 02 Mar 2011 13:53:14 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LHG009001OFA200@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Wed, 02 Mar 2011 20:53:12 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.183.216]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LHG008HD1SMPJ90@a-mtaout20.012.net.il>; Wed, 02 Mar 2011 20:53:12 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136725 Archived-At: > From: Stefan Monnier > Cc: cyd@stupidchicken.com, emacs-devel@gnu.org > Date: Wed, 02 Mar 2011 12:03:18 -0500 > > > Would it help to have a primitive that returns the width in pixels > > that a given buffer substring would take on the screen? > > Not if we want it to work without knowing the window (and hence > terminal) on which the buffer is going to be displayed (i.e. the > computation should be done by the redisplay, the buffer data needs to be > agnostic to the font used). Sorry, I'm not following. On a TTY, each character is a single pixel and all characters have the same width. So calculating this for a TTY display is trivial. On a GUI display, the calculation cannot be easily done in Lisp, without actually displaying the text, but should be fairly easy to implement in C, using the move_it_* family of functions; they are already used internally by redisplay, precisely for these purposes: to traverse glyphs generated for display without actually displaying them. Font information (and everything else that is pertinent to displaying text) is already present in the buffer and the associated data structures (faces, text properties, overlays, etc.). What the window's got to do with this, I'm unclear; perhaps I'm missing something.