Bug 117411 - Font metrics slightly changed after update OS to Ubuntu 18.04 - Workaround comment 15
Summary: Font metrics slightly changed after update OS to Ubuntu 18.04 - Workaround co...
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.3.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 119892 (view as bug list)
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2018-05-03 14:04 UTC by Lant
Modified: 2018-09-15 23:32 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments
Text example with enumerated strings and pages (12.92 KB, application/vnd.oasis.opendocument.text)
2018-05-03 14:37 UTC, Lant
Details
Screenshot on Ubuntu 17.10 comp (185.64 KB, image/png)
2018-05-03 16:08 UTC, Lant
Details
Screenshot on Ubuntu 18.04 comp (230.06 KB, image/png)
2018-05-03 16:09 UTC, Lant
Details
Text example in FODT format (30.59 KB, application/vnd.oasis.opendocument.text-flat-xml)
2018-05-03 16:17 UTC, Lant
Details
Text example in FODT format in Ubuntu 17.10 (30.62 KB, application/vnd.oasis.opendocument.text-flat-xml)
2018-05-03 16:24 UTC, Lant
Details
Text example in FODT format in Ubuntu 18.04 (30.59 KB, application/vnd.oasis.opendocument.text-flat-xml)
2018-05-03 16:24 UTC, Lant
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lant 2018-05-03 14:04:28 UTC
Description:
All documents (LO Writer) have been corrupted formatting after upgrade OS to Ubuntu 18.04 LTS. Font metric (Liberation Sans) slightly decrease, consequently on page more strings arranged. For example, on page with settings: A4 (210x297), left border 3cm, right/up/bottom border 1.5cm, paragraph settings without indentations and 1.0 line interval, font settings Liberation Sans 12 - on one page 54 strings can be to place in Ubuntu 17.10 and earlier versions, and 59 string can be to place in Ubuntu 18.04. Therefore in multi-paged documents strings have been flow to up, to other pages, corrupt document formatting. Printing this documents is impossible now!

Actual Results:  
Font metrics slightly shrinked, on ordinary page can be place slightly more strings than usual

Expected Results:
Font metrics exactly equal to ordinary strings


Reproducible: Always


User Profile Reset: No



Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0
Comment 1 Lant 2018-05-03 14:37:43 UTC
Created attachment 141869 [details]
Text example with enumerated strings and pages
Comment 2 V Stuart Foote 2018-05-03 14:38:10 UTC
Thanks for filing, but need some additional information...

Could be either font metrics (leading / scale), or paragraph metrics (spacing before, after, from printer toggle). 

Prepare a test document from prior build--save to "flat" .FODT format, and same from current. Please post them as attachment, and screen clips of on page spacing (seeing text in paragraphs with a background color set is useful here).

Also need the LO installation details, before & now? (Obtain from Help -> About dialog.)
Comment 3 Lant 2018-05-03 16:08:38 UTC
Created attachment 141872 [details]
Screenshot on Ubuntu 17.10 comp
Comment 4 Lant 2018-05-03 16:09:22 UTC
Created attachment 141873 [details]
Screenshot on Ubuntu 18.04 comp
Comment 5 Lant 2018-05-03 16:12:12 UTC
This is the same document. All document settings is the same.
Comment 6 Lant 2018-05-03 16:17:33 UTC
Created attachment 141874 [details]
Text example in FODT format
Comment 7 Lant 2018-05-03 16:24:14 UTC
Created attachment 141875 [details]
Text example in FODT format in Ubuntu 17.10
Comment 8 Lant 2018-05-03 16:24:58 UTC
Created attachment 141876 [details]
Text example in FODT format in Ubuntu 18.04
Comment 9 V Stuart Foote 2018-05-03 17:29:49 UTC
Hmm, line by line check of the .fodt documents appear identical (just different view ports between them).

And to get similar "shrinkage" of the Default style single space, I had to adjust spacing to be Proportional at 94% on a Windows install of 6.0.4.1

