Bug 153699 - UI/FORMATTING Certain Windows fonts invisible in Calc with cairo 1.17.8
Summary: UI/FORMATTING Certain Windows fonts invisible in Calc with cairo 1.17.8
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
7.5.0.3 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.5.2 target:7.6.0
Keywords: bibisected, bisected
: 153956 154009 154309 (view as bug list)
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2023-02-17 16:52 UTC by virag.david003
Modified: 2023-04-23 22:43 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet with broken font (9.78 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-03-04 20:46 UTC, virag.david003
Details
Screenshot with example spreadsheet (22.79 KB, image/png)
2023-03-04 20:48 UTC, virag.david003
Details

Note You need to log in before you can comment on or make changes to this bug.
Description virag.david003 2023-02-17 16:52:42 UTC
Description:
Calibri, Cambria, Cambria Math, MS Gothic, MS PGothic, and MS UI Gothic fonts in a Calc cell don't seem to display at all, looking like an empty cell.
I've installed fonts from Windows (previously used some older Windows 10 fonts, now while troubleshooting I installed the latest Windows 11 fonts) under Arch Linux, with an older Nvidia GPU with proprietary drivers. (not sure if that is important)
As soon as I updated LibreOffice to 7.5.0.3, all text in Calc with the aforementioned fonts became invisible. Interestingly, Writer still seems to display the fonts properly.
After downgrading to the "libreoffice-still" package that has 7.4.5.1, the font appears as expected, so the bug appeared somewhere between the two.
I'm not sure if this bug is platform specific in any way, as I've only tried on two x86_64 PCs with Arch Linux on both of them. I'm also not sure if this affects any other component of LibreOffice. It affects Calc but doesn't seem to affect Writer, even when making a table with the font. I'm also not sure what other fonts this affects, these are just what I could find.

In a print preview, some of the missing texts seem to display correctly, some don't. I'm not sure what makes this difference, as both visible and invisible cells use the same font there, but in the regular view, this always happens.

Steps to Reproduce:
1.Open LibreOffice Calc with a new spreadsheet
2.Write something in a cell
3.Set that cell's font to Calibri, or one of the fonts mentioned in the description

Actual Results:
The cell looks like it has no text, the text becomes invisible.

Expected Results:
The cell displays with the selected font correctly.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 7.5.0.3 (X86_64) / LibreOffice Community
Build ID: 50(Build:3)
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-US
7.5.0-1
Calc: threaded
Comment 1 Stéphane Guillou (stragu) 2023-03-04 10:23:21 UTC
I can't reproduce with Calibri in:

Version: 7.5.1.2 (X86_64) / LibreOffice Community
Build ID: fcbaee479e84c6cd81291587d2ee68cba099e129
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Nor in:

Version: 7.5.1.2 (X86_64) / LibreOffice Community
Build ID: fcbaee479e84c6cd81291587d2ee68cba099e129
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: threaded

How did you install the fonts?
Could you please attach an example document?
Could you also please test version 7.5.1 ?
Thank you!
Comment 2 virag.david003 2023-03-04 20:46:27 UTC
Created attachment 185758 [details]
Spreadsheet with broken font
Comment 3 virag.david003 2023-03-04 20:48:01 UTC
Created attachment 185759 [details]
Screenshot with example spreadsheet
Comment 4 virag.david003 2023-03-04 20:50:23 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)
[...]
> 
> How did you install the fonts?
I tried it on two different machines. On one, I currently am using this AUR package: https://aur.archlinux.org/packages/ttf-ms-win11-auto
and previously used an earlier version of this: https://aur.archlinux.org/packages/ttf-ms-win10.
On an other machine, I'm using this one: https://aur.archlinux.org/packages/ttf-ms-win11

All 3 have the problem. These fonts all come from Windows (non-auto ones from installed Windows partition, and AFAIK the auto one from Windows 11 install media).

> Could you please attach an example document?
Sure, attached, along with a screenshot!

