From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25945: Emacs aborts while calling FT_Load_Glyph Date: Fri, 03 Mar 2017 10:08:42 +0200 Message-ID: <83bmtin5o5.fsf@gnu.org> References: <20170303.080429.592950574985497052.wl@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1488528618 25762 195.159.176.226 (3 Mar 2017 08:10:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2017 08:10:18 +0000 (UTC) Cc: 25945@debbugs.gnu.org To: Werner LEMBERG , Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 03 09:10:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjiHv-0005ga-Hr for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Mar 2017 09:10:07 +0100 Original-Received: from localhost ([::1]:56650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjiHz-0007VL-Uc for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Mar 2017 03:10:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjiHu-0007Tk-Fo for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 03:10:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjiHr-0004tN-BF for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 03:10:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39133) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjiHr-0004tJ-7a for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 03:10:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cjiHq-0004L0-Bh for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2017 03:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Mar 2017 08:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25945 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25945-submit@debbugs.gnu.org id=B25945.148852856116613 (code B ref 25945); Fri, 03 Mar 2017 08:10:02 +0000 Original-Received: (at 25945) by debbugs.gnu.org; 3 Mar 2017 08:09:21 +0000 Original-Received: from localhost ([127.0.0.1]:37332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjiHA-0004Jt-Vv for submit@debbugs.gnu.org; Fri, 03 Mar 2017 03:09:21 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46943) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjiH9-0004Jg-1g for 25945@debbugs.gnu.org; Fri, 03 Mar 2017 03:09:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjiH0-0004V7-RW for 25945@debbugs.gnu.org; Fri, 03 Mar 2017 03:09:13 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjiGq-0004Tg-L7; Fri, 03 Mar 2017 03:09:00 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2484 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cjiGp-0006IJ-Cc; Fri, 03 Mar 2017 03:09:00 -0500 In-reply-to: <20170303.080429.592950574985497052.wl@gnu.org> (message from Werner LEMBERG on Fri, 03 Mar 2017 08:04:29 +0100 (CET)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130087 Archived-At: > Date: Fri, 03 Mar 2017 08:04:29 +0100 (CET) > From: Werner LEMBERG > > For me, Emacs aborts at ftfont.c:1550 while `mew' tries to display an > e-mail. > > 1549 if (FT_Load_Glyph (ft_face, g->g.code, FT_LOAD_DEFAULT) != 0) > 1550 emacs_abort (); > > Examining `ft_face' and `g->g.code' I see that the font in question is > `Padauk Book Bold' (PadaukBook-Bold.ttf), glyph 376. Examining this > font further with `ftview' I see that bytecode of this font is broken, > and that the font can only be displayed successfully without bytecode. > [This is version 3.002 of the font, taken from the current TeXLive > repository.] > > I think there is no reason that Emacs aborts for such broken fonts. > Instead I suggest that (a) Emacs tries to load the glyph again without > hinting, and (b) if that fails, it should display a missing glyph, > using the standard rectangle with hex digits in it. > > New code for (a) is quite simple: > > if (FT_Load_Glyph (ft_face, g->g.code, FT_LOAD_DEFAULT) != 0) > if (FT_Load_Glyph (ft_face, g->g.code, FT_LOAD_NO_HINTING) != 0) > ... This should probably be accompanied by a suitable FONT_ADD_LOG call, to mention that this fallback was taken. > [The code might be further improved by implementing a per-font glyph > load mode, to be initialized with `FT_LOAD_DEFAULT'. If, say, 100 > calls using `FT_LOAD_DEFAULT' for a given font fails, and > `FT_LOAD_NO_HINTING' is successful, the default loading behaviour for > this font could be switched to `FT_LOAD_NO_HINTING'. Given that such > broken fonts are rare my suggestion is probably overkill, however.] > > My knowledge of Emacs internals is too small to provide an > implementation for (b). I think it's too late for (b) when we discover this problem in ftfont_get_metrics. To do (b) we should have discovered this in ftfont_has_char, or thereabouts. I'm CC'ing Handa-san in the hope that he will have insights and comments on this. Thanks.