Bug 116498 - Wrong font metrics with Font "DIN Light"
Summary: Wrong font metrics with Font "DIN Light"
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All All
: medium normal
Assignee: Samuel Mehrbrodt (CIB)
URL:
Whiteboard: target:6.2.0 target:6.1.0.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Font-Rendering Universal-Line-Spacing
  Show dependency treegraph
 
Reported: 2018-03-19 14:58 UTC by Samuel Mehrbrodt (CIB)
Modified: 2018-11-24 15:56 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Bugdoc (9.19 KB, application/vnd.oasis.opendocument.text)
2018-03-19 14:58 UTC, Samuel Mehrbrodt (CIB)
Details
Incorrect line height (LO 5.3) (10.57 KB, application/pdf)
2018-03-19 14:59 UTC, Samuel Mehrbrodt (CIB)
Details
Correct line height (LO 5.2) (10.56 KB, application/pdf)
2018-03-19 15:00 UTC, Samuel Mehrbrodt (CIB)
Details
din-light.ttf (deleted)
2018-05-09 06:30 UTC, Samuel Mehrbrodt (CIB)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Mehrbrodt (CIB) 2018-03-19 14:58:49 UTC
Created attachment 140711 [details]
Bugdoc

When using the font DIN Light, the font height is calculated too small.
See attachment.
This worked fine in LO 5.2, regression since 5.3 (on Windows).
On Linux this is wrong at least since 5.0.

