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)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 79726 87288 98596 127377 163904 (view as bug list)
Depends on:
Blocks: Fonts
  Show dependency treegraph
 
Reported: 2022-12-06 13:06 UTC by RGB
Modified: 2024-11-16 15:44 UTC (History)
13 users (show)

See Also:
Crash report or crash signature:


Attachments
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
Details

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

https://github.com/psb1558/Junicode-font

on

Version: 7.5.0.0.alpha1 (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. ***
Comment 11 Volga 2024-07-29 10:46:51 UTC
So you have to write additional source codes for this, or alternatively, integrate FreeType.
Comment 12 Volga 2024-08-22 12:44:54 UTC
Also, you may consider to implement additional interface for various subfamilies, see this screenshot by Steve Matteson:

https://img1.wsimg.com/isteam/ip/d627c7cf-7c1f-470d-ad76-dda84041d982/AptosFontMenuImage.png
Comment 13 V Stuart Foote 2024-11-16 15:44:06 UTC
*** Bug 163904 has been marked as a duplicate of this bug. ***