> Could you also please test version 7.5.1 ?
Tried, also broken!

Since I forgot to paste the details from the 2nd machine, here they are:

Version: 7.5.1.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 12; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-US
7.5.1-1
Calc: threaded
Comment 5 virag.david003 2023-03-04 21:35:08 UTC
By pure chance, I discovered that not all letters are invisible in all cases:
With Calibri, the Hungarian "ő" and "ű" letters seem to always be visible, even as capital letters ("Ő", "Ű") (though other Hungarian letters don't seem to display)
Also, lowercase "f" followed by any of these following letters: b, f, h, i, í, j, k, t, l (so fb, ff, fh, fi, fí, fj, fk, ft, fl), also both lowercase, seem to display together correctly, but not with anything seperating them.
When these letters or combination of letters are in a cell with Calibri, only those letters display properly, others seem invisible, looking like whitespace characters.
These "rules" seem to be different on the other fonts mentioned, with different characters showing up.
Comment 6 Stéphane Guillou (stragu) 2023-03-05 09:46:10 UTC
I tested with the fonts installed with ttf-mscorefonts-installer on Ubuntu 20.04, and with https://www.fontpalace.com/font-download/Calibri/ for Calibri, but could not reproduce.

Someone with Arch should test with that particular package from AUR.
Comment 7 Buovjaga 2023-03-05 19:44:30 UTC
Fortunately bibisecting repos worked on Arch for me this time and I used linux-64-7.5 to pinpoint the change to 3f6677e9b610acf506e2d2d452f2e9252a1d3803
turn cairo_font_options_set_hint_metrics back off again

As this looks like some misconfiguration in Arch, I will not call this a regression. Pinging Caolán nevertheless for ideas.

I could not reproduce this in a container with Fedora 30.
Comment 8 Caolán McNamara 2023-03-06 10:22:34 UTC
The versions of cairo and/or freetype might matter. Especially if we can get from their versions what features arch might have enabled/disabled that differ from the distros where there isn't a problem seen
Comment 10 Caolán McNamara 2023-03-06 13:45:23 UTC
I think I see a problem (though with gen, not gtk3) with cairo 1.17.8 which I don't see with 1.17.6, will bisect cairo itself
Comment 11 Caolán McNamara 2023-03-06 13:55:25 UTC
commit 3c8dec60e5c9534ccfef25d1a916cf33eba911d4
Author: Adrian Johnson <ajohnson@redneon.com>
Date:   Fri Jan 6 22:21:16 2023 +1030

    Integrate COLR v1 renderer with cairo-ft-font.c

https://gitlab.freedesktop.org/cairo/cairo/-/issues/643
Comment 12 Caolán McNamara 2023-03-06 16:56:41 UTC
I think this is a problem what that version of cairo: I propose a workaround for 1.17.8 with https://gerrit.libreoffice.org/c/core/+/148356 and have bisected upstream
Comment 13 Stéphane Guillou (stragu) 2023-03-06 17:19:16 UTC
*** Bug 154009 has been marked as a duplicate of this bug. ***
Comment 14 Commit Notification 2023-03-07 12:19:19 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/596c7331e07038e229bad9e817f835fb9107f11d

tdf#153699 workaround cairo 1.17.8 problem

It will be available in 7.5.2.

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

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2023-03-07 15:32:53 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6231b4b2a8bcfdcb80c5b4555f6a9d2c9946b9c6

tdf#153699 workaround cairo 1.17.8 problem

It will be available in 7.6.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 17 Buovjaga 2023-03-09 20:10:12 UTC
I verify the workaround commit, thanks

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 013fbfb592f71c1f0a60b6a7ec08aded375515ac
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Comment 18 Buovjaga 2023-03-21 12:44:28 UTC
*** Bug 154309 has been marked as a duplicate of this bug. ***
Comment 19 Buovjaga 2023-03-21 12:44:39 UTC
*** Bug 153956 has been marked as a duplicate of this bug. ***