From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Naohiro Aota Newsgroups: gmane.emacs.devel Subject: [PATCH] Emacs should check font width also when spacing is dual Date: Wed, 17 Jun 2009 23:56:39 +0900 Message-ID: <87skhyzz6g.fsf@yue.localnetwork> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1245258494 29597 80.91.229.12 (17 Jun 2009 17:08:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2009 17:08:14 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 17 19:08:12 2009 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 1MGycK-00033z-Ja for ged-emacs-devel@m.gmane.org; Wed, 17 Jun 2009 19:08:08 +0200 Original-Received: from localhost ([127.0.0.1]:37656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGycK-0003Wm-0I for ged-emacs-devel@m.gmane.org; Wed, 17 Jun 2009 13:08:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGwZI-0006AD-2n for emacs-devel@gnu.org; Wed, 17 Jun 2009 10:56:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGwZG-0006A1-W2 for emacs-devel@gnu.org; Wed, 17 Jun 2009 10:56:51 -0400 Original-Received: from [199.232.76.173] (port=60513 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGwZG-00069y-QJ for emacs-devel@gnu.org; Wed, 17 Jun 2009 10:56:50 -0400 Original-Received: from s318.xrea.com ([125.53.25.46]:37226) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MGwZG-00054S-0u for emacs-devel@gnu.org; Wed, 17 Jun 2009 10:56:50 -0400 Original-Received: (qmail 1626 invoked by uid 89); 17 Jun 2009 23:56:41 +0900 Original-Received: from zaq3a55f27d.zaq.ne.jp (HELO yue.localnetwork) (naota@elisp.net@58.85.242.125) by 192.168.1.46 with SMTP; 17 Jun 2009 23:56:41 +0900 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.94 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Wed, 17 Jun 2009 12:58:21 -0400 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:111557 Archived-At: Hi, I found that emacs check character width one by one to calculate font->min_width, font->average_width, font->space_width only when `spacing' is not FC_PROPORTIONAL. But fontconfig's doc (1) says "FC_DUAL, where the font has glyphs in precisely two widths, one twice as wide as the other". So emacs should check them one by one also when spacing is dual. Current behavior causes tab width to be doubled and so indent to be strange. To solve this, I suggest a tiny patch below. 2009-06-17 Naohiro Aota * xftfont.c (xftfont_open): Check font width one by one also when spacing is dual. * ftfont.c (ftfont_open): Ditto. --8<---------------cut here---------------start------------->8--- --- src/ftfont.c 17 Apr 2009 18:38:02 -0000 1.54 +++ src/ftfont.c 17 Jun 2009 14:51:37 -0000 @@ -1244,7 +1244,7 @@ spacing = XINT (AREF (entity, FONT_SPACING_INDEX)); else spacing = FC_PROPORTIONAL; - if (spacing != FC_PROPORTIONAL) + if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL) font->min_width = font->average_width = font->space_width = (scalable ? ft_face->max_advance_width * size / upEM : ft_face->size->metrics.max_advance >> 6); --- src/xftfont.c 11 May 2009 09:29:49 -0000 1.24 +++ src/xftfont.c 17 Jun 2009 14:51:37 -0000 @@ -333,7 +333,7 @@ ascii_printable[i] = ' ' + i; } BLOCK_INPUT; - if (spacing != FC_PROPORTIONAL) + if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL) { font->min_width = font->average_width = font->space_width = xftfont->max_advance_width; --8<---------------cut here---------------end--------------->8--- (1) http://fontconfig.org/fontconfig-devel/r1283.html Regards,