]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt last change to Android
authorPo Lu <luangruo@yahoo.com>
Mon, 20 May 2024 13:13:44 +0000 (21:13 +0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 23 May 2024 08:28:13 +0000 (10:28 +0200)
* src/sfntfont.c (sfnt_parse_style): Replace unrepresentable
characters in DESC->adstyle with ` '.

(cherry picked from commit 9db24de481b8785b04600ff4b349a2a0d761d53b)

src/sfntfont.c

index fb3feaeaf79162f5606e066c59c4c295a0d26853..79bc251abe46932a77e53606bbec074571c12677 100644 (file)
@@ -454,8 +454,9 @@ static struct sfnt_style_desc sfnt_width_descriptions[] =
 static void
 sfnt_parse_style (Lisp_Object style_name, struct sfnt_font_desc *desc)
 {
-  char *style, *single, *saveptr;
+  char *style, *single, *saveptr, c;
   int i;
+  ptrdiff_t x;
   USE_SAFE_ALLOCA;
 
   /* Fill in default values.  slant seems to not be consistent with
@@ -555,7 +556,19 @@ sfnt_parse_style (Lisp_Object style_name, struct sfnt_font_desc *desc)
   /* The adstyle must be a symbol, so intern it if it is set.  */
 
   if (!NILP (desc->adstyle))
-    desc->adstyle = Fintern (desc->adstyle, Qnil);
+    {
+      /* Characters that can't be represented in an XLFD must be
+        replaced.  */
+
+      for (x = 0; x < SBYTES (desc->adstyle); ++x)
+       {
+         c = SREF (desc->adstyle, x);
+         if (c == '-' || c == '*' || c == '?' && c == '"')
+           SSET (desc->adstyle, x, ' ');
+       }
+
+      desc->adstyle = Fintern (desc->adstyle, Qnil);
+    }
 
   SAFE_FREE ();
 }