Bug 155199 - LO inconsistently renders Calibri font ligatures (11pt, zoom 100% or 110%) on Linux w gtk3
Summary: LO inconsistently renders Calibri font ligatures (11pt, zoom 100% or 110%) on...
Status: VERIFIED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha0+
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering GTK3
  Show dependency treegraph
 
Reported: 2023-05-08 20:55 UTC by Eyal Rozenberg
Modified: 2023-06-07 17:58 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of rendering "staff fee foo" in 11pt zoom 100% (823 bytes, image/png)
2023-05-08 20:55 UTC, Eyal Rozenberg
Details
The Calibri regular font file in question (794.80 KB, application/octet-stream)
2023-05-09 19:05 UTC, Eyal Rozenberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2023-05-08 20:55:45 UTC
Created attachment 187152 [details]
Example of rendering "staff fee foo" in 11pt zoom 100%

With GTK3 on Linux, ligatures in text that's rendered using the Calibri font family, in size 11pt zoom 100%, get rendered inconsistently with the rest of the text.

Example screenshot (again, 100% zoom) is attached. Note the ff has colorized subpixel rendering and the rest of the text has nothing, no anti-aliasing/subpixel etc.

I also see this with the ligatures for ti and fi.

Seen with:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5cd9de202765e243e41416802f3e4486b8a96f16
CPU threads: 4; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: he-IL (en_IL); UI: en-US

and also the 7.4.5.1 release.
Comment 1 Eyal Rozenberg 2023-05-08 20:57:45 UTC
With qt5 for the VCL, this doesn't happen; all text is rendered with anti-aliasing.
Comment 2 V Stuart Foote 2023-05-08 22:52:57 UTC
Calibri is a MS font, not supported on Linux without commercial license from Ascender / Monotype.  Is it even on your system, and are you getting fallback glyph for the ligatures?
 
So how does it look with Carlito? From the Croscore/Crosextra bundling.

Check U+0133 U+0153 U+fb00 U+fb01 U+fb02 U+fb03 U+fb04

and maybe also U+fb05 and U+fb06 which have no coverage in Calibri/Carlito, so you'll see a fallback glyph for sure on those.
Comment 3 Eyal Rozenberg 2023-05-08 23:12:37 UTC
(In reply to V Stuart Foote from comment #2)
> Calibri is a MS font

Yeah - and the default MSO font for many years. We should render it properly.

>, not supported on Linux

"Supported"? It's a TrueType font, and TrueType fonts are supported on Linux.

> without commercial license from Ascender / Monotype.

That's not relevant to rendering the font.

>  Is it even on your system, and are you getting fallback glyph for the ligatures?

It's on my system. (Also, couldn't it have just been embedded in the document? I know MS Word offers this feature.)
Comment 4 V Stuart Foote 2023-05-09 02:55:11 UTC
(In reply to Eyal Rozenberg from comment #3)
> (In reply to V Stuart Foote from comment #2)
> > Calibri is a MS font
> 
> Yeah - and the default MSO font for many years. We should render it properly.
> 
> >, not supported on Linux
> 
> "Supported"? It's a TrueType font, and TrueType fonts are supported on Linux.
> 
> > without commercial license from Ascender / Monotype.
> 
> That's not relevant to rendering the font.
> 
> >  Is it even on your system, and are you getting fallback glyph for the ligatures?
> 
> It's on my system. (Also, couldn't it have just been embedded in the
> document? I know MS Word offers this feature.)


If Calibri is "on" your Linux system it is NOT the Microsoft built font--the only legitimate source for use on Linux is commercial license Ascender / Monotype delivered font packaging.

Otherwise, Linux is limited to use of metric "equivalent" Carlito.

So, unless fontconfig fc-list dumps back a Calibri ident, you are using something else--made worse when fontconfig has to fill in holes for missing Unicode glyphs.

I think I'd seen where Khaled had noted we shape with hb first and then fill in with missing glyphs--so the western text ligatures could take either route. Missing glyphs with fall back assignment that may not match the hb shaping, or glyps present in the font but with borked metrics. I'd prefer to get his opinion here.

As to "supported" yes if you have a valid OTF/TTF source for Calibri installed to your Linux system fontconfig will use it.  But that is not the norm, and the Croscore/Crosextra delivered Carlito is to likely fallback.  But it is a fallback with all the issues that come with it.
Comment 5 ⁨خالد حسني⁩ 2023-05-09 04:24:12 UTC
IIRC, This is a hinting issue in the font, the ligatures are not hibted the same way as the non-ligated glyphs. Don’t use font hinting and use auto hinting instead (I believe light hinting mode does this). Also mske sure you are using the latest version of the font, it might have this sorted out.
Comment 6 ⁨خالد حسني⁩ 2023-05-09 04:31:16 UTC
The exact font file used and the hinting settings on the system are needed, and how the text is rendered in other GTK apps.
Comment 7 ⁨خالد حسني⁩ 2023-05-09 07:38:34 UTC
I checked the font, and I now remember correctly. The font has embedded bitmaps for certain pixel sizes but they cover only a small subset of the glyphs. FreeType will use the bitmaps when they are available for the current font size. You can setup FontConfig to not use embedded bitmaps.

This is a font and local configuration issue, nothing for LibreOffice to do here.
Comment 8 Eyal Rozenberg 2023-05-09 19:03:42 UTC
(In reply to خالد حسني from comment #7)

If this were some arbitrary font, then I agree. But we are talking about the default font in MSO - to this day (even though I understand they're replacing it). And - what I believe to be the default fontconfig settings. So I'm not so sure it's legit - in terms of user experience and expectations - to just say that it's not our problem.
Comment 9 Eyal Rozenberg 2023-05-09 19:05:36 UTC
Created attachment 187174 [details]
The Calibri regular font file in question

As per Khaled's request, a copy of the font file.

Other GTK apps also seem to exhibit the same behavior (although in some you can control it, like with gimp).
Comment 10 ⁨خالد حسني⁩ 2023-05-09 20:38:40 UTC
No idea what we should do here then, we are respecting the font and the settings.
Comment 11 Eyal Rozenberg 2023-06-07 17:21:07 UTC
(In reply to ⁨خالد حسني⁩ from comment #10)
> No idea what we should do here then, we are respecting the font and the
> settings.

Well, if we don't do something automatically, we should at least let the user disable ligatures on a per-document-and-font-family/font-family-variant basis.
Comment 12 ⁨خالد حسني⁩ 2023-06-07 17:43:43 UTC
You can control any font feature including ligatures from the font features dialog.
Comment 13 Eyal Rozenberg 2023-06-07 17:58:07 UTC
Ok, verifying.