You can download the affected font "Din Light" from here: https://www.dafontfree.net/freefonts-din-f59477.htm
Comment 1 Samuel Mehrbrodt (CIB) 2018-03-19 14:59:41 UTC
Created attachment 140712 [details]
Incorrect line height (LO 5.3)
Comment 2 Samuel Mehrbrodt (CIB) 2018-03-19 15:00:40 UTC
Created attachment 140713 [details]
Correct line height (LO 5.2)
Comment 3 Samuel Mehrbrodt (CIB) 2018-03-23 09:02:55 UTC
MS Office 2013 & 2016 do display this correctly (as it was in LO 5.2).
Comment 4 Samuel Mehrbrodt (CIB) 2018-03-23 09:24:47 UTC
Regression from bug 55469 (commit 34d7602954d4483b3bc9db700e7df2c15348947a )
Comment 5 V Stuart Foote 2018-03-23 13:22:58 UTC
Not a regression. The font metrics are odd; bad font metrics ≈ bad results.
Comment 6 LibreTraining 2018-03-24 20:51:03 UTC
(In reply to V Stuart Foote from comment #5)
> Not a regression. The font metrics are odd; bad font metrics ≈ bad results.

What is wrong with the font metrics?
Comment 7 LibreTraining 2018-03-24 21:02:37 UTC
Works fine on LO 6.0.2.1.
Installed the font.
Used your bug doc.
Applied the font to the text.
Looks fine.
Comment 8 Samuel Mehrbrodt (CIB) 2018-03-26 07:12:39 UTC
(In reply to LibreTraining from comment #6)
> (In reply to V Stuart Foote from comment #5)
> > Not a regression. The font metrics are odd; bad font metrics ≈ bad results.
> 
> What is wrong with the font metrics?

See the screenshots. The font is not vertically centered in a table as it was before.
Comment 9 Timur 2018-03-26 09:29:13 UTC
If this is specific to this (I guess commercial) font, than that should be in the title.
Comment 10 raal 2018-04-02 13:02:51 UTC
no repro with Version: 6.1.0.0.alpha0+
Build ID: 3102b8c8b52845ca4584579a7ad2154488943855
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: x11;
Comment 11 Samuel Mehrbrodt (CIB) 2018-04-03 08:52:02 UTC
(In reply to raal from comment #10)
> no repro with Version: 6.1.0.0.alpha0+
> Build ID: 3102b8c8b52845ca4584579a7ad2154488943855
> CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: x11;

Did you install the font with the filename "din-light.ttf"?

I still see the issue with master from today:
Version: 6.1.0.0.alpha0+
Build-ID: eb5976d3fbed81789df2131434272b56ec6cd44e
CPU-Threads: 8; Betriebssystem:Linux 4.13; UI-Render: Standard; VCL: x11;
Comment 12 Samuel Mehrbrodt (CIB) 2018-04-06 10:19:15 UTC
For reference, this is (was) my attempt to fix this: https://gerrit.libreoffice.org/#/c/51782/
Comment 13 Thorsten Behrens (CIB) 2018-05-06 22:11:46 UTC
Difference in LibreOffice font table parser vs. the Windows GDI one - not a good thing.

Perhaps related: bug 117411
Comment 14 Xisco Faulí 2018-05-07 14:11:06 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #4)
> Regression from bug 55469 (commit 34d7602954d4483b3bc9db700e7df2c15348947a )

Adding the keywords accordingly.
Comment 15 LibreTraining 2018-05-07 14:50:13 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #8)
> (In reply to LibreTraining from comment #6)
> > (In reply to V Stuart Foote from comment #5)
> > > Not a regression. The font metrics are odd; bad font metrics ≈ bad results.
> > 
> > What is wrong with the font metrics?
> 
> See the screenshots. The font is not vertically centered in a table as it
> was before.

The difference in how it looks is obvious. Duh.
But that was not the question.

It was stated that the font metrics are bad.
So I asked what is supposedly wrong with the metric settings within that font file.
It would be nice to specifically identify and document issues which may be present in other fonts users may use in LibreOffice.

Based on the follow-up comments it appers the issue is not the font metrics.
Comment 16 Adolfo Jayme 2018-05-08 15:24:13 UTC
As a test, I’ve dropped that (pirated copy) font into FontBakery’s checker. It returned, e.g.,

> com.google.fonts/check/042 Checking OS/2 Metrics match hhea Metrics.
> FAIL  OS/2 sTypoAscender and hhea ascent must be equal
> com.google.fonts/check/041 Checking Vertical Metric Linegaps.
> WARN  OS/2 sTypoLineGap is not equal to 0.

There you go, the font is buggy.
Comment 17 Thorsten Behrens (CIB) 2018-05-08 21:07:48 UTC
(In reply to Adolfo Jayme from comment #16)
> There you go, the font is buggy.

As we do for other broken stuff (Office, documents, APIs), we tend to work around things if it benefits our users.

My yardstick is: this worked before on Windows, now it broke - and there's a fix. :)
Comment 18 Maxim Monastirsky 2018-05-09 00:46:04 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #0)
> You can download the affected font "Din Light" from here:
> https://www.dafontfree.net/freefonts-din-f59477.htm
Obviously this isn't the right version to test, as it identifies itself as "DIN" in the font name box (only the Character dialog shows "Light" in the style list box). So by default the bugdoc uses some fallback font. And if then I select the text and manually apply the "DIN" font (or by using the font replacement table), the text remains vertically centered.

Also, searching the net for "din-light.ttf", revealed several other variations with different file sizes. Some of them listed as "DIN Light" but don't show the bug, and one (of 62.5 KB) that shows the bug in *both* LO and Word 2016 (except that in Word it's listed as "DIN-Light" instead of "DIN Light").
Comment 19 Samuel Mehrbrodt (CIB) 2018-05-09 06:29:59 UTC
(In reply to Maxim Monastirsky from comment #18)
> (In reply to Samuel Mehrbrodt (CIB) from comment #0)
> > You can download the affected font "Din Light" from here:
> > https://www.dafontfree.net/freefonts-din-f59477.htm
> Obviously this isn't the right version to test, as it identifies itself as
> "DIN" in the font name box (only the Character dialog shows "Light" in the
> style list box). So by default the bugdoc uses some fallback font. And if
> then I select the text and manually apply the "DIN" font (or by using the
> font replacement table), the text remains vertically centered.
> 
> Also, searching the net for "din-light.ttf", revealed several other
> variations with different file sizes. Some of them listed as "DIN Light" but
> don't show the bug, and one (of 62.5 KB) that shows the bug in *both* LO and
> Word 2016 (except that in Word it's listed as "DIN-Light" instead of "DIN
> Light").

Ah so I didn't know there were different versions out there, attaching the affected version now.
Comment 20 Samuel Mehrbrodt (CIB) 2018-05-09 06:30:20 UTC
Created attachment 141994 [details]
din-light.ttf
Comment 21 Thorsten Behrens (CIB) 2018-05-09 12:10:25 UTC
The content of attachment 141994 [details] has been deleted for the following reason:

Unclear provenance
Comment 22 Commit Notification 2018-05-30 07:57:25 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2f529db909f99a2a503ca0347a9d70742b7f05ba

tdf#116498 Use win metrics for 'DIN Light' font

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2018-05-30 12:03:42 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d71eb1e4476d7abfe25306338527a359cd22ba09&h=libreoffice-6-1

tdf#116498 Use win metrics for 'DIN Light' font

It will be available in 6.1.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 24 Xisco Faulí 2018-05-31 10:32:55 UTC
Verified in

Version: 6.1.0.0.beta1+
Build ID: 2a0d8106a558845357d39648656e08ec6f091cf8
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

@Samuel, Thanks for fixing this!!