FWIW do notice in the screen clips a change in the rendering engine from VCL gtk2 -> gtk3 between Unbuntu 17.10 and 18.04--is that the difference?
Comment 10 V Stuart Foote 2018-05-03 17:53:24 UTC
(In reply to V Stuart Foote from comment #9)
> Hmm, line by line check of the .fodt documents appear identical (just
> different view ports between them).
> 

So given the movement of the soft page breaks the different line height calculation as rendered to canvas--and written at the appropriate line in the flat ODF--does seem a valid graphics issue that needs attention.
Comment 11 Samuel Mehrbrodt (allotropia) 2018-05-04 06:46:58 UTC
Thanks for the report. So this can either be that LO calculates the line spacing differently in LO 6 than in LO 5.4.
Or the font metrics have really changed.

From where did you get the Liberation Sans font? I guess it came with your Ubuntu installation?
Can you paste the output of "apt search fonts-liberation" on both systems here? There seem to be two different Liberation packages.

You could also try to run LO 5.4 on 18.04 and see if the behavior is the same.
Feel free to use the appimage versions for that: https://www.libreoffice.org/download/appimage/
Comment 12 Lant 2018-05-04 09:06:41 UTC
On Ubuntu 17.10:

fonts-liberation/artful,artful,now 1:1.07.4-2 all [установлен]
  Шрифты с теми же метриками, что и Times, Arial и Courier

fonts-liberation2/artful,artful,now 2.00.1-3 all [установлен, автоматически]
  Fonts with the same metrics as Times, Arial and Courier (v2)

ttf-mscorefonts-installer/artful,artful 3.6ubuntu2 all
  Установщик базовы TrueType шрифтов Microsoft


------------------------

On Ubuntu 18.04:

fonts-liberation/bionic,bionic,now 1:1.07.4-5 all [установлен]
  Fonts with the same metrics as Times, Arial and Courier

fonts-liberation2/bionic,bionic,now 2.00.1-5 all [установлен]
  Fonts with the same metrics as Times, Arial and Courier (v2)

ttf-mscorefonts-installer/bionic,bionic 3.6ubuntu2 all
  Installer for Microsoft TrueType core fonts

---------------------------------------

There is a difference between font version:
Ubuntu 17.10 - 1:1.07.4-2, 2.00.1-3
Ubuntu 18.04 - 1:1.07.4-5, 2.00.1-5

What has changed with fonts?
Comment 13 Xisco Faulí 2018-05-04 09:41:51 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #11)
> Thanks for the report. So this can either be that LO calculates the line
> spacing differently in LO 6 than in LO 5.4.
> Or the font metrics have really changed.

Looking at the screenshots, Lant is using the same LibreOffice version in both Ubuntus, the only difference is that one uses gtk2 other gtk3 which I don't think is relevant here
Comment 14 Lant 2018-05-05 06:26:37 UTC
People! Can you open this example document (text example 1st attach) - on other OS's (forex. Windows)? On other office applications (MS Office, OpenOffice etc)?
Comment 15 Mike Kaganski 2018-05-05 08:25:34 UTC
After `sudo apt remove fonts-liberation`, `sudo apt remove fonts-liberation2`, and installing LiberationSerif-Regular.ttf from Windows box, I have the test document showing 54 lines per page.
Comment 16 Mike Kaganski 2018-05-05 08:30:39 UTC
* installed font version is 2.00.1; the removed packages have versions 1.07.4 and 2.00.2.
Comment 17 Mike Kaganski 2018-05-05 08:57:12 UTC
Also, installing libreoffice-gtk2 and starting LibreOffice with gtk2 (`SAL_USE_VCLPLUGIN=gtk libreoffice`) does not fix the problem by itself.
Comment 18 Mike Kaganski 2018-05-06 10:49:33 UTC
Both Ubuntu Bionic and Debian Sid contain the same 2.00.1-5 version of the package:

https://packages.ubuntu.com/bionic/fonts-liberation2
https://packages.debian.org/sid/fonts-liberation2

... and both contain the TTF fonts having version 2.00.2 (the version bump happened at https://salsa.debian.org/fonts-team/fonts-liberation2/commit/4a51c801d30ff165517563c2375b7540dd06589c; not necessarily this specific commit has something to to with the problem).

So, this isn't an Ubuntu problem (apart from it taking not-thoroughly-tested packages).

Rene: could you raise this against the font package maintainers please?
Comment 19 Thorsten Behrens (allotropia) 2018-05-06 22:14:17 UTC
(In reply to Mike Kaganski from comment #18)
> So, this isn't an Ubuntu problem (apart from it taking not-thoroughly-tested
> packages).

See also bug 116498 - it is at least _possible_ LibreOffice started to be more sensitive to otherwise benign changes in font tables.
Comment 20 Thorsten Behrens (allotropia) 2018-05-06 22:17:20 UTC
And worth a different bug report - unless LibreOffice itself ships the font (and makes sure it's the first to be used during unit tests), it's probably a bad idea anyway to rely on anything from the system, for something as fragile as Writer layout...
Comment 21 Maxim Monastirsky 2018-05-07 01:03:12 UTC
FYI rebuilding the fonts-liberation2_2.00.1-5_all deb with this patch [1] seems to solve the problem for me, at least under Ubuntu 18.04. So it appears to be the same problem as in Bug 114434.


[1] https://pagure.io/liberation-fonts/pull-request/18.patch
Comment 22 Mike Kaganski 2018-05-07 05:49:14 UTC
(In reply to Thorsten Behrens (CIB) from comment #20)
> unless LibreOffice itself ships the font
> (and makes sure it's the first to be used during unit tests), it's probably
> a bad idea anyway to rely on anything from the system, for something as
> fragile as Writer layout...

I politely disagree.

We use many OS-provided functions. And using a font that has a strong guarantee to be metric-compatible with MS fonts (and which thus should provide predictable layout results) seems reasonable. I'd say that if in this case maintainers would not simply ignore the unit test results and silenced the relevant tests [1], it would be noticed and acted upon earlier. Otherwise, it's unclear why would maintainers want to run unit tests at all - they would only need to ensure that LO simply builds (reasoning that "it's upstream's responsibility to make tests working")? IMO, the tests had shown broken distro support rather early, which is generally important for LO and the impression it produces.

(In reply to Maxim Monastirsky from comment #21)
> So it appears to be the same problem as in Bug 114434.

I forgot to mention that LO on Ubuntu 18.04 shows the same problem with any of the package (1.7, 2.0) installed alone; so the 1.7 packaged fonts must also be affected on Ubuntu.

[1] https://salsa.debian.org/libreoffice-team/libreoffice/libreoffice/commit/a193656c3c21681bd958c84ca38ca618eafcf29e
Comment 23 Thorsten Behrens (allotropia) 2018-05-07 12:28:40 UTC
(In reply to Mike Kaganski from comment #22)
> I politely disagree.

Thx for all the links, indeed this seems silly to do to the Liberation Fonts.

That said - for the LibreOffice developer experience, what we have now is fragile. This sucks, and leads to people ignoring test breakage beyond distro maintainers.

You have a point though wrt distros - if they separate out the fonts into OS packages, _that_ then should be part of any test run (and as you point out would have caught the problem early on). But that's a downstream problem IMO.
Comment 24 Samuel Mehrbrodt (allotropia) 2018-05-07 12:30:09 UTC
FWIW, I checked your document on Windows (with Liberation fonts downloaded from Ubuntu bionic repo):
* MS Word 2013 displays page 2, strings 1-5 on the first page as well
* OpenOffice 4.1.1 displays only strings 1-54 on the first page as expected (although I'm not sure if they bundle their own copy of the Liberation fonts).

I also investigated when this "ReallyUseTypoMetrics" setting was changed in Liberation fonts. It has always been like it is since "first commit" in 2010. I don't know why it changed now in Ubuntu and why it was different before.

Also this isn't related with bug 116498. Using the win metrics here doesn't change anything.
Comment 25 Maxim Monastirsky 2018-05-07 12:38:08 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #24)
> I also investigated when this "ReallyUseTypoMetrics" setting was changed in
> Liberation fonts. It has always been like it is since "first commit" in
> 2010. I don't know why it changed now in Ubuntu and why it was different
> before.
See Caolán's comments in rhbz#1526510. It seems that old fontforge versions had a bug which prevented it from reading/writing this bit correctly. So I guess that problems started after debian/ubuntu updated their fontforge to the fixed version, and that version was later used to build the liberation packages.
Comment 26 Samuel Mehrbrodt (allotropia) 2018-05-07 12:50:13 UTC
(In reply to Maxim Monastirsky from comment #25)
> See Caolán's comments in rhbz#1526510. It seems that old fontforge versions
> had a bug which prevented it from reading/writing this bit correctly. So I
> guess that problems started after debian/ubuntu updated their fontforge to
> the fixed version, and that version was later used to build the liberation
> packages.

Ok, understood, makes sense now.
Then this is a Debian/Ubuntu problem and needs fixing by them.
Closing as NOTOURBUG.
Comment 27 scott092707 2018-05-25 19:51:37 UTC
I am using LO-W 1:6.0.3-0ubuntu1 on Lubuntu Next 18.04, and found when opening a previously-created document, that the pages did not line up.
Searching for LO-W bugs that referenced line-spacing, led me to this bug.
It sounded promising, and in reading the information in your site, and following the breadcrumbs, I finally found the debian bug report:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898116
where they reported that the bug had been:
"Fixed in version fonts-liberation/1:1.07.4-6"
The version I had was 1:1.07.4-5
So, I snagged the "cosmic" package (not yet available for "bionic")
and tried it, and it definitely solves the problem.

Thank all of you for investigating this, and helping lead me to a solution!
Comment 28 Jean-Baptiste Faure 2018-09-15 21:22:18 UTC
*** Bug 119892 has been marked as a duplicate of this bug. ***