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, 29 Dec 2014 19:44:35 +0200 Message-ID: <83egricpvg.fsf@gnu.org> References: <871tnr1gqo.fsf@ferrier.me.uk> <83bnmvowdb.fsf@gnu.org> <83ppbanqhe.fsf@gnu.org> <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> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1419875110 16634 80.91.229.3 (29 Dec 2014 17:45:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Dec 2014 17:45:10 +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 Dec 29 18:45:03 2014 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 1Y5eNK-0005Y1-N1 for ged-emacs-devel@m.gmane.org; Mon, 29 Dec 2014 18:45:02 +0100 Original-Received: from localhost ([::1]:34267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y5eNJ-0005Eu-Vv for ged-emacs-devel@m.gmane.org; Mon, 29 Dec 2014 12:45:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y5eNC-0005EP-QL for emacs-devel@gnu.org; Mon, 29 Dec 2014 12:44:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y5eN7-0004Z8-RM for emacs-devel@gnu.org; Mon, 29 Dec 2014 12:44:54 -0500 Original-Received: from mtaout25.012.net.il ([80.179.55.181]:34470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y5eN7-0004Z4-Jf for emacs-devel@gnu.org; Mon, 29 Dec 2014 12:44:49 -0500 Original-Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0NHC00800TZ1MM00@mtaout25.012.net.il> for emacs-devel@gnu.org; Mon, 29 Dec 2014 19:40:40 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NHC008PAUFSQW10@mtaout25.012.net.il>; Mon, 29 Dec 2014 19:40:40 +0200 (IST) In-reply-to: <87tx0ee7rf.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.181 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:180853 Archived-At: > From: Lars Ingebrigtsen > Cc: emacs-devel@gnu.org > Date: Mon, 29 Dec 2014 17:32:52 +0100 > > Eli Zaretskii writes: > > > Fortunately, such a capability already exists, I think: see the > > function 'font-get-glyphs'. Does it solve your problem? If not, what > > API would you like to have? > > I've just looked at the doc string of that function briefly, and I'm not > sure how I would use that to do filling. I need to know the width a > text will take in the buffer, so that I know when to break the line and > start a new one. Is it now possible to write a function like > `pixel-region-width' that would say how much space the text will occupy? Either make a string of the text you want to display, or insert that text in a temporary buffer, then use this function to find the width of that text by summing the widths of all the glyphs. Find the largest substring whose glyphs' summary width fits into the portion of the window width you allotted to the left pane, and insert that substring. Loop around. Should work, no? > Given that the font used for that text is variable-width (and the region > possibly uses many fonts). The function returns a vector of glyphs, where each glyph is described using its attributes, including its pixel width. You have font-at function to tell you which font is used to display what buffer/string position. OK?