Bug 160634 - Alternate substitution feature does not work when AAT tables are present in font
Summary: Alternate substitution feature does not work when AAT tables are present in font
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.2.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: QA:needsComment
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-12 01:46 UTC by Y. Kawara
Modified: 2024-04-27 03:17 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Test font generated from Four.sfd, with "Mac" option turned on (affected by this bug). (5.12 KB, application/octet-stream)
2024-04-12 01:47 UTC, Y. Kawara
Details
Test font generated from Four_noAAT.sfd, with "Mac" option turned off (not affected by this bug). (4.55 KB, application/octet-stream)
2024-04-12 01:48 UTC, Y. Kawara
Details
FontForge data for Four.ttf (15.59 KB, application/octet-stream)
2024-04-12 01:49 UTC, Y. Kawara
Details
FontForge data for Four_noAAT.ttf (15.68 KB, application/octet-stream)
2024-04-12 01:50 UTC, Y. Kawara
Details
TTX data for Four.ttf (14.16 KB, application/octet-stream)
2024-04-12 01:51 UTC, Y. Kawara
Details
TTX data for Four_noAAT.ttf (13.40 KB, application/octet-stream)
2024-04-12 01:51 UTC, Y. Kawara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Y. Kawara 2024-04-12 01:46:14 UTC
Alternate substitution from OpenType (OT) GSUB table does not work when Adobe Advance Typography (AAT)'s morx and feat tables are present.
It is available in the font features, but it does not work.
It works fine in Inkscape.

For your information, AAT does not have an alternate substitution feature.
AAT and OT have different features, some overlapping, some not, sometimes with some degree of difference.
Font making software like FontForge allows font makers to include both sets of features for better support across platforms, and leaves it up to software to pick up features from any set.

It seems LibreOffice is getting confused with this, but since AAT does not have an alternate subsitution feature, it should really not look into AAT...

For copyright reasons I cannot provide the original font that spurred this bug report, but I have prepared a special font named "Four" as a test case.

I am attaching two versions. In both of these versions, there is a total of 7 characters:
・U+0034 (4)
・U+300C(「)
・U+300D(」)
・U+56DB (四)
・U+FE41(﹁)
・U+FE41(﹂)
・an alternate version of U+0034, encoded at the very end of the font, that displays as "four"

In both versions, alternate substitution feature works as follows:
・U+0034 (4) provides two alternates:
 ・alternate version of U+0034
 ・U+56DB (四)

As explained above, AAT does not have an alternate substitution feature, so vertical substitution feature (very normal for Japanese fonts) has been added to make FontForge add AAT tables. Vertical substitution is available from both OT and AAT. This should not be considered when testing, but I include it for clarity:
・U+300C(「) gets replaced by U+FE41(﹁)
・U+300D(」) gets replaced by U+FE41(﹂)

Four.ttf was generated from Four.sfd, with "Mac" option turned on, as a result,  AAT tables were added from the presentence of a vertical subsitution feature.
Four_noAAT.ttf was generated from Four_noAAT.ttf, with "Mac" option turned off. As a result, no AAT table was added.

Expected result (can be checked with Four_noAAT):
In the font dialog select font, and click "feature" next to the language box.
There is an "Access all alternates" dropdown menu, that allows to select any of the substitutions. Two substitutions are available.
Even without applying, you can see that the substitution will work.

Actual result (can be checked with Four):
In the font dialog select font, and click "feature" next to the language box.
There is an "Access all alternates" dropdown menu, that allows to select any of the substitutions. Two substitutions are available.
The subsitution does nothing.
Alternate substitution should work in both Four_noAAT and Four.

I am also including the original FontForge files, as well as ttx-uncompressed table data.

P.S.: Vertical subsitution works regardless of presence or not of AAT.
P.S.: FontForge has got good documentation about difference between AAT and OT:
https://fontforge.org/docs/techref/gposgsub.html#gposgsub-conversion
Comment 1 Y. Kawara 2024-04-12 01:47:42 UTC
Created attachment 193636 [details]
Test font generated from Four.sfd, with "Mac" option turned on (affected by this bug).
Comment 2 Y. Kawara 2024-04-12 01:48:36 UTC
Created attachment 193637 [details]
Test font generated from Four_noAAT.sfd, with "Mac" option turned off (not affected by this bug).
Comment 3 Y. Kawara 2024-04-12 01:49:25 UTC
Created attachment 193638 [details]
FontForge data for Four.ttf
Comment 4 Y. Kawara 2024-04-12 01:50:09 UTC
Created attachment 193639 [details]
FontForge data for Four_noAAT.ttf
Comment 5 Y. Kawara 2024-04-12 01:51:02 UTC
Created attachment 193640 [details]
TTX data for Four.ttf
Comment 6 Y. Kawara 2024-04-12 01:51:31 UTC
Created attachment 193641 [details]
TTX data for Four_noAAT.ttf
Comment 7 Y. Kawara 2024-04-12 02:11:03 UTC
Two typos in my bug description:

U+FE41(﹂) →  U+FE42(﹂)

Four_noAAT.ttf was generated from Four_noAAT.ttf
 ↓
Four_noAAT.ttf was generated from Four_noAAT.sfd