From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.devel Subject: Re: font-backend mechanism on Windows and Mac? Date: Sat, 15 Sep 2007 00:56:37 +0100 Message-ID: <46EB1FB5.40603@gnu.org> 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1189814238 6904 80.91.229.12 (14 Sep 2007 23:57:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 14 Sep 2007 23:57:18 +0000 (UTC) Cc: emacs-devel@gnu.org, Kenichi Handa To: Adrian Robert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 15 01:57:15 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 1IWL2A-0001pv-Qm for ged-emacs-devel@m.gmane.org; Sat, 15 Sep 2007 01:57:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IWL2A-000245-2L for ged-emacs-devel@m.gmane.org; Fri, 14 Sep 2007 19:57:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IWL26-00023d-Cj for emacs-devel@gnu.org; Fri, 14 Sep 2007 19:57:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IWL25-00023O-4T for emacs-devel@gnu.org; Fri, 14 Sep 2007 19:57:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IWL24-00023F-Uk for emacs-devel@gnu.org; Fri, 14 Sep 2007 19:57:08 -0400 Original-Received: from outmail1.freedom2surf.net ([194.106.33.237]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IWL24-0002eH-FU for emacs-devel@gnu.org; Fri, 14 Sep 2007 19:57:08 -0400 Original-Received: from [127.0.0.1] (i-83-67-23-108.freedom2surf.net [83.67.23.108]) by outmail1.freedom2surf.net (Postfix) with ESMTP id 46925508AA; Sat, 15 Sep 2007 00:57:07 +0100 (BST) User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) In-Reply-To: <55f7df060709141610n2d632435o2d583a703954e2e4@mail.gmail.com> X-Detected-Kernel: Linux 2.4-2.6 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:78923 Archived-At: 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. 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 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.