Bug 152675 - font clipped at top pixel row at certain zoom-levels (kf5 and qt5 with Cairo, gtk3)
Summary: font clipped at top pixel row at certain zoom-levels (kf5 and qt5 with Cairo,...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.0.0 beta1+
Hardware: All Linux (All)
: medium minor
Assignee: Caolán McNamara
URL:
Whiteboard: target:24.2.0 target:7.5.8 target:7.6.3
Keywords: bibisected, bisected, regression
: 154899 (view as bug list)
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2022-12-25 18:08 UTC by goodguy00@zoho.com
Modified: 2023-09-27 16:16 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
text sample. upper part viewd in 7.4.3.2, same text in the lower part in 7.5.0.1 (42.38 KB, image/jpeg)
2022-12-25 18:08 UTC, goodguy00@zoho.com
Details
top row shows it at 130% zoom (25.77 KB, application/vnd.oasis.opendocument.text)
2023-01-23 16:32 UTC, goodguy00@zoho.com
Details
reproduced with Liberation Serif at 110% zoom (14.97 KB, application/vnd.oasis.opendocument.text)
2023-09-22 12:17 UTC, Stéphane Guillou (stragu)
Details
original ODT with font embedded (issue visible at 130% zoom) (139.35 KB, application/vnd.oasis.opendocument.text)
2023-09-22 12:24 UTC, Stéphane Guillou (stragu)
Details
Liberation Serif sample at 110% after patch (236.34 KB, image/png)
2023-09-25 13:35 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description goodguy00@zoho.com 2022-12-25 18:08:32 UTC
Created attachment 184341 [details]
text sample. upper part viewd in 7.4.3.2, same text in the lower part in 7.5.0.1

(strangely enough, i could download the official release 7.5.0.1, but cannot select it as version affected)
text with font (example): BenjaminSansMedium 8pt, in certain zoom-levels (esp. my favorite one of 130%), the top pixel-row is clipped (see attaced images).

Version: 7.5.0.1 (X86_64) / LibreOffice Community
Build ID: 77cd3d7ad4445740a0c6cf977992dafd8ebad8df
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-CH (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 goodguy00@zoho.com 2022-12-25 19:28:01 UTC
well, i could not find another font where this happens and also no other point-size. i'm amazed that i stumble over the most bizzare and rare behaviors. but, definitely, something changed in how fonts are rendered.
Comment 2 Telesto 2022-12-26 08:52:02 UTC
(In reply to goodguy00@zoho.com from comment #1)
> well, i could not find another font where this happens and also no other
> point-size. i'm amazed that i stumble over the most bizzare and rare
> behaviors. but, definitely, something changed in how fonts are rendered.

Well this sounds like related to bug 149322 (first guess) or bug 152094 (second guess). It or causes it, or uncovering a problem being present all along.

Any change to add some sample odt with some text? Which reproduces the issue for you.
Also turn on embed fonts in document (file -> properties -> font). check both checkboxes)
Comment 3 goodguy00@zoho.com 2023-01-23 16:32:03 UTC
sure. just tested in
Version: 7.5.0.2 (X86_64) / LibreOffice Community
Build ID: c0dd1bc3f1a385d110b88e26ece634da94921f58
CPU threads: 4; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-CH (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 4 goodguy00@zoho.com 2023-01-23 16:32:42 UTC
Created attachment 184852 [details]
top row shows it at 130% zoom
Comment 5 Telesto 2023-01-23 18:52:04 UTC
I'm not seeing any problem.. maybe kf5 specific

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 37e3455a13ab5741104bf41d05a80e60a4612682
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded
Comment 6 goodguy00@zoho.com 2023-01-26 11:31:03 UTC
that might well be ... BUT:  it's still different between the LO versions on the SAME kf5.
Comment 7 Buovjaga 2023-03-22 13:08:08 UTC
You did not embed the font into the document. Please either embed or tell us where we can download it. I tried this and did a test from scratch, but there was no problem: https://www.1001fonts.com/benjamin-font.html

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 74f398bb58510087cc4a11bb2253715771a2c6b2
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
Built on 22 March 2023
Comment 8 Aron Budea 2023-06-21 09:02:55 UTC
Possibly the same as bug 154899.
Comment 9 Stéphane Guillou (stragu) 2023-09-22 12:17:27 UTC
Created attachment 189758 [details]
reproduced with Liberation Serif at 110% zoom

I just ran into this one in:

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

Still current in:

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

See in attachment that does not require extra fonts, look at "T" in the Text Body paragraphs.
Affects gtk3, kf5 (cairo+xcb) and qt5 (cairo+xcb).

Bibisected with linux-64-7.5 repo to first bad commit 15c94da60665cd06f21c651a5be2a52af07c2539 which points to core commit:

commit 3f6677e9b610acf506e2d2d452f2e9252a1d3803
author	Caolán McNamara <caolanm@redhat.com>	Tue Nov 29 20:23:44 2022 +0000
committer	Caolán McNamara <caolanm@redhat.com>	Wed Nov 30 12:14:10 2022 +0100
turn cairo_font_options_set_hint_metrics back off again
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143473

Caolán, what do you think?
Comment 10 Stéphane Guillou (stragu) 2023-09-22 12:19:22 UTC
Same bibisect as bug 154899 comment 2.
Comment 11 Stéphane Guillou (stragu) 2023-09-22 12:20:24 UTC
*** Bug 154899 has been marked as a duplicate of this bug. ***
Comment 12 Stéphane Guillou (stragu) 2023-09-22 12:24:19 UTC
Created attachment 189759 [details]
original ODT with font embedded (issue visible at 130% zoom)

Regarding the original sample document, I had to get the font from https://www.fontyukle.net/font/Benjamin-Sans-Medium. Here it is again with the font embedded, for good measure.
Comment 13 Caolán McNamara 2023-09-22 19:58:32 UTC
It might depend on the version of cairo, or maybe freetype, or possibly both. And might also depend on how freetype is configured.

Here with fedora 38

cairo-1.17.8-4.fc38.x86_64
freetype-2.13.0-2.fc38.x86_64

I don't think I see a problem with the final attachment
Comment 14 Caolán McNamara 2023-09-22 20:02:35 UTC
though the code is now

// tdf#153699 skip this with cairo 1.17.8 as it has a problem
// See: https://gitlab.freedesktop.org/cairo/cairo/-/issues/643
if (cairo_version() != CAIRO_VERSION_ENCODE(1,17,8))
        cairo_font_options_set_hint_metrics(pOptions, CAIRO_HINT_METRICS_OFF);

so it looks like it is disabled for that 1.17.8 version so maybe this needs to be extended to some other known not-working versions of cairo?

So do we know that the versions of cairo are on the affected systems?
Comment 15 Stéphane Guillou (stragu) 2023-09-22 20:49:00 UTC Comment hidden (obsolete)
Comment 16 Stéphane Guillou (stragu) 2023-09-22 20:49:39 UTC
Thanks Caolán!

For Ubuntu 20.04:

libcairo2: 1.16.0-4ubuntu1
libfreetype6: 2.10.1-2ubuntu0.3

From duplicate bug 154899 comment 4, Ubuntu 22.04 has libcairo2 1.16.0-5ubuntu2 (and libfreetype6 2.11.1+dfsg-1ubuntu0.2 according to packages.ubuntu.com).
Comment 17 Caolán McNamara 2023-09-23 06:19:15 UTC
alright, lets assume that all versions <= 1.17.8 are affected then

https://gerrit.libreoffice.org/c/core/+/157177
Comment 18 Commit Notification 2023-09-23 09:28:14 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1dd357ccf7ca9edbe5f2ef60465c2559f678d306

tdf#152675 treat all cairo versions <= 1.17.8 the same

It will be available in 24.2.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 19 Caolán McNamara 2023-09-23 09:31:15 UTC
so, I expect that to work. Done in trunk, backport to 7-6 and 7-5 in gerrit.
Comment 20 Commit Notification 2023-09-25 11:36:45 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/865893432c4037f534ee28ea794e888e5ce7702b

tdf#152675 treat all cairo versions <= 1.17.8 the same

It will be available in 7.5.8.

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 21 Commit Notification 2023-09-25 11:36:48 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/fdcea7929e3e795a3fd0ec884d80181c3cd15d8c

tdf#152675 treat all cairo versions <= 1.17.8 the same

It will be available in 7.6.3.

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 22 Stéphane Guillou (stragu) 2023-09-25 13:35:06 UTC
Created attachment 189808 [details]
Liberation Serif sample at 110% after patch

Caolán, sorry but that doesn't look like it fixed it, please see attachment with a build from today, same issue.

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

(Just a note regarding reproducing: zoom factor might depend on hardware and scaling. If I use 2× scaling, the same sample will only display the issue at 55% zoom.)
Comment 23 Stéphane Guillou (stragu) 2023-09-25 13:35:50 UTC
Maybe Khaled has an idea?
Comment 24 Aron Budea 2023-09-25 22:14:13 UTC
(In reply to Stéphane Guillou (stragu) from comment #22)
> Caolán, sorry but that doesn't look like it fixed it, please see attachment
> with a build from today, same issue.
I think it's just that the condition got mixed up accidentally, can you check with this patch?
https://gerrit.libreoffice.org/c/core/+/157260
Comment 25 Commit Notification 2023-09-26 07:31:38 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5b52a7c3154f5263db82f19f7cc7d0e7b32da603

tdf#152675 treat all cairo versions <= 1.17.8 the same (actually)

It will be available in 24.2.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 26 Commit Notification 2023-09-26 08:22:47 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/cdb098171a67f4859d2e97cb001528c97de74a76

tdf#152675 treat all cairo versions <= 1.17.8 the same (actually)

It will be available in 7.6.3.

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 27 Commit Notification 2023-09-26 09:44:57 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/d4abf34d4e63a5df302ecd1ce005bef68a0c78d1

tdf#152675 treat all cairo versions <= 1.17.8 the same (actually)

It will be available in 7.5.8.

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 28 Stéphane Guillou (stragu) 2023-09-27 16:16:57 UTC
Thank you Aron, good catch, verified fixed in:

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