all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <834kw1e57j.fsf@gnu.org> (raw)
In-Reply-To: <835zghe63z.fsf@gnu.org> (message from Eli Zaretskii on Sat, 08 Feb 2020 12:16:48 +0200)

> Date: Sat, 08 Feb 2020 12:16:48 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > > Thread 1 "emacs" hit Breakpoint 4, Fcomposition_get_gstring (
> > >     from=<optimized out>, to=<optimized out>, 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
> > #<font-object "-JB  -JetBrains Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1">
> > 
> > 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);
     }
 



  reply	other threads:[~2020-02-08 10:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 11:12 Emacs 28: Specific TTF font gets loaded with font-backend x instead of ftcrhb Tassilo Horn
2020-02-04 12:15 ` Robert Pluim
2020-02-04 12:25   ` Robert Pluim
2020-02-04 12:58     ` Tassilo Horn
2020-02-04 13:54       ` Robert Pluim
2020-02-04 14:21         ` Tassilo Horn
2020-02-04 16:26           ` Robert Pluim
2020-02-04 18:32             ` Tassilo Horn
2020-02-04 20:11               ` Robert Pluim
2020-02-05 16:51                 ` Tassilo Horn
2020-02-04 15:31     ` Eli Zaretskii
2020-02-04 18:43       ` Tassilo Horn
2020-02-04 19:08         ` Eli Zaretskii
2020-02-05 16:44           ` Tassilo Horn
2020-02-05 17:04             ` Eli Zaretskii
2020-02-06  7:12               ` Tassilo Horn
2020-02-06 18:15                 ` Eli Zaretskii
2020-02-07  9:21                   ` Tassilo Horn
     [not found]                   ` <b271f1084b17a53ee1583d1f8cd92e9ed21cf360.camel@gnu.org>
2020-02-07  9:48                     ` Eli Zaretskii
2020-02-07 10:41                       ` Tassilo Horn
2020-02-07 13:28                         ` Eli Zaretskii
2020-02-08  9:39                           ` Tassilo Horn
2020-02-08  9:52                             ` Tassilo Horn
2020-02-08 10:16                               ` Eli Zaretskii
2020-02-08 10:36                                 ` Eli Zaretskii [this message]
2020-02-08 12:29                                   ` Tassilo Horn
2020-02-08 13:50                                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834kw1e57j.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.