From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: font-backend mechanism on Windows and Mac? Date: Sat, 15 Sep 2007 10:31:06 +0900 Message-ID: References: <46E4F571.3030101@gnu.org> <46E54A83.2070702@gnu.org> <46E54B7B.3070104@gnu.org> <46E93E1C.3030808@gnu.org> <46EA9371.7020701@gnu.org> <55f7df060709141610n2d632435o2d583a703954e2e4@mail.gmail.com> <46EB1FB5.40603@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1189819889 18150 80.91.229.12 (15 Sep 2007 01:31:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 15 Sep 2007 01:31:29 +0000 (UTC) Cc: adrian.b.robert@gmail.com, emacs-devel@gnu.org To: Jason Rumney Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 15 03:31:26 2007 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.50) id 1IWMVK-0000we-5k for ged-emacs-devel@m.gmane.org; Sat, 15 Sep 2007 03:31:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IWMVJ-0004SU-4j for ged-emacs-devel@m.gmane.org; Fri, 14 Sep 2007 21:31:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IWMVF-0004Ph-24 for emacs-devel@gnu.org; Fri, 14 Sep 2007 21:31:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IWMVD-0004PL-Kp for emacs-devel@gnu.org; Fri, 14 Sep 2007 21:31:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IWMVD-0004PI-Fe for emacs-devel@gnu.org; Fri, 14 Sep 2007 21:31:19 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IWMV7-0007LU-FU; Fri, 14 Sep 2007 21:31:14 -0400 Original-Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id l8F1V7Me004651; Sat, 15 Sep 2007 10:31:07 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp2.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id l8F1V7Hr019079; Sat, 15 Sep 2007 10:31:07 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp2.aist.go.jp with ESMTP id l8F1V69X010605; Sat, 15 Sep 2007 10:31:06 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.67) (envelope-from ) id 1IWMV0-00044z-4I; Sat, 15 Sep 2007 10:31:06 +0900 In-reply-to: <46EB1FB5.40603@gnu.org> (message from Jason Rumney on Sat, 15 Sep 2007 00:56:37 +0100) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-Detected-Kernel: Solaris 8 (1) 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:78929 Archived-At: In article <46EB1FB5.40603@gnu.org>, Jason Rumney writes: > Adrian Robert wrote: > > Another possibility is the metrics implementation. In text_extents() > > the W32 and Xft impls query the font itself for the metrics every > > time. With Xft this may be fast if the font is client-side (and it > > does it for the whole string, not each char), but possibly under > > Windows it is not. In Cocoa nsfont.m metrics are cached in blocks of > > 256 chars to deal with this. > This might make a difference, the old Windows code used to cache the > metrics of ASCII characters for each font. > > font.c. (But drivers _should_ do a full-string determination like > > xftfont.c does if they can, so they wouldn't need it.) > > > I think the lack of comments for the font backend has led us to > implement this incorrectly. Which part of comment do you mean? > Actually, when text_extents is called with a metrics argument, nglyphs > is always 1, so there is no need to loop over all the characters, and > there is only one metric to fill in, not an array of them. In most cases, text_extents is called for one glyph by one. That is because the original display engine calls x_produce_glyphs for one character by one. To improve it, we will need a very big change in the core part of the display engine. But, x_compute_glyph_string_overhangs will call text_extents with multiple glyphs. > In the case > where metrics is NULL, the Windows version does do a full string > determination, but it has to convert the unsigned array of characters to > a short array for the Windows API functions. ??? text_extents should always be called with non-NULL metrics arg. --- Kenichi Handa handa@m17n.org