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

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

bug#29078: 25.2; font issue with FreeType 2.8; should not use the rounde


From: Robert Pluim
Subject: bug#29078: 25.2; font issue with FreeType 2.8; should not use the rounded ascender and descender
Date: Tue, 31 Oct 2017 11:53:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Vincent Lefevre <vincent@vinc17.net> writes:

> For TrueType fonts, FreeType 2.8 uses different rounding rules for
> values in the FT_Size_Metrics structure, which is apparently used
> by Emacs (since there are visible changes). In particular, one can
> now have ascender + descender > height. The consequences are:
>
> 1. Tables look a bit ugly.
>
> 2. Windows (with the same number of text lines) are unnecessarily
>    higher than before.
>
> 3. This can break existing configurations, where Emacs would be
>    opened at start up, with an expected window size.
>
> I could notice changes at least with the default Mono font, which
> appears to be DejaVu Sans Mono.
>
> Upstream now recommends to use the values from the FT_Face structure
> and scale them manually:
>

I don't have FreeType2.8 to test, but you're saying we need to do this?

diff --git a/src/ftfont.c b/src/ftfont.c
index 35f5923376..d16bf09a1e 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1153,18 +1153,9 @@ ftfont_open2 (struct frame *f,
   upEM = ft_face->units_per_EM;
   scalable = (INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX))
              && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) == 0);
-  if (scalable)
-    {
-      font->ascent = ft_face->ascender * size / upEM + 0.5;
-      font->descent = - ft_face->descender * size / upEM + 0.5;
-      font->height = ft_face->height * size / upEM + 0.5;
-    }
-  else
-    {
-      font->ascent = ft_face->size->metrics.ascender >> 6;
-      font->descent = - ft_face->size->metrics.descender >> 6;
-      font->height = ft_face->size->metrics.height >> 6;
-    }
+  font->ascent = ft_face->ascender * size / upEM + 0.5;
+  font->descent = - ft_face->descender * size / upEM + 0.5;
+  font->height = ft_face->height * size / upEM + 0.5;
   if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)))
     spacing = XINT (AREF (entity, FONT_SPACING_INDEX));
   else





reply via email to

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