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: HTML-Info design Date: Mon, 26 Jan 2015 08:20:42 +0200 Message-ID: <838ugqqczp.fsf@gnu.org> References: <87vbl2xigp.fsf@ferrier.me.uk> <83ioh2nlow.fsf@gnu.org> <87sig6xech.fsf@ferrier.me.uk> <83fvc5ni0u.fsf@gnu.org> <87k31fwwyv.fsf@ferrier.me.uk> <87bnmq9ibf.fsf@ferrier.me.uk> <87lhlrx5fc.fsf@building.gnus.org> <878uhrcr5l.fsf@building.gnus.org> <83sifzjflk.fsf@gnu.org> <87fvbyagaw.fsf@building.gnus.org> <83iogujvbq.fsf@gnu.org> <87tx0ee7rf.fsf@building.gnus.org> <83egricpvg.fsf@gnu.org> <87zj97vic8.fsf@building.gnus.org> <83wq4argjp.fsf@gnu.org> <87iofui8vo.fsf@building.gnus.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1422253287 5784 80.91.229.3 (26 Jan 2015 06:21:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2015 06:21:27 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 26 07:21:26 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 1YFd37-0001OG-DC for ged-emacs-devel@m.gmane.org; Mon, 26 Jan 2015 07:21:25 +0100 Original-Received: from localhost ([::1]:40113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFd36-0004iM-Np for ged-emacs-devel@m.gmane.org; Mon, 26 Jan 2015 01:21:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFd2m-0004gR-2s for emacs-devel@gnu.org; Mon, 26 Jan 2015 01:21:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFd2g-0005Ef-WA for emacs-devel@gnu.org; Mon, 26 Jan 2015 01:21:04 -0500 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:51556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFd2g-0005EZ-NY for emacs-devel@gnu.org; Mon, 26 Jan 2015 01:20:58 -0500 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NIR00L00T79FL00@mtaout24.012.net.il> for emacs-devel@gnu.org; Mon, 26 Jan 2015 08:12:48 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NIR00DACT9CEQ70@mtaout24.012.net.il>; Mon, 26 Jan 2015 08:12:48 +0200 (IST) In-reply-to: <87iofui8vo.fsf@building.gnus.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.180 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:181776 Archived-At: > From: Lars Ingebrigtsen > Cc: emacs-devel@gnu.org > Date: Mon, 26 Jan 2015 13:16:43 +1100 > > (defun pixel-region-width (start end) > (let ((width 0)) > (while (< start end) > (let ((glyphs (font-get-glyphs (font-at start) start start))) > (setq width (+ width (aref (car glyphs) 4)))) > (setq start (1+ start))) > width)) > > But it fails because `font-get-glyphs' always returns nil when I try it. Try this instead: (defun pixel-region-width (start end) (let ((width 0)) (while (< start end) (let ((glyphs (font-get-glyphs (font-at start) start (1+ start)))) (setq width (+ width (aref (car glyphs) 4)))) ;; ^^^^^^^^^^ (setq start (1+ start))) width))