help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs 28: Specific TTF font gets loaded with font-backend x instead


From: Eli Zaretskii
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

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]