Bug 152396 - Font width (expanded, condensed, etc.) is not supported
Summary: Font width (expanded, condensed, etc.) is not supported
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
: 79726 87288 98596 127377 (view as bug list)
Depends on:
Blocks: Fonts
  Show dependency treegraph
Reported: 2022-12-06 13:06 UTC by RGB
Modified: 2024-02-26 09:18 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:

PDF output of a sample documnet using both, the variable and the standard version of Junicode Two Beta (69.61 KB, application/pdf)
2022-12-06 16:15 UTC, RGB

Note You need to log in before you can comment on or make changes to this bug.
Description RGB 2022-12-06 13:06:54 UTC
Tested with Junicode Two Beta VF variable font



Version: (X86_64) / LibreOffice Community
Build ID: 2b4d136b65bc79a1248876160e85fab79d52d5d6
CPU threads: 8; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

With Junicode Two Beta VF, a variable font, LibreOffice offers 34 different styles, but many of them fall back into a few ones that are not necessarily the correct ones.

For example: regular, expanded, semicondensed, semicondensed light, semiexpanded all fall back to "condensed" when reopening the style/direct formatting; expanded medium and others go to condensed medium; etc.

Also, comparing the variable font with the static version, the font names used by LibreOffice are wrong: what in the VF is called "condensed" in reality correspond with "semiexpanded" for the static font.

Note: I tested with Junicode Two Beta because it offers both, the variable and the static version of the font so it's easy to compare. Also, despite being in beta state, I tested the font with https://bulletproof.italic.space/ and it works as intended.
Comment 1 RGB 2022-12-06 16:15:07 UTC
Created attachment 184021 [details]
PDF output of a sample documnet using both, the variable and the standard version of Junicode Two Beta

In the attached PDF you can see the behavior described in the report. The first three lines show the static versions of Junicode Two Beta in its Condensed, Regular and SemiExpanded variants. The following line show the variable version which LibreOffice label as condensed, independently of which style you select from those indicated between parenthesis. As you can see, the "condensed" from the variable font matches with the SemiExpanded static variant, not with the condensed. 

The embedded variable font don't show its name in the exported PDF.
Comment 2 V Stuart Foote 2022-12-06 19:19:37 UTC
I'm sure خالد will comment, but I think  https://gerrit.libreoffice.org/c/core/+/142028 was an incremental handling of variable fonts until (or even if) more work on HB based instantiation in PDF provides better glyph stamping. 

The mangled PS font names are there in the PDF, but I don't think we can expect the bitmap glyps to match appearance on VCL canvas yet.
Comment 3 ⁨خالد حسني⁩ 2022-12-06 19:44:35 UTC
It does not seem to be a variable font issue, rather it seems that LibreOffice is failing to use the width variants at all, i.e. the width is always ignored. If you install the static fonts you get the same issue.
Comment 4 ⁨خالد حسني⁩ 2022-12-06 20:57:24 UTC
I tried to debug this and now I’m very skeptical that font width ever worked, it seems to be ignored left and right.
Comment 5 ⁨خالد حسني⁩ 2023-02-24 11:27:38 UTC
*** Bug 127377 has been marked as a duplicate of this bug. ***
Comment 6 ⁨خالد حسني⁩ 2023-02-24 11:52:15 UTC
*** Bug 79726 has been marked as a duplicate of this bug. ***
Comment 7 ⁨خالد حسني⁩ 2023-02-24 12:02:13 UTC
I did some debugging and it seems one layer of LibreOffice knows about font width (vcl fonts) and another layer does not (svx stuff) and at some point the fonts are serialized between the two layers and this is when font width gets lost. Probably require quite a bit of work to get it working.
Comment 8 ⁨خالد حسني⁩ 2023-02-24 12:03:43 UTC
*** Bug 87288 has been marked as a duplicate of this bug. ***
Comment 9 ⁨خالد حسني⁩ 2023-02-24 12:06:20 UTC
This issue does not show up on Windows because Windows GDI supports only R/I/B/BI styles and will split large families into multiple subfamilies (so instead of Foo font with style Condensed, you get Foo Condensed with style Regular), but the buggy code is in the platform-independent parts of LibreOffice.
Comment 10 ⁨خالد حسني⁩ 2023-02-24 12:12:07 UTC
*** Bug 98596 has been marked as a duplicate of this bug. ***