Bug 44624 - Incorrect height (ascent and descent) for font
Summary: Incorrect height (ascent and descent) for font
Status: NEW
Alias: None
Product: DejaVu
Classification: Unclassified
Component: Mono Sans (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Deja Vu bugs
QA Contact:
Depends on:
Reported: 2012-01-10 02:59 UTC by Pierre Ossman
Modified: 2012-01-10 13:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

mono-fix-ascent-descent.patch (2.70 KB, patch)
2012-01-10 04:00 UTC, Pierre Ossman
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Ossman 2012-01-10 02:59:08 UTC
This originated in Red Hat's bugzilla as bug 752538:


Quick summary:

Freetype <= 2.4.5 rendered DejaVu Mono in a way that looked decent, but was technically incorrect. Freetype >= 2.4.6 follows the TTF specification more properly, but causes DejaVu Mono to be rendered with an incorrect height.

To clearly see that that the height is incorrect, we can examine glyph U+2551 (two vertical bars), which is supposed to span exactly one line. This glyph has an ascent of 1992 and a descent of 618. But the font's meta data states an ascent of 1901 and a descent 483.

The practical issue of this is too much overlap of glyphs, and even when there is no overlap the lack of space between lines is very displeasing to look at (IMO).

(Note: I have no idea if the other DejaVu fonts also need to be adjusted)
Comment 1 Pierre Ossman 2012-01-10 03:03:11 UTC
I did a quick attempt at trying to fix this, but I'm clearly missing some details here. I did this:

Index: src/DejaVuSansMono.sfd
--- src/DejaVuSansMono.sfd	(revision 2503)
+++ src/DejaVuSansMono.sfd	(working copy)
@@ -29,13 +29,13 @@
 OS2TypoDescent: -492
 OS2TypoDOffset: 0
 OS2TypoLinegap: 410
-OS2WinAscent: 1901
+OS2WinAscent: 1992
 OS2WinAOffset: 0
-OS2WinDescent: 483
+OS2WinDescent: 618
 OS2WinDOffset: 0
-HheadAscent: 1901
+HheadAscent: 1992
 HheadAOffset: 0
-HheadDescent: -483
+HheadDescent: -618
 HheadDOffset: 0
 OS2Vendor: 'PfEd'
 Lookup: 1 0 0 "'locl' Localized Forms in Latin lookup 0"  {"'locl' Localized Forms in Latin lookup 0-1"  } ['locl' ('latn' <'ISM ' 'KSM ' 'LSM ' 'NSM ' 'SKS ' 'SSM ' > ) ]

Which definitely increased the height of the font. Unfortunately it increased it too much, which gives a bit of a gap for U+2551.

I also don't know how the other ascent and descent values should be adjusted. Apply the same offset? Or is there also a scale involved?
Comment 2 Pierre Ossman 2012-01-10 04:00:36 UTC
Created attachment 55379 [details] [review]

For reference, my changes in their current form.
Comment 3 Ben Laenen 2012-01-10 08:32:01 UTC
U+2551 should actually overlap a little... The glyphs just aren't hinted yet which makes the overlap a bit ugly. But without the slight overlap it would also just
The other box glyphs should have been drawn higher to span the entire vertical space.

Also, in the downstream bug report: the screenshot of the current behaviour is actually how it's supposed to look...
Comment 4 Pierre Ossman 2012-01-10 13:10:31 UTC
Hmm... okay. I would have thought that the current state is one pixel too short, and the modified version is one pixel too high (at 10pt@96dpi). If you have some overlap, how would alpha be properly handled?

Still, the original reason I opened the bug was that things looked compressed. I know this is rather subjective, but I don't currently have a good idea on how to make it more tangible. I figured the bar glyph was a good data point.

I did a quick check with other fonts, and they do seem to be as cramped as DejaVu, so the current rendering is "normal" I guess. Doesn't say it's the proper thing to do though, and I still say that things are more readable with a bit more spacing. :)

bug/show.html.tmpl processed on Jan 21, 2017 at 00:03:16.
(provided by the Example extension).