GNU bug report logs - #20628
25.0.50; Incorrect line height for some fonts

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Fri, 22 May 2015 03:03:02 UTC

Severity: normal

Found in version 25.0.50

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

Bug is archived. No further changes may be made.

Full log


Message #8 received at 20628 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: 20628 <at> debbugs.gnu.org
Subject: Re: bug#20628: 25.0.50; Incorrect line height for some fonts
Date: Fri, 22 May 2015 10:32:46 +0300
> Date: Thu, 21 May 2015 23:02:06 -0400
> From: Clément Pit--Claudel
>  <clement.pitclaudel <at> live.com>
> 
> Some Unicode characters incorrectly increase the height of the line on which
> they are inserted, by an incorrect amount (typically 4/5 times the normal line
> height). This is due to Emacs falling back to a font for which line height
> calculations are incorrect. The problem can generally be reproduced just by
> inputing the following characters:
> 
>   (𝓝𝓟)
> 
> Alternatively, the problem can be reproduced by switching to certain
> specific fonts. For example:
> 
>   (set-frame-font "-unknown-Latin Modern Math-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1" nil nil)
> 
> This problem is not specific to 25.0.50. It is discussed on stackexchange [1]
> and the effect can be observed in [2]. It only occurs with specific fonts. It
> particularly impacts packages that rely on prettify-symbols-mode to display math
> symbols; when users install the package, some lines in the buffer start being 4
> or 5 times taller than other lines, although no characters on the affected lines
> stand out. For this reason, even if this is likely a problem in the way the
> fonts are packaged, it would be nice to have a workaround at the Emacs level.
> 
> Emacs is the only program on my system that displays this behaviour; typing the
> same text in gedit or switching gedit to one of the misbehaving fonts, for
> example, does not affect the line height.

I'm sorry, but I don't see the bug here, at least not a bug I know how
to fix.  Emacs obeys the information about the glyph sizes that the
font supplies; if the font says the font glyphs need more vertical
space than in the font used for the default face, then Emacs will
enlarge line height.  What else can it do?

In particular, the ugly effect in
https://cloud.githubusercontent.com/assets/2506825/7760973/67ceaaea-ffd5-11e4-8bf6-d796aa162b0e.png
is most probably caused by using a font whose Math Alphanumerics block
specifies a very large vertical space, to accommodate for
superscripts, power, integrals, etc.  Just switch to a different font
which covers the same block without this adverse side effect.

So the only way to fix this (if it really can be fixed) is for someone
who knows enough about these fonts to explain (a) why the metrics
provided by these fonts are incorrect, and (b) what metrics to use
instead and how to compute them.  Failing that, there's nothing that
can be done here, as Emacs behaves as required and as designed.




This bug report was last modified 9 years and 356 days ago.

Previous Next


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