GNU bug report logs - #73752
29.4; Ligatures are randomly rendered with extra spaces

Previous Next

Package: emacs;

Reported by: xuan <at> xlk.me

Date: Fri, 11 Oct 2024 21:40:02 UTC

Severity: normal

Merged with 54646

Found in versions 29.0.50, 29.4

Fixed in version 30.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tim Ruffing <dev <at> real-or-random.org>
To: Eli Zaretskii <eliz <at> gnu.org>, Visuwesh <visuweshm <at> gmail.com>
Cc: dev <at> real-or-random.org, xuan <at> xlk.me, 73752 <at> debbugs.gnu.org
Subject: bug#73752: 29.4; Ligatures are randomly rendered with extra spaces
Date: Mon, 04 Nov 2024 01:11:39 +0100
This fixes the problem:  

diff --git a/src/ftfont.c b/src/ftfont.c
index 882d3eec256..2be443108f1 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2994,9 +2994,8 @@ fthbfont_begin_hb_font (struct font *font, double
*position_unit)
   struct font_info *ftfont_info = (struct font_info *) font;
 
   *position_unit = 1.0 / (1 << 6);
-  if (! ftfont_info->hb_font)
-    ftfont_info->hb_font
-      = hb_ft_font_create_referenced (ftfont_info->ft_size->face);
+  ftfont_info->hb_font
+    = hb_ft_font_create_referenced (ftfont_info->ft_size->face);
   return ftfont_info->hb_font;
 }
 
That is, it makes at least the bug with Yixuan's script disappear. I
haven't yet verified if this fixes what I often see during my daily
usage.

The above patch seems to a bit crude at first glance. While I don't
notice any impact on performance, the following should be faster
according to https://harfbuzz.github.io/integration-freetype.html :

diff --git a/src/ftfont.c b/src/ftfont.c
index 882d3eec256..cd685af4d89 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -2997,6 +2997,8 @@ fthbfont_begin_hb_font (struct font *font, double
*position_unit)
   if (! ftfont_info->hb_font)
     ftfont_info->hb_font
       = hb_ft_font_create_referenced (ftfont_info->ft_size->face);
+  else
+     hb_ft_font_changed (ftfont_info->hb_font);
   return ftfont_info->hb_font;
 }

But unfortunately, that one doesn't work. With this patch, the
rendering is still bad, it's just bad in a difference way: Instead of
the last character having wadjust > width, all characters in the bad
ligature have the same wadjust > width. If we care about this, then we
may want to reach out to harfbuzz to understand why. (Or at least that
seems beyond my superficial text rendering skills, but perhaps the
experts here understand what's going on.)
 






This bug report was last modified 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.