You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

59 lines
1.9 KiB

From 1c66f1de86cd3cd360cf3c8de371126a9e1e9fc9 Mon Sep 17 00:00:00 2001
From: XScreenSaver owners <xscreensaver-owner@fedoraproject.org>
Date: Mon, 3 May 2021 21:33:26 +0900
Subject: [PATCH] fontglide.c: pick_font_1 exclude substitution rectagle glyph
Currently (with using XFT) pick_font_1 picks up one font randomly
from all installed fonts, according to XftListFonts.
So when some non-latin fonts are installed and selected by pick_font_1,
(e.g. Lohit-Gujarati.ttf: used for Gujarati language, part of India)
such font may fail to show strings returned by xscreensaver-text
correctly, and may show substitusion rectagle glyph.
So to select a font which can show glyph properly, use XftCharExists
(ref: blank_character_p in texfont.c)
Also, to show debug message correctly with /* DEBUG */ defined,
copy name2 to pattern.
---
hacks/fontglide.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hacks/fontglide.c b/hacks/fontglide.c
index 3eff604..be1ac63 100644
--- a/hacks/fontglide.c
+++ b/hacks/fontglide.c
@@ -270,6 +270,7 @@ pick_font_1 (state *s, sentence *se)
/* #### This gets a link error with FcFontSetDestroy missing. */
/* if (fs) XftFontSetDestroy (fs); */
+ sprintf(pattern, "%s", name2);
se->xftfont = font;
ok = True;
goto DONE_2;
@@ -571,6 +572,22 @@ pick_font_1 (state *s, sentence *se)
}
}
+# if defined(HAVE_XFT) && !defined(HAVE_JWXYZ) /* Real Xft under real X11 */
+ {
+ unsigned long uc = 0;
+ utf8_decode ((const unsigned char *)"M", 1, &uc);
+ if (!XftCharExists (s->dpy, se->xftfont, (FcChar32) uc))
+ {
+# ifdef DEBUG
+ if (s->debug_p)
+ fprintf (stderr, "%s: skipping font returning substitution rectangle: %s\n",
+ progname, pattern2);
+#endif
+ return False;
+ }
+ }
+# endif
+
# ifdef DEBUG
if (s->debug_p)
--
2.31.1