Subject: bug#20628: 25.0.50; Incorrect line height for some fonts

From: Oleh Krehel <[email-masked]>
Date: Fri, 22 May 2015 18:54:17 +0200

I attach a patch that sets ascent/descent to 0 specifically for the
problematic font family "Latin Modern Math".

This way, the problem is solved for me for all 1152 chars with "math" in
their name that `ucs-names' returns.

>From 802b84adc05a92650ee882ddd25e6860bacde457 Mon Sep 17 00:00:00 2001
From: Oleh Krehel <[email-masked]>
Date: Fri, 22 May 2015 18:46:51 +0200
Subject: [PATCH] Set font ascent/descent to zero for "Latin Modern Math"

* src/xftfont.c (xftfont_open): Update.
---
 src/xftfont.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/xftfont.c b/src/xftfont.c
index 0e8b876..a09f7fc 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -289,6 +289,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
   FcPatternAddInteger (pat, FC_WIDTH, FONT_WIDTH_NUMERIC (entity));
   FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size);
   val = AREF (entity, FONT_FAMILY_INDEX);
+  int mathp = strcmp("Latin Modern Math", SDATA(SYMBOL_NAME(val))) == 0;
   if (! NILP (val))
     FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) SDATA (SYMBOL_NAME (val)));
   val = AREF (entity, FONT_FOUNDRY_INDEX);
@@ -332,6 +333,11 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
       XftPatternDestroy (match);
       return Qnil;
     }
+  if (mathp)
+    {
+      xftfont->ascent = 0;
+      xftfont->descent = 0;
+    }
   ft_face = XftLockFace (xftfont);
   unblock_input ();
 
-- 
1.8.4