From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Emacs 28: Specific TTF font gets loaded with font-backend x instead of ftcrhb Date: Sat, 08 Feb 2020 12:36:16 +0200 Message-ID: <834kw1e57j.fsf@gnu.org> References: <87pneu1u9e.fsf@gnu.org> <83mu9ygyi7.fsf@gnu.org> <87imkmi46d.fsf@gnu.org> <83eevagoh8.fsf@gnu.org> <878slh0yr8.fsf@gnu.org> <83y2thezjq.fsf@gnu.org> <87v9okyyt5.fsf@gnu.org> <83pnerfuq1.fsf@gnu.org> <835zgig231.fsf@gnu.org> <87lfpe65my.fsf@gnu.org> <83y2teedbh.fsf@gnu.org> <87v9oh8lkl.fsf@gnu.org> <87r1z58kz6.fsf@gnu.org> <835zghe63z.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="55544"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 08 11:37:00 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j0NTv-000ELL-N2 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 Feb 2020 11:36:59 +0100 Original-Received: from localhost ([::1]:39810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0NTu-0006cw-Oq for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 Feb 2020 05:36:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44333) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0NTY-0006co-N0 for help-gnu-emacs@gnu.org; Sat, 08 Feb 2020 05:36:37 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j0NTY-00038x-HU for help-gnu-emacs@gnu.org; Sat, 08 Feb 2020 05:36:36 -0500 Original-Received: from [176.228.60.248] (port=2982 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1j0NTX-0005Qt-Sv for help-gnu-emacs@gnu.org; Sat, 08 Feb 2020 05:36:36 -0500 In-reply-to: <835zghe63z.fsf@gnu.org> (message from Eli Zaretskii on Sat, 08 Feb 2020 12:16:48 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122373 Archived-At: > Date: Sat, 08 Feb 2020 12:16:48 +0200 > From: Eli Zaretskii > > > > Thread 1 "emacs" hit Breakpoint 4, Fcomposition_get_gstring ( > > > from=, to=, font_object=XIL(0x5555562346e5), > > > string=XIL(0x555556a34ec4)) at composite.c:1749 > > > 1749 error ("Attempt to shape unibyte text"); > > > > Oh, of course I've forgotten the most obvious part, i.e., frame 0: > > > > (gdb) pp string > > "--" > > (gdb) pp font_object > > # > > > > And indeed, the mode-line in a Gnus Summary buffer starts with "U:---". > > We should not signal this error when the unibyte string is > pure-ASCII. Let me think of a solution. Does the below help? If it does, you should see the "--" in the mode line replaced with the ligature (whether this is the desired behavior is another question). diff --git a/src/composite.c b/src/composite.c index 53e6930..05365cf 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1746,7 +1746,18 @@ Otherwise (for terminal display), FONT-OBJECT must be a terminal ID, a CHECK_STRING (string); validate_subarray (string, from, to, SCHARS (string), &frompos, &topos); if (! STRING_MULTIBYTE (string)) - error ("Attempt to shape unibyte text"); + { + ptrdiff_t i; + + for (i = SBYTES (string) - 1; i >= 0; i--) + if (!ASCII_CHAR_P (SREF (string, i))) + error ("Attempt to shape unibyte text"); + /* STRING is a pure-ASCII string, so we can convert it (or, + rather, its copy) to multibyte and use that thereafter. */ + Lisp_Object string_copy = Fconcat (1, &string); + STRING_SET_MULTIBYTE (string_copy); + string = string_copy; + } frombyte = string_char_to_byte (string, frompos); }