Bug 127423 - Font feature dialog: handle OTF features that are enabled by default (liga, calt, kern)
Summary: Font feature dialog: handle OTF features that are enabled by default (liga, c...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: medium normal
Assignee: ⁨خالد حسني⁩
URL: https://docs.microsoft.com/en-us/typo...
Whiteboard: target:7.5.0
Keywords:
: 126755 (view as bug list)
Depends on: 58941
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2019-09-07 15:16 UTC by Volga
Modified: 2022-12-12 11:48 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file (8.83 KB, application/vnd.oasis.opendocument.text)
2019-09-25 07:11 UTC, Volga
Details
GIF recording (706.70 KB, image/gif)
2020-10-30 02:58 UTC, Volga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Volga 2019-09-07 15:16:16 UTC
Description:
LibreOffice implemented a dialog to switch font feature, but there are some font features are enabled by default, for example, OpenType font feature 'liga' and 'rand'. However this situation doesn't presented in the Font Feature dialog.

To fix this bug, LibreOffice should implemented tri-state checkboxes, and apply them for a font feature that is enabled by default. The first state (checked) can add or replace syntax to enable font feature, the second state (unchecked) can add or replace syntax to disable font feature, the third state do not apply any syntax.

Steps to Reproduce:
-

Actual Results:
-

Expected Results:
-


Reproducible: Always


User Profile Reset: No



Additional Info:
https://en.wikipedia.org/wiki/Checkbox#Tri-state_checkbox
Comment 1 Xisco Faulí 2019-09-23 14:16:16 UTC
Hello Volga,
Do you mean it worked in the past or it's a suggestion for an enhancement?
LibreOffice does support tri-state checkboxes and some dialogs use them...
Comment 2 Volga 2019-09-25 07:11:52 UTC
Created attachment 154466 [details]
Test file

The above file got affect for this interface.

Steps to Reproduce:
1. Select all texts in the file
2. Right click the text, select Character -> Character 
3. Click Features button in the Character dialog
4. Check the standard ligature, then exit the dialog
Then the 'liga' feature is enabled in the Font Name box, but lt looks no effect
5. Open the Character dialog again, click Features button
6. Uncheck the standard ligature, then exit the dialog
Then the 'liga' feature is disappeared in the Font Name box, the texts looks no change

During these steps, the font feature dialog failed to switch 'liga' feature, which is enabled by defaultSo I proposed to use tri-state checkboxes for such font features.
Comment 3 QA Administrators 2019-09-26 03:03:58 UTC Comment hidden (obsolete)
Comment 4 Heiko Tietze 2020-05-04 08:57:53 UTC
Makes not much sense to have a binary option neither on nor off. Liga should switch ligatures like LibreO_ff_ice on/off, IIUC. So why doesn't it work in the first place?
Comment 5 Volga 2020-10-30 02:58:20 UTC
Created attachment 166864 [details]
GIF recording

So let's see what happened to me. Here is illustrated with Libertinus Serif font (https://github.com/alerque/libertinus).

Version: 7.0.3.1 (x64)
Build ID: d7547858d014d4cf69878db179d326fc3483e082
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); 界面: zh-CN
Calc: threaded
Comment 6 QA Administrators 2020-10-30 04:14:44 UTC Comment hidden (obsolete)
Comment 7 Heiko Tietze 2020-10-30 12:20:40 UTC
(In reply to Volga from comment #5)
> So let's see what happened to me.

You mean ff is treated as ligature whatever is set in the dialog?
Comment 8 Volga 2020-11-01 14:31:03 UTC
(In reply to Heiko Tietze from comment #7)
> (In reply to Volga from comment #5)
> > So let's see what happened to me.
> 
> You mean ff is treated as ligature whatever is set in the dialog?
Yes, it is. So what about my suggestion?
Comment 9 Heiko Tietze 2020-11-04 08:16:03 UTC
(In reply to Volga from comment #8)
> > You mean ff is treated as ligature whatever is set in the dialog?
> Yes, it is. So what about my suggestion?

Presumably neither the font is buggy nor LibreOffice handles something wrong it might be a solution. But I don't know if we face an error at some stage or this is intended behavior. Khaled, Stuart: any insights?
Comment 10 Heiko Tietze 2020-11-10 12:54:39 UTC
Tomaz, you did some work around text effects in the past. What's your thoughts?
Comment 11 V Stuart Foote 2020-11-10 15:45:49 UTC
Hmm, noticed with the Libertinus fonts that some of the font features (Standard Ligatures, Contextual Alternates) are enabled by default and can only be suppressed if I annotate the Font list box with a block.  To disable the OTF feature I have to enter a negative, e.g. "Libertinus Serif:-liga&-calt".

But if I then use the Characters... --> Features... dialog, setting additional features active will clobber the negatives. They revert to font defaults.

I don't know the means by which the font signals its default features, assume HarfBuzz.

But if not a tri-mode in the dialog, we do need those defaults shown the font 'Features' dialog--i.e. checked active, and ability to disable via the dialog (with indication in the Font list box).

Could be a simple tweak to Tomaž's work on bug 58941 [1][2]

=-ref-=
[1] https://gerrit.libreoffice.org/c/core/+/55892/
[2] https://gerrit.libreoffice.org/c/core/+/55894/
Comment 12 V Stuart Foote 2020-11-10 15:49:07 UTC
*** Bug 126755 has been marked as a duplicate of this bug. ***
Comment 13 LibreTraining 2020-11-18 22:31:22 UTC
Certain OpenType features are On by default.
This is apart of the OpenType specifications not a font setting or a prorgamming choice in the text shaping engine.

For example OpenType Standard Ligatures (liga) are On by default.
So having a checkbox which adds ":liga" the font name makes no sense.
If Standard Ligatures exist, users only option is to disable them.
The interface should show that Standard ligatures are On by default.
And have a toggle to turn them Off.
That toggle to Off should add "-liga" to the font name.

Same with OpenType Kerning (kern) - it is On by default.
The interface should show that Kerning is On by default.
And have a toggle to turn it Off.
That toggle to Off should add "-kern" to the font name.

Contextual Alternates is On by default.
A checkbox to add ":calt" to the font name makes no sense.
Being able to turn-off calt makes sense ":-calt"
I use that all the time to show the before text for OpenType features.
The interface should show that Contextual Alternates is On by default.

The same for all other OpenType features which are On by default.

Many OpenType features are mutually exclusive.
Having multiple check boxes which enables selecting multiple mutually exclusive OpenType features at the same time makes no sense.
That is confusing to users.
Those mutually exclusive settings should be grouped together and have buttons for each, but only allow selecting one of the group.

For example these are mutually exclusive:
- Denominators (dnom)
- Numerators (numr)
- Subscript (subs)
- Superscript (sups)
- Scientific Inferiors (sinf)
Being able to check all these at once makes no sense.

Also mutually exclusive:
- Tabular Figures (tnum) vs. Proportional Figures (pnum)
- Lining Figures (lnum) vs. Oldstyle Figures
- Small Capitals (smcp) vs. Petite Capitals (pcap)
- etc. etc. ... there are many more
Being able to check all these at once makes no sense.

Similar settings should be grouped together.
Numbers settings, case settings, ligatures (liga, dlig, hlig, rlig, etc.).

Access All Alternates (aalt) enabled as a checkbox makes no sense.
No user checking that box is going to have any idea of what is happening.
The OpenType spec recommends a select list as the interface - which most apps do as it is the only one that makes sense.
It is possible to use something like ":aalt=5" but the average user has no idea of what the options are for each character. Unless you look at the actual OpenType code inside the font you have no idea what is possible for that particular font. Not something the average user is going to do.
That is confusing to users.
The best option is to simply remove it.
A very knowledgeable user is going to add it manually anyway.

The Fractions style selector does not make sense.
Nut fractions do not exist in most fonts and this allows selecting it anyway.
That is confusing to users.
I don't know if this is some holdover from the Graphite stuff or what.
In OpenType ...
- Fractions (frac) is for diagonal fractions
- Alternative Fractions (afrc) is for stacked or nut fractions

The AutoCorrect rules for the legacy Unicode ligatures and fractions can create some confusing interactions with the OpenType ligatures and fractions. 
Probably good to have a warning somewhere to prevent user confusion.
Some fonts have simply removed them to prevent confusion.
But many of the fonts included with LO still have the issues.
And there are a few other AutoCorrect rules which affect OpenType features.

The OpenType specs recommend that certain features not be exposed to users.
Users really do not need to see stuff like MarkPositioning (which is hidden).
But some features may be useful to turn-off - such as calt.
Some of those features may be appropriate to put in a More or Advanced reveal which simplifies the interface to include only the features normally used.
Most users should never touch calt so why put it in their face?

And on and on and on ... 
OpenType is complex and this interface could be improved greatly to add some clarity.

I offered to help create a better OpenType interface over two years ago.
And was met with ignorance combined with arrogance and condescension.
So I dropped it.
I know a lot about OpenType features and could help improve this LO feature.
If a developer would like to work together on this I would be happy to help.
Comment 14 Heiko Tietze 2020-11-19 10:05:09 UTC
(In reply to LibreTraining from comment #13)
> I offered to help create a better OpenType interface over two years ago.
> And was met with ignorance combined with arrogance and condescension.

Please refer to this discussion, ideally a ticket, so we can restart.
Comment 15 V Stuart Foote 2020-11-19 10:33:22 UTC
(In reply to Heiko Tietze from comment #14)
> (In reply to LibreTraining from comment #13)
> > I offered to help create a better OpenType interface over two years ago.
> > And was met with ignorance combined with arrogance and condescension.
> 
> Please refer to this discussion, ideally a ticket, so we can restart.

Expect that was tail end of the see also bug 58941.
Comment 16 Volga 2022-07-27 17:11:29 UTC
As they are all defined as "UI suggestion" in the OpenType Specification, it's resonable to fix this bug anyway.
Comment 17 ⁨خالد حسني⁩ 2022-08-23 12:47:21 UTC
I’m fixing this by making the check boxes a tri-state one and defaulting to indeterminate state (for OpenType, in Graphite we can query the font about the default state).

This might be a bit blunt, but it is the future-proof option. The other option is to have a fixed list of on by default feature and set the check box state based on it, and set any unknown feature to indeterminate state, though this feels rather inconsistent.

https://gerrit.libreoffice.org/c/core/+/138729
Comment 18 Commit Notification 2022-08-23 15:00:53 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/783f166793915a1c5a008de7142f773ad3898683

tdf#127423: Allow disabling default features in Font Features dialog

It will be available in 7.5.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 Stéphane Guillou (stragu) 2022-12-12 11:48:25 UTC
Verified the untogglable third state in:

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